impl(o11y): record error.type attribute on LRO span#5895
Conversation
There was a problem hiding this comment.
Code Review
This pull request introduces the error.type attribute to tracing spans when recording errors in the LRO module, and refactors several test assertions to use contains_key instead of checking if get returns None. Feedback on the changes suggests providing a fallback value (such as "generic") for error.type when no specific gRPC status code is available, ensuring compliance with OpenTelemetry semantic conventions for error spans.
d2f00bc to
8911bc6
Compare
| pub fn record_error(&self, err: &crate::Error) { | ||
| self.span.record("otel.status_code", "ERROR"); | ||
| self.span.record("otel.status_description", err.to_string()); | ||
| if let Some(status) = err.status() { |
There was a problem hiding this comment.
Can we use
without too much modification?There was a problem hiding this comment.
i'd have to modify gaxi to expose ErrorType
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #5895 +/- ##
=======================================
Coverage 97.90% 97.90%
=======================================
Files 233 233
Lines 59211 59211
=======================================
Hits 57968 57968
Misses 1243 1243 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
8911bc6 to
aed4044
Compare
aed4044 to
2e9cec5
Compare
error.type attribute on LRO Wait spanerror.type attribute on LRO span
2e9cec5 to
f2554de
Compare
dbolduc
left a comment
There was a problem hiding this comment.
I am fine with exposing something from gaxi, but in a vacuum, I would minimize the surface.
Will any other layer need to know what is a strongly-typed ErrorType? Or do they just need to know how to encode it as an attribute?
…ommon feature (#5908) Refactor `gaxi` errors tracing observability module to minimize the public API surface and optimize feature gating for downstream usage. This is a prerequisite for adding `error.type` span attributes recording to the LRO span (#5895), ensuring `google-cloud-lro` can fetch error tracing categories without bloating its dependency footprint.
f2554de to
954c44e
Compare
Add
error.typeattribute to the LRO (T2) span and populate it from the status code if the long-running operation fails with a status code. This allows observability tools to track error rates by error type for long-running operations.This lack of T2 error type recording is surfaced in the
error.typeassertions requested for LRO tracing integration tests (#5886).