RPC

Remote Procedure Call (RPC) Attributes

This document defines attributes for remote procedure calls.

Attributes:

KeyStabilityValue TypeDescriptionExample Values
rpc.methodStablestringThe fully-qualified logical name of the method from the RPC interface perspective. [1]com.example.ExampleService/exampleMethod; EchoService/Echo; _OTHER
rpc.method_originalStablestringThe original name of the method used by the client.com.myservice.EchoService/catchAll; com.myservice.EchoService/unknownMethod; InvalidMethod
rpc.request.header.<key>Release Candidatestring[]RPC request headers or metadata, <key> being the normalized header name (lowercase), the value being the header values. [2]["1.2.3.4", "1.2.3.5"]
rpc.response.header.<key>Release Candidatestring[]RPC response headers or metadata sent before the response payload, <key> being the normalized header name (lowercase), the value being the header values. [3]["attribute_value"]
rpc.response.trailer.<key>Release Candidatestring[]RPC response trailers or metadata sent after the response payload, <key> being the normalized trailer name (lowercase), the value being the trailer values. [4]["attribute_value"]
rpc.status_codeStablestringStatus code of the RPC returned by the RPC server or generated by the client [5]OK; DEADLINE_EXCEEDED; -32602
rpc.system.nameStablestringThe Remote Procedure Call (RPC) system. [6]grpc; dubbo; connectrpc (see more)

[1] rpc.method: The method name MAY have unbounded cardinality in edge or error cases.

Some RPC frameworks or libraries provide a fixed set of recognized methods for client stubs and server implementations. Instrumentations for such frameworks MUST set this attribute to the original method name only when the method is recognized by the framework or library.

When the method is not recognized, for example, when the server receives a request for a method that is not predefined on the server, or when instrumentation is not able to reliably detect if the method is predefined, the attribute MUST be set to _OTHER.

If the RPC instrumentation could end up converting valid RPC methods to _OTHER, then it SHOULD provide a way to configure the list of recognized RPC methods.

The rpc.method can be different from the name of any implementing method/function. The code.function.name attribute may be used to record the fully-qualified method actually executing the call on the server side, or the RPC client stub method on the client side.

[2] rpc.request.header.<key>: Instrumentations SHOULD require an explicit configuration of which headers are to be captured. Including all request headers can be a security risk - explicit configuration helps avoid leaking sensitive information.

For example, a header my-custom-key with value ["1.2.3.4", "1.2.3.5"] SHOULD be recorded as the rpc.request.header.my-custom-key attribute with value ["1.2.3.4", "1.2.3.5"]

The attribute value MUST consist of either multiple header values as an array of strings or a single-item array containing a possibly comma-concatenated string, depending on the way the RPC library provides access to headers.

Values that the RPC system exposes as binary data, or that are otherwise not valid UTF-8 strings, SHOULD be base64-encoded when recorded.

[3] rpc.response.header.<key>: Instrumentations SHOULD require an explicit configuration of which headers are to be captured. Including all response headers can be a security risk - explicit configuration helps avoid leaking sensitive information.

For example, a header my-custom-key with value ["attribute_value"] SHOULD be recorded as the rpc.response.header.my-custom-key attribute with value ["attribute_value"]

The attribute value MUST consist of either multiple header values as an array of strings or a single-item array containing a possibly comma-concatenated string, depending on the way the RPC library provides access to headers.

Values that the RPC system exposes as binary data, or that are otherwise not valid UTF-8 strings, SHOULD be base64-encoded when recorded.

[4] rpc.response.trailer.<key>: Instrumentations SHOULD require an explicit configuration of which trailers are to be captured. Including all response trailers can be a security risk - explicit configuration helps avoid leaking sensitive information.

For example, a trailer my-custom-key with value ["attribute_value"] SHOULD be recorded as the rpc.response.trailer.my-custom-key attribute with value ["attribute_value"]

The attribute value MUST consist of either multiple trailer values as an array of strings or a single-item array containing a possibly comma-concatenated string, depending on the way the RPC library provides access to trailers.

Values that the RPC system exposes as binary data, or that are otherwise not valid UTF-8 strings, SHOULD be base64-encoded when recorded.

[5] rpc.status_code: Usually it represents an error code, but may also represent partial success, warning, or differentiate between various types of successful outcomes. The value MAY use a standardized string representation of a numeric status code, if one exists, instead of the numeric code. The value MAY be a synthetic status provided by the client library rather than returned by the remote service. Semantic conventions for individual RPC frameworks SHOULD document what rpc.status_code means in the context of that system and which values are considered to represent errors.

[6] rpc.system.name: The client and server RPC systems may differ for the same RPC interaction. For example, a client may use Apache Dubbo or Connect RPC to communicate with a server that uses gRPC since both protocols provide compatibility with gRPC.


rpc.system.name 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.

ValueDescriptionStability
connectrpcConnect RPCDevelopment
dubboApache DubboStable
grpcgRPCStable
jsonrpcJSON-RPCDevelopment

Deprecated RPC Attributes

Deprecated rpc message attributes.

Attributes:

