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 — Adds option to SpanLimits to exclude exception.stacktrace attribute by HaloFour · Pull Request #7133 · open-telemetry/opentelemetry-java

Conversation

@HaloFour

@HaloFour HaloFour commented Feb 21, 2025 •
edited
Loading

Uh oh!

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

Copy link
Copy Markdown
Contributor

Adds an option on SpanLimits which specifies that the exception.stacktrace attribute should not be emitted on exception events recorded to a span.

SpanLimits might not the right place to put this, but I wanted to get something out there for the purposes of discussion.

Sorry, something went wrong.

Uh oh!

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

All reactions
@HaloFour
Adds option to SpanLimits to exclude exception.stacktrace attribute
d26d35a
@codecov

codecov Bot commented Feb 21, 2025 •
edited
Loading

Uh oh!

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

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 91.66667% with 1 line in your changes missing coverage. Please review.
✅ Project coverage is 89.86%. Comparing base (56941a5) to head (a3fd455).
⚠️ Report is 541 commits behind head on main.

Files with missing lines Patch % Lines
...in/java/io/opentelemetry/sdk/trace/SpanLimits.java 66.66% 1 Missing ⚠️
Additional details and impacted files
@@             Coverage Diff              @@
##               main    #7133      +/-   ##
============================================
+ Coverage     89.85%   89.86%   +0.01%     
- Complexity     6610     6614       +4     
============================================
  Files           740      740              
  Lines         19986    19993       +7     
  Branches       1964     1965       +1     
============================================
+ Hits          17958    17967       +9     
  Misses         1439     1439              
+ Partials        589      587       -2     

☔ 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.

@HaloFour
add tests
a3fd455
trask
trask reviewed Feb 22, 2025
View reviewed changes
Comment thread docs/apidiffs/current_vs_latest/opentelemetry-sdk-trace.txt
Comment on lines +2 to +7
*** MODIFIED CLASS: PUBLIC ABSTRACT io.opentelemetry.sdk.trace.SpanLimits (not serializable)
=== CLASS FILE FORMAT VERSION: 52.0 <- 52.0
+++ NEW METHOD: PUBLIC(+) boolean isExcludeExceptionStackTrace()
*** MODIFIED CLASS: PUBLIC FINAL io.opentelemetry.sdk.trace.SpanLimitsBuilder (not serializable)
=== CLASS FILE FORMAT VERSION: 52.0 <- 52.0
+++ NEW METHOD: PUBLIC(+) io.opentelemetry.sdk.trace.SpanLimitsBuilder setExcludeExceptionStackTrace(boolean)

@trask trask Feb 22, 2025

Copy link
Copy Markdown
Member

There was a problem hiding this comment.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

it may be worth considering the future direction proposed in open-telemetry/opentelemetry-specification#4333 before adding public API surface

Sorry, something went wrong.

Uh oh!

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

All reactions

@HaloFour HaloFour Feb 22, 2025

Copy link
Copy Markdown
Contributor Author

There was a problem hiding this comment.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you for that link. I will review and consider how it impacts this PR.

Sorry, something went wrong.

Uh oh!

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

All reactions

@HaloFour HaloFour Feb 24, 2025

Copy link
Copy Markdown
Contributor Author

There was a problem hiding this comment.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There's a lot going on in that discussion. It sounds like even if the recommendation is that instrumentation emit exceptions as log events that there should still be some form of configuration to bridge that back to span events.

While it seems like a lot of things are up in the air have there been any discussions as to how that OTEP might impact the Java SDK and instrumentation?

Either way I think there's value in having some degree of control over how exceptions are interpreted and rendered into telemetry signals, including spans, so I would like to continue the conversation as to how that could be exposed in the SDK.

Sorry, something went wrong.

Uh oh!

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

All reactions

@jack-berg jack-berg Feb 24, 2025

Copy link
Copy Markdown
Member

There was a problem hiding this comment.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Either way I think there's value in having some degree of control over how exceptions are interpreted and rendered into telemetry signals

