Semantic conventions for HTTP exceptions
Status: Development
This document defines semantic conventions for recording exceptions on HTTP operations.
HTTP client request exception
Status:
The event name MUST be http.client.request.exception.
This event represents an exception that occurred during an HTTP client request, such as network failures, timeouts, or other errors that prevent the request from completing successfully.
This event SHOULD be recorded when an exception occurs during HTTP client operations. Instrumentations SHOULD set the severity to WARN (severity number 13) when recording this event. Some HTTP client frameworks generate artificial exceptions for non-successful HTTP status codes (e.g., 404 Not Found). When possible, instrumentations SHOULD NOT record these artificial exceptions, or SHOULD set the severity to DEBUG (severity number 5). Instrumentations MAY provide a configuration option to populate exception events with the attributes captured on the corresponding HTTP client span.
Attributes:
| Key | Stability | Requirement Level | Value Type | Description | Example Values |
|---|---|---|---|---|---|
exception.message | Conditionally Required [1] | string | The exception message. [2] | Division by zero; Can't convert 'int' object to str implicitly | |
exception.type | Conditionally Required [3] | string | The type of the exception (its fully-qualified class name, if applicable). The dynamic type of the exception should be preferred over the static type in languages that support it. | java.net.ConnectException; OSError | |
exception.stacktrace | Recommended | string | A stacktrace as a string in the natural representation for the language runtime. The representation is to be determined and documented by each language SIG. | Exception in thread "main" java.lang.RuntimeException: Test exception\n at com.example.GenerateTrace.methodB(GenerateTrace.java:13)\n at com.example.GenerateTrace.methodA(GenerateTrace.java:9)\n at com.example.GenerateTrace.main(GenerateTrace.java:5) |
[1] exception.message: Required if exception.type is not set, recommended otherwise.
[2] exception.message:
This attribute may contain sensitive information.
[3] exception.type: Required if exception.message is not set, recommended otherwise.
HTTP server request exception
Status:
The event name MUST be http.server.request.exception.
This event represents an exception that occurred during HTTP server request processing, such as application errors, internal failures, or other exceptions that prevent the server from successfully handling the request.
This event SHOULD be recorded when an exception occurs during HTTP server request processing. Instrumentations SHOULD set the severity to ERROR (severity number 17) when recording this event. Instrumentations MAY provide a configuration option to populate exception events with the attributes captured on the corresponding HTTP server span.
Attributes:
| Key | Stability | Requirement Level | Value Type | Description | Example Values |
|---|---|---|---|---|---|
exception.message | Conditionally Required [1] | string | The exception message. [2] | Division by zero; Can't convert 'int' object to str implicitly | |
exception.type | Conditionally Required [3] | string | The type of the exception (its fully-qualified class name, if applicable). The dynamic type of the exception should be preferred over the static type in languages that support it. | java.net.ConnectException; OSError | |
exception.stacktrace | Recommended | string | A stacktrace as a string in the natural representation for the language runtime. The representation is to be determined and documented by each language SIG. | Exception in thread "main" java.lang.RuntimeException: Test exception\n at com.example.GenerateTrace.methodB(GenerateTrace.java:13)\n at com.example.GenerateTrace.methodA(GenerateTrace.java:9)\n at com.example.GenerateTrace.main(GenerateTrace.java:5) |
[1] exception.message: Required if exception.type is not set, recommended otherwise.
[2] exception.message:
This attribute may contain sensitive information.
[3] exception.type: Required if exception.message is not set, recommended otherwise.
Feedback
Was this page helpful?
Thank you. Your feedback is appreciated!
Please let us know how we can improve this page. Your feedback is appreciated!