RPC

Remote Procedure Call (RPC) Attributes

This document defines attributes for remote procedure calls.

Attributes:

KeyStabilityValue TypeDescriptionExample Values
rpc.message.compressed_sizeDevelopmentintCompressed size of the message in bytes.
rpc.message.idDevelopmentintMUST be calculated as two different counters starting from 1 one for sent messages and one for received message. [1]
rpc.message.typeDevelopmentstringWhether this is a received or sent message.SENT; RECEIVED
rpc.message.uncompressed_sizeDevelopmentintUncompressed size of the message in bytes.
rpc.methodDevelopmentstringThe fully-qualified logical name of the method from the RPC interface perspective. [2]com.example.ExampleService/exampleMethod; EchoService/Echo; _OTHER
rpc.method_originalDevelopmentstringThe 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. [3]["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. [4]["attribute_value"]
rpc.response.status_codeDevelopmentstringStatus code of the RPC returned by the RPC server or generated by the client [5]OK; DEADLINE_EXCEEDED; -32602
rpc.system.nameDevelopmentstringThe Remote Procedure Call (RPC) system. [6]grpc; dubbo; connectrpc

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

[2] 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.

[3] 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"]

[4] 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"]

[5] 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.

[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.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.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 DubboDevelopment
grpcgRPCDevelopment
jsonrpcJSON-RPCDevelopment

Deprecated RPC Attributes

Deprecated rpc message attributes.

Attributes:

KeyStabilityValue TypeDescriptionExample Values
message.compressed_sizeDeprecated
Replaced by rpc.message.compressed_size.
intDeprecated, use rpc.message.compressed_size instead.
message.idDeprecated
Replaced by rpc.message.id.
intDeprecated, use rpc.message.id instead.
message.typeDeprecated
Replaced by rpc.message.type.
stringDeprecated, use rpc.message.type instead.SENT; RECEIVED
message.uncompressed_sizeDeprecated
Replaced by rpc.message.uncompressed_size.
intDeprecated, use rpc.message.uncompressed_size instead.
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 or error.message attribute on other signals.
stringDeprecated, use span status description or error.message attribute on other signals.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.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

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.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