GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — Add ExtendedLogRecordBuilder#setException by jack-berg · Pull Request #7182 · open-telemetry/opentelemetry-java

Conversation

@jack-berg

@jack-berg jack-berg commented Mar 6, 2025 •
edited
Loading

Uh oh!

There was an error while loading. Please reload this page.

Copy link
Copy Markdown
Member

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

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
@jack-berg
Add ExtendedLogRecordBuilder#setException, make exception.* resolutio…
9f2ecde
…n configurable
@jack-berg
jack-berg requested a review from a team as a code owner March 6, 2025 18:44
@codecov

codecov Bot commented Mar 6, 2025 •
edited
Loading

Uh oh!

There was an error while loading. Please reload this page.

Copy link
Copy Markdown

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.
All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

jack-berg added 3 commits March 6, 2025 13:32
@jack-berg
Use System.lineSeparator() instead of \n to fix build
1b0a28e
@jack-berg
Merge branch 'main' of https://github.com/open-telemetry/opentelemetr…
7a62f68
…y-java into logbuilder-set-exception
@jack-berg
Remove custom exception resolver
a11ac5b
@jack-berg jack-berg mentioned this pull request Apr 10, 2025
Configurable exception.* attribute resolution #7266
Merged
trask
trask approved these changes Apr 10, 2025
View reviewed changes
Comment thread buildSrc/src/main/kotlin/otel.java-conventions.gradle.kts Resolved

Uh oh!

There was an error while loading. Please reload this page.

Comment thread sdk/trace/src/test/java/io/opentelemetry/sdk/trace/SdkSpanTest.java Resolved

Uh oh!

There was an error while loading. Please reload this page.

Comment thread sdk/logs/build.gradle.kts Resolved

Uh oh!

There was an error while loading. Please reload this page.

@jack-berg

jack-berg commented Apr 10, 2025

Copy link
Copy Markdown
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 reacted with heart emoji
All reactions
  • ❤️ 1 reaction

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@jack-berg
PR feedback
7f06c87
@trask trask changed the title Add ExtendedLogRecordBuilder#setException, make exception.* resolution configurable Add ExtendedLogRecordBuilder#setException Apr 10, 2025
@trask trask mentioned this pull request Apr 10, 2025
Lazily evaluate ExceptionEventData exception.* attributes #7172
Closed
jaydeluca
jaydeluca approved these changes Apr 11, 2025
View reviewed changes
@jack-berg
jack-berg merged commit 4e243f2 into open-telemetry:main Apr 11, 2025
@trask trask mentioned this pull request Jan 20, 2026
Add optional Exception parameter to Emit LogRecord open-telemetry/opentelemetry-specification#4824
Merged
github-merge-queue Bot pushed a commit to open-telemetry/opentelemetry-specification that referenced this pull request Jan 23, 2026
@trask @pellared
Add optional Exception parameter to Emit LogRecord (#4824)
e0a5864
Part of [OTEP
4430](https://github.com/open-telemetry/opentelemetry-specification/blob/main/oteps/4430-span-event-api-deprecation-plan.md).

This could be considered "just a convenience", but (in addition to a
very nice convenience) it also unlocks two additional features:
- Performance optimization since the SDK can take
`OTEL_ATTRIBUTE_VALUE_LENGTH_LIMIT` into consideration when generating
large `exception.stacktrace` attributes (a very real issue in the Java
world: open-telemetry/opentelemetry-java#7281)
- (Future) customization of exception stacktraces (we have experimental
support for this in Java, e.g. to support "smarter" truncation of long
`exception.stacktrace` attributes:
open-telemetry/opentelemetry-java#7266)

Prototype:
open-telemetry/opentelemetry-java#7182

---------

Co-authored-by: Robert Pająk <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Reviewers

@trask trask trask approved these changes
@jaydeluca jaydeluca jaydeluca approved these changes

Uh oh!

There was an error while loading. Please reload this page.

Assignees

No one assigned

Labels

None yet

Projects

None yet

Milestone

No milestone

Development

Successfully merging this pull request may close these issues.

Uh oh!

There was an error while loading. Please reload this page.

3 participants

@jack-berg @trask @jaydeluca
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.
You are visitor 01402775 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.