instrumentation: update error handling to set attributes instead of recording errors by pellared · Pull Request #8386 · open-telemetry/opentelemetry-go-contrib (original) (raw)
changed the title
feat(instrumentation): update error handling to set attributes instead of recording errors instrumentation: update error handling to set attributes instead of recording errors
pellared marked this pull request as ready for review
Eshaan-byte added a commit to Eshaan-byte/opentelemetry-go-contrib that referenced this pull request
… errors
Fixes open-telemetry#8441
This change updates the error handling in otelgin middleware to follow the instrumentation guidelines established in open-telemetry#8386:
- Replace span.RecordError() calls with span.SetAttributes(ErrorType())
- Set error.type attribute for the first error when c.Errors is not empty
- Multiple errors are still captured in the status description via c.Errors.String()
- Update tests to verify error.type attribute instead of span events
This provides better consistency across OpenTelemetry instrumentation packages and follows the semantic conventions for error handling.
Eshaan-byte added a commit to Eshaan-byte/opentelemetry-go-contrib that referenced this pull request
… errors
Fixes open-telemetry#8441
This change updates the error handling in otelgin middleware to follow the instrumentation guidelines established in open-telemetry#8386:
- Replace span.RecordError() calls with span.SetAttributes(ErrorType())
- Set error.type attribute for the first error when c.Errors is not empty
- Multiple errors are still captured in the status description via c.Errors.String()
- Update tests to verify error.type attribute instead of span events
This provides better consistency across OpenTelemetry instrumentation packages and follows the semantic conventions for error handling.
Eshaan-byte added a commit to Eshaan-byte/opentelemetry-go-contrib that referenced this pull request
… errors
Fixes open-telemetry#8441
This change updates the error handling in otelgin middleware to follow the instrumentation guidelines established in open-telemetry#8386:
- Replace span.RecordError() calls with span.SetAttributes(ErrorType())
- Set error.type attribute for the first error when c.Errors is not empty
- Multiple errors are still captured in the status description via c.Errors.String()
- Update tests to verify error.type attribute instead of span events
This provides better consistency across OpenTelemetry instrumentation packages and follows the semantic conventions for error handling.
This was referenced
Apr 27, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.Learn more about bidirectional Unicode characters
[ Show hidden characters]({{ revealButtonHref }})