Skip to content

Commit 1b968ff

Browse files
committed
Deprecate per-rpc status code attributes in favor of
1 parent 41df6e4 commit 1b968ff

File tree

11 files changed

+468
-421
lines changed

11 files changed

+468
-421
lines changed

.chloggen/rpc-error-code.yaml

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
change_type: breaking
2+
component: rpc
3+
note: >
4+
Deprecate `rpc.grpc.status_code`, `rpc.connect_rpc.error_code` and `rpc.jsonrpc.error_code` attributes
5+
in favor of the more general `rpc.status_code` attribute.
6+
7+
issues: [1504, TODO]
8+

docs/otel/sdk-metrics.md

Lines changed: 8 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -1269,9 +1269,9 @@ operations, `error.type` MUST NOT be set. For unsuccessful export operations, `e
12691269
| [`http.response.status_code`](/docs/registry/attributes/http.md) | int | The HTTP status code of the last HTTP request performed in scope of this export call. | `200` | `Recommended` when applicable | ![Stable](https://img.shields.io/badge/-stable-lightgreen) |
12701270
| [`otel.component.name`](/docs/registry/attributes/otel.md) | string | A name uniquely identifying the instance of the OpenTelemetry component within its containing SDK instance. [2] | `otlp_grpc_span_exporter/0`; `custom-name` | `Recommended` | ![Development](https://img.shields.io/badge/-development-blue) |
12711271
| [`otel.component.type`](/docs/registry/attributes/otel.md) | string | A name identifying the type of the OpenTelemetry component. [3] | `otlp_grpc_span_exporter`; `com.example.MySpanExporter` | `Recommended` | ![Development](https://img.shields.io/badge/-development-blue) |
1272-
| [`rpc.grpc.status_code`](/docs/registry/attributes/rpc.md) | int | The gRPC status code of the last gRPC requests performed in scope of this export call. | `0`; `1`; `2` | `Recommended` when applicable | ![Development](https://img.shields.io/badge/-development-blue) |
1273-
| [`server.address`](/docs/registry/attributes/server.md) | string | Server domain name if available without reverse DNS lookup; otherwise, IP address or Unix domain socket name. [4] | `example.com`; `10.1.2.80`; `/tmp/my.sock` | `Recommended` when applicable | ![Stable](https://img.shields.io/badge/-stable-lightgreen) |
1274-
| [`server.port`](/docs/registry/attributes/server.md) | int | Server port number. [5] | `80`; `8080`; `443` | `Recommended` when applicable | ![Stable](https://img.shields.io/badge/-stable-lightgreen) |
1272+
| [`rpc.status_code`](/docs/registry/attributes/rpc.md) | string | The gRPC status code of the last gRPC request performed in scope of this export call. [4] | `OK`; `DEADLINE_EXCEEDED`; `-32602`; `404` | `Recommended` when applicable | ![Development](https://img.shields.io/badge/-development-blue) |
1273+
| [`server.address`](/docs/registry/attributes/server.md) | string | Server domain name if available without reverse DNS lookup; otherwise, IP address or Unix domain socket name. [5] | `example.com`; `10.1.2.80`; `/tmp/my.sock` | `Recommended` when applicable | ![Stable](https://img.shields.io/badge/-stable-lightgreen) |
1274+
| [`server.port`](/docs/registry/attributes/server.md) | int | Server port number. [6] | `80`; `8080`; `443` | `Recommended` when applicable | ![Stable](https://img.shields.io/badge/-stable-lightgreen) |
12751275

12761276
**[1] `error.type`:** The `error.type` SHOULD be predictable, and SHOULD have low cardinality.
12771277

@@ -1310,9 +1310,12 @@ These values will therefore be reused in the case of an application restart.
13101310
**[3] `otel.component.type`:** If none of the standardized values apply, implementations SHOULD use the language-defined name of the type.
13111311
E.g. for Java the fully qualified classname SHOULD be used in this case.
13121312

1313-
**[4] `server.address`:** When observed from the client side, and when communicating through an intermediary, `server.address` SHOULD represent the server address behind any intermediaries, for example proxies, if it's available.
1313+
**[4] `rpc.status_code`:** The status code returned by the RPC server or generated by the client. Usually it represents an error code, but may also represent partial success, warning, or differentiate between various types of successful outcomes.
1314+
Semantic conventions for individual RPC frameworks SHOULD document what `rpc.status_code` means in the context of that system.
13141315

1315-
**[5] `server.port`:** When observed from the client side, and when communicating through an intermediary, `server.port` SHOULD represent the server port behind any intermediaries, for example proxies, if it's available.
1316+
**[5] `server.address`:** When observed from the client side, and when communicating through an intermediary, `server.address` SHOULD represent the server address behind any intermediaries, for example proxies, if it's available.
1317+
1318+
**[6] `server.port`:** When observed from the client side, and when communicating through an intermediary, `server.port` SHOULD represent the server port behind any intermediaries, for example proxies, if it's available.
13161319

13171320
---
13181321

@@ -1345,30 +1348,6 @@ E.g. for Java the fully qualified classname SHOULD be used in this case.
13451348
| `simple_span_processor` | The builtin SDK simple span processor | ![Development](https://img.shields.io/badge/-development-blue) |
13461349
| `zipkin_http_span_exporter` | Zipkin span exporter over HTTP | ![Development](https://img.shields.io/badge/-development-blue) |
13471350

1348-
---
1349-
1350-
`rpc.grpc.status_code` has the following list of well-known values. If one of them applies, then the respective value MUST be used; otherwise, a custom value MAY be used.
1351-
1352-
| Value | Description | Stability |
1353-
|---|---|---|
1354-
| `0` | OK | ![Development](https://img.shields.io/badge/-development-blue) |
1355-
| `1` | CANCELLED | ![Development](https://img.shields.io/badge/-development-blue) |
1356-
| `2` | UNKNOWN | ![Development](https://img.shields.io/badge/-development-blue) |
1357-
| `3` | INVALID_ARGUMENT | ![Development](https://img.shields.io/badge/-development-blue) |
1358-
| `4` | DEADLINE_EXCEEDED | ![Development](https://img.shields.io/badge/-development-blue) |
1359-
| `5` | NOT_FOUND | ![Development](https://img.shields.io/badge/-development-blue) |
1360-
| `6` | ALREADY_EXISTS | ![Development](https://img.shields.io/badge/-development-blue) |
1361-
| `7` | PERMISSION_DENIED | ![Development](https://img.shields.io/badge/-development-blue) |
1362-
| `8` | RESOURCE_EXHAUSTED | ![Development](https://img.shields.io/badge/-development-blue) |
1363-
| `9` | FAILED_PRECONDITION | ![Development](https://img.shields.io/badge/-development-blue) |
1364-
| `10` | ABORTED | ![Development](https://img.shields.io/badge/-development-blue) |
1365-
| `11` | OUT_OF_RANGE | ![Development](https://img.shields.io/badge/-development-blue) |
1366-
| `12` | UNIMPLEMENTED | ![Development](https://img.shields.io/badge/-development-blue) |
1367-
| `13` | INTERNAL | ![Development](https://img.shields.io/badge/-development-blue) |
1368-
| `14` | UNAVAILABLE | ![Development](https://img.shields.io/badge/-development-blue) |
1369-
| `15` | DATA_LOSS | ![Development](https://img.shields.io/badge/-development-blue) |
1370-
| `16` | UNAUTHENTICATED | ![Development](https://img.shields.io/badge/-development-blue) |
1371-
13721351
<!-- markdownlint-restore -->
13731352
<!-- prettier-ignore-end -->
13741353
<!-- END AUTOGENERATED TEXT -->

docs/registry/attributes/rpc.md

Lines changed: 51 additions & 47 deletions
Original file line numberDiff line numberDiff line change
@@ -12,14 +12,10 @@ This document defines attributes for remote procedure calls.
1212

1313
| Attribute | Type | Description | Examples | Stability |
1414
|---|---|---|---|---|
15-
| <a id="rpc-connect-rpc-error-code" href="#rpc-connect-rpc-error-code">`rpc.connect_rpc.error_code`</a> | string | The [error codes](https://connectrpc.com//docs/protocol/#error-codes) of the Connect request. Error codes are always string values. | `cancelled`; `unknown`; `invalid_argument` | ![Development](https://img.shields.io/badge/-development-blue) |
1615
| <a id="rpc-connect-rpc-request-metadata" href="#rpc-connect-rpc-request-metadata">`rpc.connect_rpc.request.metadata.<key>`</a> | string[] | Connect request metadata, `<key>` being the normalized Connect Metadata key (lowercase), the value being the metadata values. [1] | `["1.2.3.4", "1.2.3.5"]` | ![Development](https://img.shields.io/badge/-development-blue) |
1716
| <a id="rpc-connect-rpc-response-metadata" href="#rpc-connect-rpc-response-metadata">`rpc.connect_rpc.response.metadata.<key>`</a> | string[] | Connect response metadata, `<key>` being the normalized Connect Metadata key (lowercase), the value being the metadata values. [2] | `["attribute_value"]` | ![Development](https://img.shields.io/badge/-development-blue) |
1817
| <a id="rpc-grpc-request-metadata" href="#rpc-grpc-request-metadata">`rpc.grpc.request.metadata.<key>`</a> | string[] | gRPC request metadata, `<key>` being the normalized gRPC Metadata key (lowercase), the value being the metadata values. [3] | `["1.2.3.4", "1.2.3.5"]` | ![Development](https://img.shields.io/badge/-development-blue) |
1918
| <a id="rpc-grpc-response-metadata" href="#rpc-grpc-response-metadata">`rpc.grpc.response.metadata.<key>`</a> | string[] | gRPC response metadata, `<key>` being the normalized gRPC Metadata key (lowercase), the value being the metadata values. [4] | `["attribute_value"]` | ![Development](https://img.shields.io/badge/-development-blue) |
20-
| <a id="rpc-grpc-status-code" href="#rpc-grpc-status-code">`rpc.grpc.status_code`</a> | int | The [numeric status code](https://github.com/grpc/grpc/blob/v1.33.2/doc/statuscodes.md) of the gRPC request. | `0`; `1`; `2` | ![Development](https://img.shields.io/badge/-development-blue) |
21-
| <a id="rpc-jsonrpc-error-code" href="#rpc-jsonrpc-error-code">`rpc.jsonrpc.error_code`</a> | int | `error.code` property of response if it is an error response. | `-32700`; `100` | ![Development](https://img.shields.io/badge/-development-blue) |
22-
| <a id="rpc-jsonrpc-error-message" href="#rpc-jsonrpc-error-message">`rpc.jsonrpc.error_message`</a> | string | `error.message` property of response if it is an error response. | `Parse error`; `User already exists` | ![Development](https://img.shields.io/badge/-development-blue) |
2319
| <a id="rpc-jsonrpc-request-id" href="#rpc-jsonrpc-request-id">`rpc.jsonrpc.request_id`</a> | string | `id` property of request or response. Since protocol allows id to be int, string, `null` or missing (for notifications), value is expected to be cast to string for simplicity. Use empty string in case of `null` value. Omit entirely if this is a notification. | `10`; `request-7`; `` | ![Development](https://img.shields.io/badge/-development-blue) |
2420
| <a id="rpc-jsonrpc-version" href="#rpc-jsonrpc-version">`rpc.jsonrpc.version`</a> | string | Protocol version as in `jsonrpc` property of request/response. Since JSON-RPC 1.0 doesn't specify this, the value can be omitted. | `2.0`; `1.0` | ![Development](https://img.shields.io/badge/-development-blue) |
2521
| <a id="rpc-message-compressed-size" href="#rpc-message-compressed-size">`rpc.message.compressed_size`</a> | int | Compressed size of the message in bytes. | | ![Development](https://img.shields.io/badge/-development-blue) |
@@ -28,6 +24,7 @@ This document defines attributes for remote procedure calls.
2824
| <a id="rpc-message-uncompressed-size" href="#rpc-message-uncompressed-size">`rpc.message.uncompressed_size`</a> | int | Uncompressed size of the message in bytes. | | ![Development](https://img.shields.io/badge/-development-blue) |
2925
| <a id="rpc-method" href="#rpc-method">`rpc.method`</a> | string | This is the logical name of the method from the RPC interface perspective. | `exampleMethod` | ![Development](https://img.shields.io/badge/-development-blue) |
3026
| <a id="rpc-service" href="#rpc-service">`rpc.service`</a> | string | The full (logical) name of the service being called, including its package name, if applicable. | `myservice.EchoService` | ![Development](https://img.shields.io/badge/-development-blue) |
27+
| <a id="rpc-status-code" href="#rpc-status-code">`rpc.status_code`</a> | string | Status code of the RPC call. [6] | `OK`; `DEADLINE_EXCEEDED`; `-32602`; `404` | ![Development](https://img.shields.io/badge/-development-blue) |
3128
| <a id="rpc-system" href="#rpc-system">`rpc.system`</a> | string | A string identifying the remoting system. See below for a list of well-known identifiers. | `grpc`; `java_rmi`; `dotnet_wcf` | ![Development](https://img.shields.io/badge/-development-blue) |
3229

3330
**[1] `rpc.connect_rpc.request.metadata.<key>`:** Instrumentations SHOULD require an explicit configuration of which metadata values are to be captured.
@@ -56,6 +53,56 @@ the `rpc.grpc.response.metadata.my-custom-key` attribute with value `["attribute
5653

5754
**[5] `rpc.message.id`:** This way we guarantee that the values will be consistent between different implementations.
5855

56+
**[6] `rpc.status_code`:** The status code returned by the RPC server or generated by the client. Usually it represents an error code, but may also represent partial success, warning, or differentiate between various types of successful outcomes.
57+
Semantic conventions for individual RPC frameworks SHOULD document what `rpc.status_code` means in the context of that system.
58+
59+
---
60+
61+
`rpc.message.type` has the following list of well-known values. If one of them applies, then the respective value MUST be used; otherwise, a custom value MAY be used.
62+
63+
| Value | Description | Stability |
64+
|---|---|---|
65+
| `RECEIVED` | received | ![Development](https://img.shields.io/badge/-development-blue) |
66+
| `SENT` | sent | ![Development](https://img.shields.io/badge/-development-blue) |
67+
68+
---
69+
70+
`rpc.system` has the following list of well-known values. If one of them applies, then the respective value MUST be used; otherwise, a custom value MAY be used.
71+
72+
| Value | Description | Stability |
73+
|---|---|---|
74+
| `apache_dubbo` | Apache Dubbo | ![Development](https://img.shields.io/badge/-development-blue) |
75+
| `connect_rpc` | Connect RPC | ![Development](https://img.shields.io/badge/-development-blue) |
76+
| `dotnet_wcf` | .NET WCF | ![Development](https://img.shields.io/badge/-development-blue) |
77+
| `grpc` | gRPC | ![Development](https://img.shields.io/badge/-development-blue) |
78+
| `java_rmi` | Java RMI | ![Development](https://img.shields.io/badge/-development-blue) |
79+
| `jsonrpc` | JSON-RPC | ![Development](https://img.shields.io/badge/-development-blue) |
80+
| `onc_rpc` | [ONC RPC (Sun RPC)](https://datatracker.ietf.org/doc/html/rfc5531) | ![Development](https://img.shields.io/badge/-development-blue) |
81+
82+
## Deprecated RPC Attributes
83+
84+
Deprecated rpc message attributes.
85+
86+
| Attribute | Type | Description | Examples | Stability |
87+
|---|---|---|---|---|
88+
| <a id="message-compressed-size" href="#message-compressed-size">`message.compressed_size`</a> | int | Deprecated, use `rpc.message.compressed_size` instead. | | ![Deprecated](https://img.shields.io/badge/-deprecated-red)<br>Replaced by `rpc.message.compressed_size`. |
89+
| <a id="message-id" href="#message-id">`message.id`</a> | int | Deprecated, use `rpc.message.id` instead. | | ![Deprecated](https://img.shields.io/badge/-deprecated-red)<br>Replaced by `rpc.message.id`. |
90+
| <a id="message-type" href="#message-type">`message.type`</a> | string | Deprecated, use `rpc.message.type` instead. | `SENT`; `RECEIVED` | ![Deprecated](https://img.shields.io/badge/-deprecated-red)<br>Replaced by `rpc.message.type`. |
91+
| <a id="message-uncompressed-size" href="#message-uncompressed-size">`message.uncompressed_size`</a> | int | Deprecated, use `rpc.message.uncompressed_size` instead. | | ![Deprecated](https://img.shields.io/badge/-deprecated-red)<br>Replaced by `rpc.message.uncompressed_size`. |
92+
| <a id="rpc-connect-rpc-error-code" href="#rpc-connect-rpc-error-code">`rpc.connect_rpc.error_code`</a> | string | Deprecated, use `rpc.status_code` attribute instead. | `cancelled`; `unknown`; `invalid_argument` | ![Deprecated](https://img.shields.io/badge/-deprecated-red)<br>Replaced by `rpc.status_code`. |
93+
| <a id="rpc-grpc-status-code" href="#rpc-grpc-status-code">`rpc.grpc.status_code`</a> | int | Deprecated, use string representation on the `rpc.status_code` attribute instead. | `0`; `1`; `2` | ![Deprecated](https://img.shields.io/badge/-deprecated-red)<br>Use string representation of the gRPC status code on the `rpc.status_code` attribute. |
94+
| <a id="rpc-jsonrpc-error-code" href="#rpc-jsonrpc-error-code">`rpc.jsonrpc.error_code`</a> | int | Deprecated, use string representation on the `rpc.status_code` attribute instead. | `-32700`; `100` | ![Deprecated](https://img.shields.io/badge/-deprecated-red)<br>Use string representation of the error code on the `rpc.status_code` attribute. |
95+
| <a id="rpc-jsonrpc-error-message" href="#rpc-jsonrpc-error-message">`rpc.jsonrpc.error_message`</a> | string | Deprecated, use span status description or `error.message` attribute on other signals. | `Parse error`; `User already exists` | ![Deprecated](https://img.shields.io/badge/-deprecated-red)<br>Use the span status description to record error message or `error.message` attribute on other signals. |
96+
97+
---
98+
99+
`message.type` has the following list of well-known values. If one of them applies, then the respective value MUST be used; otherwise, a custom value MAY be used.
100+
101+
| Value | Description | Stability |
102+
|---|---|---|
103+
| `RECEIVED` | received | ![Development](https://img.shields.io/badge/-development-blue) |
104+
| `SENT` | sent | ![Development](https://img.shields.io/badge/-development-blue) |
105+
59106
---
60107

61108
`rpc.connect_rpc.error_code` has the following list of well-known values. If one of them applies, then the respective value MUST be used; otherwise, a custom value MAY be used.
@@ -102,46 +149,3 @@ the `rpc.grpc.response.metadata.my-custom-key` attribute with value `["attribute
102149
| `14` | UNAVAILABLE | ![Development](https://img.shields.io/badge/-development-blue) |
103150
| `15` | DATA_LOSS | ![Development](https://img.shields.io/badge/-development-blue) |
104151
| `16` | UNAUTHENTICATED | ![Development](https://img.shields.io/badge/-development-blue) |
105-
106-
---
107-
108-
`rpc.message.type` has the following list of well-known values. If one of them applies, then the respective value MUST be used; otherwise, a custom value MAY be used.
109-
110-
| Value | Description | Stability |
111-
|---|---|---|
112-
| `RECEIVED` | received | ![Development](https://img.shields.io/badge/-development-blue) |
113-
| `SENT` | sent | ![Development](https://img.shields.io/badge/-development-blue) |
114-
115-
---
116-
117-
`rpc.system` has the following list of well-known values. If one of them applies, then the respective value MUST be used; otherwise, a custom value MAY be used.
118-
119-
| Value | Description | Stability |
120-
|---|---|---|
121-
| `apache_dubbo` | Apache Dubbo | ![Development](https://img.shields.io/badge/-development-blue) |
122-
| `connect_rpc` | Connect RPC | ![Development](https://img.shields.io/badge/-development-blue) |
123-
| `dotnet_wcf` | .NET WCF | ![Development](https://img.shields.io/badge/-development-blue) |
124-
| `grpc` | gRPC | ![Development](https://img.shields.io/badge/-development-blue) |
125-
| `java_rmi` | Java RMI | ![Development](https://img.shields.io/badge/-development-blue) |
126-
| `jsonrpc` | JSON-RPC | ![Development](https://img.shields.io/badge/-development-blue) |
127-
| `onc_rpc` | [ONC RPC (Sun RPC)](https://datatracker.ietf.org/doc/html/rfc5531) | ![Development](https://img.shields.io/badge/-development-blue) |
128-
129-
## Deprecated RPC Attributes
130-
131-
Deprecated rpc message attributes.
132-
133-
| Attribute | Type | Description | Examples | Stability |
134-
|---|---|---|---|---|
135-
| <a id="message-compressed-size" href="#message-compressed-size">`message.compressed_size`</a> | int | Deprecated, use `rpc.message.compressed_size` instead. | | ![Deprecated](https://img.shields.io/badge/-deprecated-red)<br>Replaced by `rpc.message.compressed_size`. |
136-
| <a id="message-id" href="#message-id">`message.id`</a> | int | Deprecated, use `rpc.message.id` instead. | | ![Deprecated](https://img.shields.io/badge/-deprecated-red)<br>Replaced by `rpc.message.id`. |
137-
| <a id="message-type" href="#message-type">`message.type`</a> | string | Deprecated, use `rpc.message.type` instead. | `SENT`; `RECEIVED` | ![Deprecated](https://img.shields.io/badge/-deprecated-red)<br>Replaced by `rpc.message.type`. |
138-
| <a id="message-uncompressed-size" href="#message-uncompressed-size">`message.uncompressed_size`</a> | int | Deprecated, use `rpc.message.uncompressed_size` instead. | | ![Deprecated](https://img.shields.io/badge/-deprecated-red)<br>Replaced by `rpc.message.uncompressed_size`. |
139-
140-
---
141-
142-
`message.type` has the following list of well-known values. If one of them applies, then the respective value MUST be used; otherwise, a custom value MAY be used.
143-
144-
| Value | Description | Stability |
145-
|---|---|---|
146-
| `RECEIVED` | received | ![Development](https://img.shields.io/badge/-development-blue) |
147-
| `SENT` | sent | ![Development](https://img.shields.io/badge/-development-blue) |

0 commit comments

Comments
 (0)