Skip to content

Conversation

@lmolkova
Copy link
Member

@lmolkova lmolkova commented Oct 15, 2025

Fixes #1504

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

Since status code may be generated by the client, we're not including response in the status_code.

This PR

  • introduces common rpc.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.status_code value

@lmolkova lmolkova moved this from Untriaged to Awaiting codeowners approval in Semantic Conventions Triage Oct 15, 2025
@lmolkova lmolkova marked this pull request as ready for review October 15, 2025 22:49
@lmolkova lmolkova requested review from a team as code owners October 15, 2025 22:49
@trask
Copy link
Member

trask commented Oct 16, 2025

Some of the RPC frameworks generate status code on client side when response cannot be received. This includes gRPC, Connect RPC and Apache Dubbo. So not including response in the status_code

Can you include a couple examples of this in the PR description? Thanks

@lmolkova
Copy link
Member Author

Can you include a couple examples of this in the PR description? Thanks

@trask sure, updated description with links

**Span status** Refer to the [Recording Errors](/docs/general/recording-errors.md)
document for details on how to record span status. When error response is returned and
it contains [`message`](https://connectrpc.com/docs/web/errors/#error-messages),
the raw error message SHOULD be recorded as the span status description.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I removed the part about error message and created #2967 which is a blocker for RPC stability

@thompson-tomo
Copy link
Contributor

For me I see grpc as warranting it's own attribute to increase interoperability with the grpc metrics & also allow the rpc.status_code to be set by the framework ie Dubbo. Deprecating the other 2 makes sense.

@github-actions
Copy link

This PR contains changes to area(s) that do not have an active SIG/project and will be auto-closed:

  • otel

Such changes may be rejected or put on hold until a new SIG/project is established.

Please refer to the Semantic Convention Areas
document to see the current active SIGs and also to learn how to kick start a new one.

@lmolkova
Copy link
Member Author

For me I see grpc as warranting it's own attribute to increase interoperability with the grpc metrics

could you elaborate? How would having rpc.status_code and grpc.status_code would help with grpc metrics interoperability?

also allow the rpc.status_code to be set by the framework ie Dubbo. Deprecating the other 2 makes sense.

Looking into Dubbo, it juggles with 3 different sets of error codes (Dubbo, Triple, and HTTP). If it makes sense to report both protocol (grpc / HTTP) and framework (dubbo), I'd assume we'd have dubbo-specific attribute for it instead of making it gRPC responsibility.

@lmolkova lmolkova reopened this Oct 22, 2025
@github-actions
Copy link

This PR contains changes to area(s) that do not have an active SIG/project and will be auto-closed:

  • otel

Such changes may be rejected or put on hold until a new SIG/project is established.

Please refer to the Semantic Convention Areas
document to see the current active SIGs and also to learn how to kick start a new one.

@thompson-tomo
Copy link
Contributor

The grpc.status attribute is an established attribute used by the grpc metrics hence it would decrease the gap between the specs.

Having network request status seperate provides clear indication that the network has been used and it would enable the framework to have a different status to the network. That is important when the framework supports/uses client side caching.

In relation to the examples in the description should we not be using error/exception to capture the details of the status and only setting the rpc.status_code when it is being returned from the server.

Also note grpc doesn't define cancelled as an error but the note on the new attribute indicates everything but ok is an error.

@lmolkova
Copy link
Member Author

lmolkova commented Oct 25, 2025

The grpc.status attribute is an established attribute used by the grpc metrics hence it would decrease the gap between the specs.

Targeting compatibility with current gRPC metrics would involve way more than grpc.status attribute. Having one attribute with the same name would not help with compatibility if metric names and everything else is different.

Having network request status seperate provides clear indication that the network has been used and it would enable the framework to have a different status to the network. That is important when the framework supports/uses client side caching.

Framework (when there is a framework and it needs separate status code) should then provide that extra status code attribute. Why have discrepancy on the protocol level?

In relation to the examples in the description should we not be using error/exception to capture the details of the status and only setting the rpc.status_code when it is being returned from the server.

could you please add a suggestions on the specific lines so we can have focused discussion and I can understand the context of your comments?

Also note grpc doesn't define cancelled as an error but the note on the new attribute indicates everything but ok is an error.

Same here, in the future, please leave comment on specific lines so it's easier to understand what you mean.
Substantially: I broke down the table we already have here https://github.com/open-telemetry/semantic-conventions/blob/main/docs/rpc/grpc.md#grpc-status into notes on rpc.status_code without changing the behavior. I agree cancelled status being error is the issue and we're going to address it in #560 which is blocking for RPC stability.

@lmolkova lmolkova moved this from Done to In Progress in RPC Semantic Conventions Stability Oct 29, 2025
@lmolkova
Copy link
Member Author

SIG discussion:

  • generic error.type mentions gRPC status code - let's generalize it
  • let's refine error.type on RPC conventions to explain what to do wrt status code

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

Archived in project

Development

Successfully merging this pull request may close these issues.

Rename rpc.grpc.status_code to grpc.response.status_code

4 participants