-
Notifications
You must be signed in to change notification settings - Fork 352
Define HTTP exception events #3414
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
+158
−0
Merged
Changes from all commits
Commits
Show all changes
8 commits
Select commit
Hold shift + click to select a range
df3644e
Define HTTP exception events
trask 1d5efab
Move entire description into yaml
trask 94d31ab
Rename http.(client|server).exception to http.(client|server).request…
trask f5dc3d6
severity
trask 98863e9
Change HTTP client exception severity to WARN
trask 94ea2f4
Add note about copying span attributes to exception events
trask fec4913
HTTP
trask cb710b4
limit artificial exception note to client side
trask File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,8 @@ | ||
| change_type: enhancement | ||
| component: http | ||
| note: Define `http.client.request.exception` and `http.server.request.exception` events for recording exceptions during HTTP operations | ||
| issues: [3414] | ||
| subtext: | | ||
| These domain-specific exception events provide a structured way to record | ||
| exceptions that occur during HTTP client requests (network failures, timeouts) | ||
| and HTTP server request processing (application errors, internal failures). |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,97 @@ | ||
| <!--- Hugo front matter used to generate the website version of this page: | ||
| linkTitle: Exceptions | ||
| ---> | ||
|
|
||
| # Semantic conventions for HTTP exceptions | ||
|
|
||
| **Status**: [Development][DocumentStatus] | ||
|
|
||
| This document defines semantic conventions for recording exceptions on HTTP operations. | ||
|
|
||
| <!-- toc --> | ||
|
|
||
| - [HTTP client request exception](#http-client-request-exception) | ||
| - [HTTP server request exception](#http-server-request-exception) | ||
|
|
||
| <!-- tocstop --> | ||
|
|
||
| ## HTTP client request exception | ||
|
|
||
| <!-- semconv event.http.client.request.exception --> | ||
| <!-- NOTE: THIS TEXT IS AUTOGENERATED. DO NOT EDIT BY HAND. --> | ||
| <!-- see templates/registry/markdown/snippet.md.j2 --> | ||
| <!-- prettier-ignore-start --> | ||
|
|
||
| **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](https://opentelemetry.io/docs/specs/semconv/general/attribute-requirement-level/) | Value Type | Description | Example Values | | ||
| | --- | --- | --- | --- | --- | --- | | ||
| | [`exception.message`](/docs/registry/attributes/exception.md) |  | `Conditionally Required` [1] | string | The exception message. [2] | `Division by zero`; `Can't convert 'int' object to str implicitly` | | ||
| | [`exception.type`](/docs/registry/attributes/exception.md) |  | `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`](/docs/registry/attributes/exception.md) |  | `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`:** | ||
|
|
||
| > [!WARNING] | ||
| > | ||
| > This attribute may contain sensitive information. | ||
|
|
||
| **[3] `exception.type`:** Required if `exception.message` is not set, recommended otherwise. | ||
|
|
||
| <!-- prettier-ignore-end --> | ||
| <!-- END AUTOGENERATED TEXT --> | ||
| <!-- endsemconv --> | ||
|
|
||
| ## HTTP server request exception | ||
|
|
||
| <!-- semconv event.http.server.request.exception --> | ||
| <!-- NOTE: THIS TEXT IS AUTOGENERATED. DO NOT EDIT BY HAND. --> | ||
| <!-- see templates/registry/markdown/snippet.md.j2 --> | ||
| <!-- prettier-ignore-start --> | ||
|
|
||
| **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](https://opentelemetry.io/docs/specs/semconv/general/attribute-requirement-level/) | Value Type | Description | Example Values | | ||
| | --- | --- | --- | --- | --- | --- | | ||
| | [`exception.message`](/docs/registry/attributes/exception.md) |  | `Conditionally Required` [1] | string | The exception message. [2] | `Division by zero`; `Can't convert 'int' object to str implicitly` | | ||
| | [`exception.type`](/docs/registry/attributes/exception.md) |  | `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`](/docs/registry/attributes/exception.md) |  | `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`:** | ||
|
|
||
| > [!WARNING] | ||
| > | ||
| > This attribute may contain sensitive information. | ||
|
|
||
| **[3] `exception.type`:** Required if `exception.message` is not set, recommended otherwise. | ||
|
|
||
| <!-- prettier-ignore-end --> | ||
| <!-- END AUTOGENERATED TEXT --> | ||
| <!-- endsemconv --> | ||
|
|
||
| [DocumentStatus]: https://opentelemetry.io/docs/specs/otel/document-status |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,52 @@ | ||
| groups: | ||
| - id: event.http.client.request.exception | ||
| name: http.client.request.exception | ||
| stability: development | ||
| type: event | ||
| brief: > | ||
| 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. | ||
| note: > | ||
| 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: | ||
| - ref: exception.type | ||
| requirement_level: | ||
| conditionally_required: Required if `exception.message` is not set, recommended otherwise. | ||
| - ref: exception.message | ||
| requirement_level: | ||
| conditionally_required: Required if `exception.type` is not set, recommended otherwise. | ||
| - ref: exception.stacktrace | ||
|
|
||
| - id: event.http.server.request.exception | ||
| name: http.server.request.exception | ||
| stability: development | ||
| type: event | ||
| brief: > | ||
| 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. | ||
| note: > | ||
| 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: | ||
| - ref: exception.type | ||
| requirement_level: | ||
| conditionally_required: Required if `exception.message` is not set, recommended otherwise. | ||
| - ref: exception.message | ||
| requirement_level: | ||
| conditionally_required: Required if `exception.type` is not set, recommended otherwise. | ||
| - ref: exception.stacktrace |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.