I agree. With logs / events right now, instrumentation is responsible for this. See how the logback instrumentation has the same SDK exception span event rendering logic embedded in it. When its an instrumentation concern, that means that every instrumentation has to handle it separately. In theory that means that there's a lot of control over the rendering, but in practice, there's really only control if the instrumentation libraries expose configuration options to control the rendering. So it becomes a decentralized problem instead of a problem centrally handled / configured in the SDK. Ouch.

@trask I wonder if we should add a method to LogRecordBuilder which allows users to attach an exception directly to the log record. Then, we could have a log SDK configuration option for configuring rendering which is consistent / symmetric with rendering configuration in the trace SDK.

Sorry, something went wrong.

Uh oh!

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

lmolkova reacted with thumbs up emoji
All reactions
  • 👍 1 reaction

@HaloFour HaloFour Feb 25, 2025

Copy link
Copy Markdown
Contributor Author

There was a problem hiding this comment.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That's interesting to me that the OTel Log instrumentation for JUL, log4j and logback simply emit the entire stacktrace rather than using the formatting facilities that are provided. It definitely feels like this might be something that the OTel SDK should provide and that instrumentation should be abstracted away from those concerns to keep the behavior consistent and user-configurable. I'd be happy to help work on such a project.

Sorry, something went wrong.

Uh oh!

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

All reactions

@trask trask Feb 26, 2025

Copy link
Copy Markdown
Member

There was a problem hiding this comment.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@jack-berg since you're hopefully not trying to follow all of the logging discussions, here's the latest thought for attaching a terminal exception directly to a span: open-telemetry/opentelemetry-specification#4429 (comment)

Sorry, something went wrong.

Uh oh!

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

All reactions

@jack-berg jack-berg Feb 26, 2025

Copy link
Copy Markdown
Member

There was a problem hiding this comment.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

here's the latest thought for attaching a terminal exception directly to a span

👍 this also seems to align with @HaloFour's thought. Of course, all of this will have to be configurable given the fact that folks may be depending on the current stable behavior.

Sorry, something went wrong.

Uh oh!

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

All reactions

@trask trask Feb 26, 2025

Copy link
Copy Markdown
Member

There was a problem hiding this comment.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

folks may be depending on the current stable behavior

the general strategy we're proposing in the spec:

  • no changes to any existing SDK behavior
  • introduce new API with new behavior
  • deprecate old API to signal that new code should use the new API
  • ask (at least stable) instrumentations to bump their major version when they move from the old API to the new API

Sorry, something went wrong.

Uh oh!

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

All reactions

@HaloFour HaloFour Feb 26, 2025

Copy link
Copy Markdown
Contributor Author

There was a problem hiding this comment.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ask (at least stable) instrumentations to bump their major version when they move from the old API to the new API

Could that be an abstraction provided by the instrumentation API itself so that individual instrumentations don't need to be aware of how exceptions end up getting emitted?

Sorry, something went wrong.

Uh oh!

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

All reactions

@trask trask Feb 26, 2025

Copy link
Copy Markdown
Member

There was a problem hiding this comment.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍 if you're specifically referring to io.opentelemetry.instrumentation:opentelemetry-instrumentation-api

Sorry, something went wrong.

Uh oh!

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

HaloFour reacted with thumbs up emoji
All reactions
  • 👍 1 reaction
@jack-berg

jack-berg commented Dec 12, 2025

Copy link
Copy Markdown
Member

This is possible to achieve with #7266 by configuring SdkTracerProviderBuilder#setExceptionAttributeResolver(ExceptionAttributeResolver).

All reactions

Sorry, something went wrong.

Uh oh!

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

@jack-berg jack-berg closed this Dec 12, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Reviewers

@trask trask trask left review comments
@lmolkova lmolkova lmolkova left review comments
@jack-berg jack-berg jack-berg left review comments

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.

4 participants

@HaloFour @jack-berg @trask @lmolkova
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.