Skip to content

Commit 262271f

Browse files
trisch-melmolkovaAlexanderWertjoaopgrassi
authored
move rpc.message to the registry (#854)
Co-authored-by: Liudmila Molkova <[email protected]> Co-authored-by: Alexander Wert <[email protected]> Co-authored-by: Joao Grassi <[email protected]>
1 parent a307d19 commit 262271f

File tree

7 files changed

+132
-36
lines changed

7 files changed

+132
-36
lines changed

.chloggen/rpc_registry.yaml

+22
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
# Use this changelog template to create an entry for release notes.
2+
#
3+
# If your change doesn't affect end users you should instead start
4+
# your pull request title with [chore] or use the "Skip Changelog" label.
5+
6+
# One of 'breaking', 'deprecation', 'new_component', 'enhancement', 'bug_fix'
7+
change_type: breaking
8+
9+
# The name of the area of concern in the attributes-registry, (e.g. http, cloud, db)
10+
component: rpc
11+
12+
# A brief description of the change. Surround your text with quotes ("") if it needs to start with a backtick (`).
13+
note: Rename`message.*` attributes under `rpc` to `rpc.message.*`. Deprecate old `message.*` attributes.
14+
15+
# Mandatory: One or more tracking issues related to the change. You can use the PR number here if no issue exists.
16+
# The values here must be integers.
17+
issues: [854]
18+
19+
# (Optional) One or more lines of additional information to render under the primary note.
20+
# These lines will be padded with 2 spaces and then inserted directly into the document.
21+
# Use pipe (|) for multiline entries.
22+
subtext:

docs/attributes-registry/rpc.md

+17-4
Original file line numberDiff line numberDiff line change
@@ -20,8 +20,12 @@ RPC attributes are intended to be used in the context of events related to remot
2020
| `rpc.jsonrpc.error_message` | string | `error.message` property of response if it is an error response. | `Parse error`; `User already exists` | ![Experimental](https://img.shields.io/badge/-experimental-blue) |
2121
| `rpc.jsonrpc.request_id` | 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`; `` | ![Experimental](https://img.shields.io/badge/-experimental-blue) |
2222
| `rpc.jsonrpc.version` | 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` | ![Experimental](https://img.shields.io/badge/-experimental-blue) |
23-
| `rpc.method` | string | The name of the (logical) method being called, must be equal to the $method part in the span name. [5] | `exampleMethod` | ![Experimental](https://img.shields.io/badge/-experimental-blue) |
24-
| `rpc.service` | string | The full (logical) name of the service being called, including its package name, if applicable. [6] | `myservice.EchoService` | ![Experimental](https://img.shields.io/badge/-experimental-blue) |
23+
| `rpc.message.compressed_size` | int | Compressed size of the message in bytes. | | ![Experimental](https://img.shields.io/badge/-experimental-blue) |
24+
| `rpc.message.id` | int | MUST be calculated as two different counters starting from `1` one for sent messages and one for received message. [5] | | ![Experimental](https://img.shields.io/badge/-experimental-blue) |
25+
| `rpc.message.type` | string | Whether this is a received or sent message. | `SENT` | ![Experimental](https://img.shields.io/badge/-experimental-blue) |
26+
| `rpc.message.uncompressed_size` | int | Uncompressed size of the message in bytes. | | ![Experimental](https://img.shields.io/badge/-experimental-blue) |
27+
| `rpc.method` | string | The name of the (logical) method being called, must be equal to the $method part in the span name. [6] | `exampleMethod` | ![Experimental](https://img.shields.io/badge/-experimental-blue) |
28+
| `rpc.service` | string | The full (logical) name of the service being called, including its package name, if applicable. [7] | `myservice.EchoService` | ![Experimental](https://img.shields.io/badge/-experimental-blue) |
2529
| `rpc.system` | string | A string identifying the remoting system. See below for a list of well-known identifiers. | `grpc` | ![Experimental](https://img.shields.io/badge/-experimental-blue) |
2630

2731
**[1]:** Instrumentations SHOULD require an explicit configuration of which metadata values are to be captured. Including all request metadata values can be a security risk - explicit configuration helps avoid leaking sensitive information.
@@ -32,9 +36,11 @@ RPC attributes are intended to be used in the context of events related to remot
3236

3337
**[4]:** Instrumentations SHOULD require an explicit configuration of which metadata values are to be captured. Including all response metadata values can be a security risk - explicit configuration helps avoid leaking sensitive information.
3438

35-
**[5]:** This is the logical name of the method from the RPC interface perspective, which can be different from the name of any implementing method/function. The `code.function` attribute may be used to store the latter (e.g., method actually executing the call on the server side, RPC client stub method on the client side).
39+
**[5]:** This way we guarantee that the values will be consistent between different implementations.
3640

37-
**[6]:** This is the logical name of the service from the RPC interface perspective, which can be different from the name of any implementing class. The `code.namespace` attribute may be used to store the latter (despite the attribute name, it may include a class name; e.g., class with method actually executing the call on the server side, RPC client stub class on the client side).
41+
**[6]:** This is the logical name of the method from the RPC interface perspective, which can be different from the name of any implementing method/function. The `code.function` attribute may be used to store the latter (e.g., method actually executing the call on the server side, RPC client stub method on the client side).
42+
43+
**[7]:** This is the logical name of the service from the RPC interface perspective, which can be different from the name of any implementing class. The `code.namespace` attribute may be used to store the latter (despite the attribute name, it may include a class name; e.g., class with method actually executing the call on the server side, RPC client stub class on the client side).
3844

3945
`rpc.connect_rpc.error_code` MUST be one of the following:
4046

@@ -79,6 +85,13 @@ RPC attributes are intended to be used in the context of events related to remot
7985
| `15` | DATA_LOSS | ![Experimental](https://img.shields.io/badge/-experimental-blue) |
8086
| `16` | UNAUTHENTICATED | ![Experimental](https://img.shields.io/badge/-experimental-blue) |
8187

88+
`rpc.message.type` MUST be one of the following:
89+
90+
| Value | Description | Stability |
91+
|---|---|---|
92+
| `SENT` | sent | ![Experimental](https://img.shields.io/badge/-experimental-blue) |
93+
| `RECEIVED` | received | ![Experimental](https://img.shields.io/badge/-experimental-blue) |
94+
8295
`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.
8396

8497
| Value | Description | Stability |

docs/rpc/rpc-spans.md

+7-7
Original file line numberDiff line numberDiff line change
@@ -191,19 +191,19 @@ In the lifetime of an RPC stream, an event for each message sent/received on
191191
client and server spans SHOULD be created. In case of unary calls only one sent
192192
and one received message will be recorded for both client and server spans.
193193

194-
<!-- semconv rpc.message -->
195-
The event name MUST be `message`.
194+
<!-- semconv rpc.message(full) -->
195+
The event name MUST be `rpc.message`.
196196

197197
| Attribute | Type | Description | Examples | [Requirement Level](https://opentelemetry.io/docs/specs/semconv/general/attribute-requirement-level/) | Stability |
198198
|---|---|---|---|---|---|
199-
| `message.compressed_size` | int | Compressed size of the message in bytes. | | `Recommended` | ![Experimental](https://img.shields.io/badge/-experimental-blue) |
200-
| `message.id` | int | MUST be calculated as two different counters starting from `1` one for sent messages and one for received message. [1] | | `Recommended` | ![Experimental](https://img.shields.io/badge/-experimental-blue) |
201-
| `message.type` | string | Whether this is a received or sent message. | `SENT` | `Recommended` | ![Experimental](https://img.shields.io/badge/-experimental-blue) |
202-
| `message.uncompressed_size` | int | Uncompressed size of the message in bytes. | | `Recommended` | ![Experimental](https://img.shields.io/badge/-experimental-blue) |
199+
| [`rpc.message.compressed_size`](../attributes-registry/rpc.md) | int | Compressed size of the message in bytes. | | `Recommended` | ![Experimental](https://img.shields.io/badge/-experimental-blue) |
200+
| [`rpc.message.id`](../attributes-registry/rpc.md) | int | MUST be calculated as two different counters starting from `1` one for sent messages and one for received message. [1] | | `Recommended` | ![Experimental](https://img.shields.io/badge/-experimental-blue) |
201+
| [`rpc.message.type`](../attributes-registry/rpc.md) | string | Whether this is a received or sent message. | `SENT` | `Recommended` | ![Experimental](https://img.shields.io/badge/-experimental-blue) |
202+
| [`rpc.message.uncompressed_size`](../attributes-registry/rpc.md) | int | Uncompressed size of the message in bytes. | | `Recommended` | ![Experimental](https://img.shields.io/badge/-experimental-blue) |
203203

204204
**[1]:** This way we guarantee that the values will be consistent between different implementations.
205205

206-
`message.type` MUST be one of the following:
206+
`rpc.message.type` MUST be one of the following:
207207

208208
| Value | Description | Stability |
209209
|---|---|---|

model/registry/deprecated/rpc.yaml

+32
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
groups:
2+
- id: attributes.rpc.deprecated
3+
type: attribute_group
4+
brief: 'Deprecated rpc message attributes.'
5+
attributes:
6+
- id: message.type
7+
type:
8+
members:
9+
- id: sent
10+
value: "SENT"
11+
stability: experimental
12+
- id: received
13+
value: "RECEIVED"
14+
stability: experimental
15+
stability: experimental
16+
brief: "Deprecated, use `rpc.message.type` instead."
17+
deprecated: "Replaced by `rpc.message.type`."
18+
- id: message.id
19+
type: int
20+
stability: experimental
21+
brief: "Deprecated, use `rpc.message.id` instead."
22+
deprecated: "Replaced by `rpc.message.id`."
23+
- id: message.compressed_size
24+
type: int
25+
stability: experimental
26+
brief: "Deprecated, use `rpc.message.compressed_size` instead."
27+
deprecated: "Replaced by `rpc.message.compressed_size`."
28+
- id: message.uncompressed_size
29+
type: int
30+
stability: experimental
31+
brief: "Deprecated, use `rpc.message.uncompressed_size` instead."
32+
deprecated: "Replaced by `rpc.message.uncompressed_size`."

model/registry/rpc.yaml

+24
Original file line numberDiff line numberDiff line change
@@ -239,3 +239,27 @@ groups:
239239
brief: 'Connect RPC'
240240
stability: experimental
241241
stability: experimental
242+
- id: message.type
243+
type:
244+
members:
245+
- id: sent
246+
value: "SENT"
247+
stability: experimental
248+
- id: received
249+
value: "RECEIVED"
250+
stability: experimental
251+
stability: experimental
252+
brief: "Whether this is a received or sent message."
253+
- id: message.id
254+
type: int
255+
stability: experimental
256+
brief: "MUST be calculated as two different counters starting from `1` one for sent messages and one for received message."
257+
note: "This way we guarantee that the values will be consistent between different implementations."
258+
- id: message.compressed_size
259+
type: int
260+
stability: experimental
261+
brief: "Compressed size of the message in bytes."
262+
- id: message.uncompressed_size
263+
type: int
264+
stability: experimental
265+
brief: "Uncompressed size of the message in bytes."

model/trace/rpc.yaml

+21-25
Original file line numberDiff line numberDiff line change
@@ -8,9 +8,13 @@ groups:
88
- ref: rpc.system
99
requirement_level: required
1010
- ref: rpc.service
11+
requirement_level: recommended
1112
- ref: rpc.method
13+
requirement_level: recommended
1214
- ref: network.transport
15+
requirement_level: recommended
1316
- ref: network.type
17+
requirement_level: recommended
1418
- ref: server.address
1519
requirement_level: required
1620
brief: >
@@ -29,6 +33,7 @@ groups:
2933
extends: rpc
3034
attributes:
3135
- ref: network.peer.address
36+
requirement_level: recommended
3237
- ref: network.peer.port
3338
requirement_level:
3439
recommended: If `network.peer.address` is set.
@@ -40,13 +45,18 @@ groups:
4045
brief: 'Semantic Convention for RPC server spans'
4146
attributes:
4247
- ref: client.address
48+
requirement_level: recommended
4349
- ref: client.port
50+
requirement_level: recommended
4451
- ref: network.peer.address
52+
requirement_level: recommended
4553
- ref: network.peer.port
4654
requirement_level:
4755
recommended: If `network.peer.address` is set.
4856
- ref: network.transport
57+
requirement_level: recommended
4958
- ref: network.type
59+
requirement_level: recommended
5060

5161
- id: rpc.grpc
5262
type: span
@@ -75,12 +85,14 @@ groups:
7585
conditionally_required: If other than the default version (`1.0`)
7686
- ref: rpc.jsonrpc.request_id
7787
tag: jsonrpc-tech-specific
88+
requirement_level: recommended
7889
- ref: rpc.jsonrpc.error_code
7990
tag: jsonrpc-tech-specific
8091
requirement_level:
8192
conditionally_required: If response is not successful.
8293
- ref: rpc.jsonrpc.error_message
8394
tag: jsonrpc-tech-specific
95+
requirement_level: recommended
8496
- ref: rpc.method
8597
tag: jsonrpc-tech-specific
8698
requirement_level: required
@@ -89,34 +101,18 @@ groups:
89101
RPC conventions for more information.
90102
91103
- id: rpc.message
92-
prefix: "message" # TODO: Change the prefix to rpc.message?
104+
prefix: rpc.message
93105
type: event
94106
brief: "RPC received/sent message."
95107
attributes:
96-
- id: type
97-
type:
98-
members:
99-
- id: sent
100-
value: "SENT"
101-
stability: experimental
102-
- id: received
103-
value: "RECEIVED"
104-
stability: experimental
105-
stability: experimental
106-
brief: "Whether this is a received or sent message."
107-
- id: id
108-
type: int
109-
stability: experimental
110-
brief: "MUST be calculated as two different counters starting from `1` one for sent messages and one for received message."
111-
note: "This way we guarantee that the values will be consistent between different implementations."
112-
- id: compressed_size
113-
type: int
114-
stability: experimental
115-
brief: "Compressed size of the message in bytes."
116-
- id: uncompressed_size
117-
type: int
118-
stability: experimental
119-
brief: "Uncompressed size of the message in bytes."
108+
- ref: rpc.message.type
109+
requirement_level: recommended
110+
- ref: rpc.message.id
111+
requirement_level: recommended
112+
- ref: rpc.message.compressed_size
113+
requirement_level: recommended
114+
- ref: rpc.message.uncompressed_size
115+
requirement_level: recommended
120116

121117
- id: rpc.connect_rpc
122118
type: span

schema-next.yaml

+9
Original file line numberDiff line numberDiff line change
@@ -56,6 +56,15 @@ versions:
5656
type: process.paging.fault_type
5757
apply_to_metrics:
5858
- process.paging.faults
59+
all:
60+
changes:
61+
# https://github.com/open-telemetry/semantic-conventions/pull/854
62+
- rename_attributes:
63+
attribute_map:
64+
message.type: rpc.message.type
65+
message.id: rpc.message.id
66+
message.compressed_size: rpc.message.compressed_size
67+
message.uncompressed_size: rpc.message.uncompressed_size
5968

6069
1.24.0:
6170
metrics:

0 commit comments

Comments
 (0)