semantic-conventions icon indicating copy to clipboard operation
semantic-conventions copied to clipboard

Deprecate per-rpc status code attributes in favor of `rpc.response.status_code`

Open lmolkova opened this issue 1 month ago • 11 comments

Fixes #1504

Some of the RPC frameworks generate status code on client side when response cannot be received. This includes :

  • gRPC: https://grpc.io/docs/what-is-grpc/core-concepts/#rpc-termination

    In gRPC, both the client and server make independent and local determinations of the success of the call, and their conclusions may not match. This means that, for example, you could have an RPC that finishes successfully on the server side (“I have sent all my responses!”) but fails on the client side (“The responses arrived after my deadline!”)

    https://grpc.io/docs/guides/status-codes/

    When an error situation occurs, the gRPC library may produce a corresponding status. The library may do this either on the client- or the server-side.

  • Connect RPC. Similar to gRPC - client returns error/throws exception when any error happens and may generate deadline_exceeded / cancelled / unknown / unavailable errors

    https://github.com/connectrpc/connect-go/blob/5398e9930ae8e7c06b500f4a0b8ed46c82192d5e/error.go#L274-L278

    Even invalid URL is reported with code unavailable - https://github.com/connectrpc/connect-go/blob/5398e9930ae8e7c06b500f4a0b8ed46c82192d5e/client.go#L391

  • Apache Dubbo. Similar - pretty much everything (network, timeouts, serialization errors) is wrapped into RpcException with code defaulting to unknown https://github.com/apache/dubbo/blob/0d8c15adea9061aac1296ce5077384ad8e7b947b/dubbo-rpc/dubbo-rpc-api/src/main/java/org/apache/dubbo/rpc/protocol/AbstractInvoker.java#L280-L335

Even though status code could be generated by the client, we're using rpc.response.status_code to stay consistent with existing conventions. Given we're focusing on logical layer, response essentially means response on the API level and includes response codes assigned on the client.

This PR

  • introduces common rpc.response.status_code attribute
  • deprecates rpc.connect_rpc.error_code, rpc.grpc.status_code, rpc.jsonrpc.error_code
  • adds recommendation on reporting span status based on rpc.response.status_code value

lmolkova avatar Oct 15 '25 22:10 lmolkova