Semantic conventions for RPC events
Status: Development
This document defines events applicable in the context of remote procedure calls.
Existing RPC instrumentations that are using v1.37.0 of this document (or prior):
- SHOULD NOT change the version of the RPC conventions that they emit by default in their existing major version. Conventions include (but are not limited to) attributes, metric and span names, and unit of measure.
- SHOULD introduce an environment variable
OTEL_SEMCONV_STABILITY_OPT_INin their existing major version as a comma-separated list of category-specific values (e.g., http, databases, rpc). The list of values includes:rpc- emit the stable RPC conventions, and stop emitting the experimental RPC conventions that the instrumentation emitted previously.rpc/dup- emit both the experimental and stable RPC conventions, allowing for a phased rollout of the stable semantic conventions.- The default behavior (in the absence of one of these values) is to continue emitting whatever version of the old experimental RPC conventions the instrumentation was emitting previously.
- Note:
rpc/duphas higher precedence thanrpcin case both values are present
- SHOULD maintain (security patching at a minimum) their existing major version for at least six months after it starts emitting both sets of conventions.
- MAY drop the environment variable in their next major version and emit only the stable RPC conventions.
Message event
Status:
The event name MUST be rpc.message.
Describes a message sent or received within the context of an RPC call.
In the lifetime of an RPC stream, an event for each message sent/received on client and server spans SHOULD be created. In case of unary calls message events SHOULD NOT be recorded.
Attributes:
| Key | Stability | Requirement Level | Value Type | Description | Example Values |
|---|---|---|---|---|---|
rpc.message.compressed_size | Recommended | int | Compressed size of the message in bytes. | ||
rpc.message.id | Recommended | int | MUST be calculated as two different counters starting from 1 one for sent messages and one for received message. [1] | ||
rpc.message.type | Recommended | string | Whether this is a received or sent message. | SENT; RECEIVED | |
rpc.message.uncompressed_size | Recommended | int | Uncompressed size of the message in bytes. |
[1] rpc.message.id: This way we guarantee that the values will be consistent between different implementations.
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.
| Value | Description | Stability |
|---|---|---|
RECEIVED | received | |
SENT | sent |
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!