-
Notifications
You must be signed in to change notification settings - Fork 867
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
Allow user to enable/disable storing entire stack trace in spans #431
Comments
Can please specify, what stacktraces are talking about? |
If a method annotated with @WithSpan throws an exception, the entire stack trace is stored in an attribute called error.stacktrace. I believe this happens in io.opentelemetry.auto.bootstrap.instrumentation.decorator.BaseDecorator, within the addThrowable method. |
Hi @dneray, does sampling address your concern? If not, I could see this being part of the annotation, e.g. for methods where exceptions are fairly common and the stack trace is not really useful, but you still want to capture timing and success/failure (we would still mark the span as an error and capture the exception message). public @interface WithSpan { String value() default ""; boolean captureStackTraceOnThrowable() default true; } |
Thanks @trask sampling would help reduce the load but ultimately I think that addition to the WithSpan annotation would be the ideal solution. Ideally the backend wouldn't be throwing exceptions frequently with useless stack traces but unfortunately many applications do and it would be a lot of overhead to serialize them even with sampling enabled. |
@dneray In your system, does this concern also apply to spans from the built-in instrumentation (e.g. servlets, http clients)? If so, maybe this is a global setting that says "don't capture any exception stack traces"? (or maybe a max frames setting? we'd have to decide what that means for caused by chains) |
In my system so far, I have not seen anywhere where this concern is applicable it the built-in instrumentations but I can see how it might for others. Now that I think about it, for my case another option that would work very well would be to be able to ignore certain types of exceptions i.e. similar to the TRACE_CLASSES_EXCLUDE and TRACE_METHODS_EXCLUDE there could be something like a TRACE_THROWABLES_IGNORE. Not sure if that would work best for everyone though, I could imagine that there are codebases full of generic exceptions that are thrown from everywhere. |
There are many options how to solve this issue.
First of all I would suggest to see if option number 5 solves your concern. It is the fastest option in your case. Next, ignoring specific exceptions would probably mean as well changing the status of span from one of the error to one of the normal operation. It depends on your use case if you want this or not. I have a request from our customers to do exactly this: treat some exceptions as “normal”, nor errors. I don’t think that @WithSpan notation is special enough to deserve the preferential treatment of option 1 or 2 from above. If do something along these lines, then I prefer either option 3 or 4. Meaning global configuration. |
Thanks @iNikem I am already using the collector but unfortunately it still causes excessive GC pauses to send these traces out of the java app. Option 4 is preferable for me, I understand that it would treat these exceptions as "normal". For my use case, I would rather have the option to use the manual instrumentation to control how these are captured in the spans. |
@dneray Using the OpenTelemetry API seems like it might be a good option here as an alternative to using @WithSpan. See https://github.com/open-telemetry/opentelemetry-auto-instr-java#manually-instrumenting. |
Thanks, yes that is what I have done for now but I would really like to be able to use the @WithSpan annotation instead. |
When using the @WithSpan annotation in a high load system, it can be expensive to serialize all stack traces. While these are obviously incredibly valuable, it would be nice to have a way for users to disable it.
I'm not sure if it makes more sense to have this part of the annotation itself or a global property.
The text was updated successfully, but these errors were encountered: