RPC

Remote Procedure Call (RPC) Attributes

This document defines attributes for remote procedure calls.

Attributes:

KeyStabilityValue TypeDescriptionExample Values
rpc.methodRelease CandidatestringThe fully-qualified logical name of the method from the RPC interface perspective. [1]com.example.ExampleService/exampleMethod; EchoService/Echo; _OTHER
rpc.method_originalRelease CandidatestringThe original name of the method used by the client.com.myservice.EchoService/catchAll; com.myservice.EchoService/unknownMethod; InvalidMethod
rpc.request.metadata.<key>Developmentstring[]RPC request metadata, <key> being the normalized RPC metadata key (lowercase), the value being the metadata values. [2]["1.2.3.4", "1.2.3.5"]
rpc.response.metadata.<key>Developmentstring[]RPC response metadata, <key> being the normalized RPC metadata key (lowercase), the value being the metadata values. [3]["attribute_value"]
rpc.response.status_codeRelease CandidatestringStatus code of the RPC returned by the RPC server or generated by the client [4]OK; DEADLINE_EXCEEDED; -32602
rpc.system.nameRelease CandidatestringThe Remote Procedure Call (RPC) system. [5]grpc; dubbo; connectrpc

[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. In such cases, tracing instrumentations MUST also set rpc.method_original attribute to the original method value.

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.metadata.<key>: 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.

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

[3] rpc.response.metadata.<key>: 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.

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

[4] rpc.response.status_code: Usually it represents an error code, but may also represent partial success, warning, or differentiate between various types of successful outcomes. Semantic conventions for individual RPC frameworks SHOULD document what rpc.response.status_code means in the context of that system and which values are considered to represent errors.

[5] 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 DubboRelease Candidate
grpcgRPCRelease Candidate
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
message.uncompressed_sizeDeprecated
Deprecated, no replacement at this time.
intDeprecated, no replacement at this time.
rpc.connect_rpc.error_codeDeprecated
Replaced by rpc.response.status_code.
stringDeprecated, use rpc.response.status_code attribute instead.cancelled; unknown; invalid_argument
rpc.connect_rpc.request.metadata.<key>Deprecated
Replaced by rpc.request.metadata.
string[]Deprecated, use rpc.request.metadata instead.["1.2.3.4", "1.2.3.5"]
rpc.connect_rpc.response.metadata.<key>Deprecated
Replaced by rpc.response.metadata.
string[]Deprecated, use rpc.response.metadata instead.["attribute_value"]
rpc.grpc.request.metadata.<key>Deprecated
Replaced by rpc.request.metadata.
string[]Deprecated, use rpc.request.metadata instead.["1.2.3.4", "1.2.3.5"]
rpc.grpc.response.metadata.<key>Deprecated
Replaced by rpc.response.metadata.
string[]Deprecated, use rpc.response.metadata instead.["attribute_value"]
rpc.grpc.status_codeDeprecated
Use string representation of the gRPC status code on the rpc.response.status_code attribute.
intDeprecated, use string representation on the rpc.response.status_code attribute instead.0; 1; 2
rpc.jsonrpc.error_codeDeprecated
Use string representation of the error code on the rpc.response.status_code attribute.
intDeprecated, use string representation on the rpc.response.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. [6]
rpc.message.typeDeprecated
Deprecated, no replacement at this time.
stringWhether this is a received or sent message.SENT; RECEIVED
rpc.message.uncompressed_sizeDeprecated
Deprecated, no replacement at this time.
intUncompressed size of the message in bytes.
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

[6] 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