Replies: 1 comment 6 replies
-
There's an ongoing effort in the spec to introduce this behavior: https://github.com/open-telemetry/opentelemetry-specification/pull/1685/files |
Beta Was this translation helpful? Give feedback.
6 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
I was wondering if there was interest in exploring a way to override the default manner in which the WithSpan aspects determine the status of the Span created for a method?
Currently that status is driven by whether or not the method throws an exception. I think this works in the majority of cases. However we've found in our code bases occasions where sometimes we throw a specific exception but we consider that to be the correct behavior for the method in that circumstance and not really an "error" case. An example might be a Spring controller method that enforces constraints on the parameters and throws a
ConstraintViolationException
.We currently have our own Spring aspect for OpenTelemetry that was written quite some time ago that I am trying to retire in favor of the Instrumentation aspect. The way we solved for this functionality in our aspect was that our flavor of the
@WithSpan
annotation had anignoredExceptions
element of typeClass<? extends Exception>[]
and if the method threw that exception the aspect would compare the type of the exception against that list. It worked for our purposes but it was pretty limited in that you couldn't programmatically override the status from within the method.Another method I considered could be to have the aspect tracer inspect the current status of the span. If the span status was already set then the tracer would not override it, so if the method set the status to OK then it would remain OK. However, as the API Span is write-only this would only really work for implementations of
ReadableSpan
.Thoughts?
Beta Was this translation helpful? Give feedback.
All reactions