Skip to content

Add ExtendedLogRecordBuilder#setException #7182

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 5 commits into from
Apr 11, 2025

Conversation

jack-berg
Copy link
Member

@jack-berg jack-berg commented Mar 6, 2025

See comment

  • Add LogRecordBuilder#setException - All log appenders have code like this to translate an exception to equivalent exception.*. Standardizing in the SDK "DRY"s up the instrumentation code, and provides a more familiar log API experience.
  • Make exception.* resolution configurable - exception.* attributes are now resolved and attached to both span events and log records. This is an edge cases where the SDK specification has a dependency on the semantic conventions. It seems appropriate to make this a configurable extension point, so that users can customize things like the exception.stacktrace resolution. see comment

@jack-berg jack-berg requested a review from a team as a code owner March 6, 2025 18:44
Copy link

codecov bot commented Mar 6, 2025

Codecov Report

Attention: Patch coverage is 82.14286% with 5 lines in your changes missing coverage. Please review.

Project coverage is 89.97%. Comparing base (d7fb208) to head (7f06c87).
Report is 1 commits behind head on main.

Files with missing lines Patch % Lines
...a/io/opentelemetry/sdk/internal/AttributeUtil.java 89.47% 0 Missing and 2 partials ⚠️
...io/opentelemetry/sdk/logs/SdkLogRecordBuilder.java 50.00% 1 Missing and 1 partial ⚠️
...etry/api/incubator/logs/ExtendedDefaultLogger.java 0.00% 1 Missing ⚠️
Additional details and impacted files
@@             Coverage Diff              @@
##               main    #7182      +/-   ##
============================================
- Coverage     89.98%   89.97%   -0.02%     
- Complexity     6685     6689       +4     
============================================
  Files           749      749              
  Lines         20191    20200       +9     
  Branches       1977     1977              
============================================
+ Hits          18168    18174       +6     
- Misses         1431     1433       +2     
- Partials        592      593       +1     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@jack-berg
Copy link
Member Author

Per conversation in the 4/10/25 java SIG, I've broken out the configurable exception.* attribute value resolution into a separate PR, #7266.

@trask trask changed the title Add ExtendedLogRecordBuilder#setException, make exception.* resolution configurable Add ExtendedLogRecordBuilder#setException Apr 10, 2025
@jack-berg jack-berg merged commit 4e243f2 into open-telemetry:main Apr 11, 2025
28 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants