instrumentation: update error handling to set attributes instead of recording errors#8386
Merged
pellared merged 8 commits intoopen-telemetry:mainfrom Jan 13, 2026
Merged
Conversation
…d of recording errors
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #8386 +/- ##
=====================================
Coverage 82.3% 82.3%
=====================================
Files 181 181
Lines 13762 13699 -63
=====================================
- Hits 11327 11278 -49
+ Misses 2030 2023 -7
+ Partials 405 398 -7
🚀 New features to boost your workflow:
|
flc1125
approved these changes
Jan 13, 2026
flc1125
approved these changes
Jan 13, 2026
dmathieu
approved these changes
Jan 13, 2026
Member
Author
|
It would be nice to have a linter which not allows calling |
dashpole
approved these changes
Jan 13, 2026
Eshaan-byte
added a commit
to Eshaan-byte/opentelemetry-go-contrib
that referenced
this pull request
Jan 22, 2026
… 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
Jan 22, 2026
… 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
Jan 28, 2026
… 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 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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes #7470
Fixes #7254
Related semconv PR: open-telemetry/semantic-conventions#3256
Related spec PR: open-telemetry/opentelemetry-specification#4825