Skip to content
ADP
API Design PrincipleBETA

[ADP-611] Event Severity

Overview

In event-driven systems, the ability to distinguish events of different severity levels is crucial for effective event handling and system monitoring. This ADP defines a standard method for marking event severity using the CloudEvents severity extension.

Guidelines

When there's a need to differentiate event severity:

  1. The CloudEvents severity extension MUST be used to mark the severity of events.

  2. Event producers MUST set both severitytext and severitynumber attributes for events that require severity marking.

  3. The severitytext attribute MUST be one of the following predefined values: ALERT, CRITICAL, ERROR, WARNING, NOTICE, INFORMATIONAL, DEBUG.

  4. The severitynumber attribute MUST be an integer between 0 and 399.

  5. severitytext and severitynumber MUST be consistent, following this mapping:

    • ALERT: 9-0
    • CRITICAL: 19-10
    • ERROR: 29-20
    • WARNING: 39-30
    • NOTICE: 49-40
    • INFORMATIONAL: 99-50
    • DEBUG: 399-100
  6. Event consumers SHOULD be able to handle and prioritize events appropriately based on their severity.

  7. System designers SHOULD define clear guidelines for using severity levels to ensure consistency.

CloudEvents Severity Extension

The severity extension adds two properties to CloudEvents:

  • severity: A string value indicating the event's severity level.
  • severitynumber: A numeric value indicating the event's severity level.

Example of a CloudEvent with severity and severitynumber:

json
{
    "specversion" : "1.0",
    "type" : "com.example.someevent",
    "source" : "/mycontext",
    "id" : "C234-1234-1234",
    "time" : "2023-06-01T10:30:00Z",
    "severitytext": "ERROR",
    "severitynumber": 25,
    "data" : {
        "message" : "This is an error event"
    }
}

Implementation Recommendations

  1. Establish clear severity classification standards to ensure consistent understanding and use among team members.

  2. Implement severity-based event routing and handling mechanisms, considering both severitytext and severitynumber.

  3. Consider integrating severity with alert systems for timely response to high-severity events.

  4. Use severity information in logging and monitoring systems to optimize problem diagnosis and system health assessment.

References