KeyStabilityValue TypeDescriptionExample Values
message.compressed_sizeDeprecated
Deprecated, no replacement at this time.
intDeprecated, no replacement at this time.
message.idDeprecated
Deprecated, no replacement at this time.
intDeprecated, no replacement at this time.
message.typeDeprecated
Deprecated, no replacement at this time.
stringDeprecated, no replacement at this time.SENT; RECEIVED (see more)
message.uncompressed_sizeDeprecated
Deprecated, no replacement at this time.
intDeprecated, no replacement at this time.
rpc.connect_rpc.error_codeDeprecated
Replaced by rpc.status_code.
stringDeprecated, use rpc.status_code attribute instead.cancelled; unknown; invalid_argument (see more)
rpc.connect_rpc.request.metadata.<key>Deprecated
Replaced by rpc.request.header.
string[]Deprecated, use rpc.request.header instead.["1.2.3.4", "1.2.3.5"]
rpc.connect_rpc.response.metadata.<key>Deprecated
Split to rpc.response.header for metadata sent before the response payload and rpc.response.trailer for metadata sent after it.
string[]Deprecated, use rpc.response.header and rpc.response.trailer.["attribute_value"]
rpc.grpc.request.metadata.<key>Deprecated
Replaced by rpc.request.header.
string[]Deprecated, use rpc.request.header instead.["1.2.3.4", "1.2.3.5"]
rpc.grpc.response.metadata.<key>Deprecated
Split to rpc.response.header for metadata sent before the response payload and rpc.response.trailer for metadata sent after it.
string[]Deprecated, use rpc.response.header and rpc.response.trailer.["attribute_value"]
rpc.grpc.status_codeDeprecated
Use string representation of the gRPC status code on the rpc.status_code attribute.
intDeprecated, use string representation on the rpc.status_code attribute instead.0; 1; 2 (see more)
rpc.jsonrpc.error_codeDeprecated
Use string representation of the error code on the rpc.status_code attribute.
intDeprecated, use string representation on the rpc.status_code attribute instead.-32700; 100
rpc.jsonrpc.error_messageDeprecated
Use the span status description when reporting JSON-RPC spans.
stringDeprecated, use the span status description when reporting JSON-RPC spans.Parse error; User already exists
rpc.jsonrpc.request_idDeprecated
Replaced by jsonrpc.request.id.
stringDeprecated, use jsonrpc.request.id instead.10; request-7; ``
rpc.jsonrpc.versionDeprecated
Replaced by jsonrpc.protocol.version.
stringDeprecated, use jsonrpc.protocol.version instead.2.0; 1.0
rpc.message.compressed_sizeDeprecated
Deprecated, no replacement at this time.
intCompressed size of the message in bytes.
rpc.message.idDeprecated
Deprecated, no replacement at this time.
intMUST be calculated as two different counters starting from 1 one for sent messages and one for received message. [7]
rpc.message.typeDeprecated
Deprecated, no replacement at this time.
stringWhether this is a received or sent message.SENT; RECEIVED (see more)
rpc.message.uncompressed_sizeDeprecated
Deprecated, no replacement at this time.
intUncompressed size of the message in bytes.
rpc.request.metadata.<key>Deprecated
Replaced by rpc.request.header.
string[]Deprecated, use rpc.request.header instead.["1.2.3.4", "1.2.3.5"]
rpc.response.metadata.<key>Deprecated
Split to rpc.response.header for metadata sent before the response payload and rpc.response.trailer for metadata sent after it.
string[]Deprecated, use rpc.response.header and rpc.response.trailer.["attribute_value"]
rpc.response.status_codeDeprecated
Replaced by rpc.status_code.
stringDeprecated, use rpc.status_code instead.OK; DEADLINE_EXCEEDED; -32602
rpc.serviceDeprecated
Value should be included in rpc.method which is expected to be a fully-qualified name.
stringDeprecated, use fully-qualified rpc.method instead.myservice.EchoService
rpc.systemDeprecated
Replaced by rpc.system.name.
stringDeprecated, use rpc.system.name attribute instead.grpc; java_rmi; dotnet_wcf (see more)

[7] rpc.message.id: This way we guarantee that the values will be consistent between different implementations.


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.

ValueDescriptionStability
RECEIVEDreceivedDevelopment
SENTsentDevelopment

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.

ValueDescriptionStability
abortedabortedDevelopment
already_existsalready_existsDevelopment
cancelledcancelledDevelopment
data_lossdata_lossDevelopment
deadline_exceededdeadline_exceededDevelopment
failed_preconditionfailed_preconditionDevelopment
internalinternalDevelopment
invalid_argumentinvalid_argumentDevelopment
not_foundnot_foundDevelopment
out_of_rangeout_of_rangeDevelopment
permission_deniedpermission_deniedDevelopment
resource_exhaustedresource_exhaustedDevelopment
unauthenticatedunauthenticatedDevelopment
unavailableunavailableDevelopment
unimplementedunimplementedDevelopment
unknownunknownDevelopment

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.

ValueDescriptionStability
0OKDevelopment
1CANCELLEDDevelopment
2UNKNOWNDevelopment
3INVALID_ARGUMENTDevelopment
4DEADLINE_EXCEEDEDDevelopment
5NOT_FOUNDDevelopment
6ALREADY_EXISTSDevelopment
7PERMISSION_DENIEDDevelopment
8RESOURCE_EXHAUSTEDDevelopment
9FAILED_PRECONDITIONDevelopment
10ABORTEDDevelopment
11OUT_OF_RANGEDevelopment
12UNIMPLEMENTEDDevelopment
13INTERNALDevelopment
14UNAVAILABLEDevelopment
15DATA_LOSSDevelopment
16UNAUTHENTICATEDDevelopment

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.

ValueDescriptionStability
RECEIVEDreceivedDevelopment
SENTsentDevelopment

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.

ValueDescriptionStability
apache_dubboApache DubboDevelopment
connect_rpcConnect RPCDevelopment
dotnet_wcf.NET WCFDevelopment
grpcgRPCDevelopment
java_rmiJava RMIDevelopment
jsonrpcJSON-RPCDevelopment
onc_rpcONC RPC (Sun RPC)Development