-
Notifications
You must be signed in to change notification settings - Fork 48
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 for recording an error in spans without throwables #939
base: main
Are you sure you want to change the base?
Conversation
Thank you for the PR! Do you have a real use-case for this? If so, could you please show us what you are trying to do? What concerns me that both OTel and Brave have their own mechanisms to signal an error which is possible through passing a If you want the "normal" behavior of these libraries I think you can do something like this: span.error(new MyCustomError(message)); You don't need to throw the exception, it can be used as a wrapper around the error message and the stacktrace (and other details you want to attach). If you want just an event (won't fail the span): span.event("error: oops!"); @shakuzen @marcingrzejszczak What do you think? Has something like this requested before? |
Sure, our code base is mainly in Kotlin utilising this functional companion library arrow-kt. In essence, we don't work with exceptions at all. Instead, we define possible errors as part of function signatures utilising the
So what this means is if we want to record an error in a span, we need to artificially create an exception, like so:
leaving us with a stacktrace in the span which is completely useless and only creates noise in Honeycomb. Ideally, what we want is to attach an event to the span with a helpful attribute indicating what the error was and set the span status to indicate that there's been an error. Setting the span status is significant as we don't want these to be sampled. Edit: |
I think that setting an event + customizing OTel components to mark the status as error when an event with a given text was found would be the way to go for now. I don't recall anyone asking for this really. |
Sorry, I'm confused. Recording an event + marking the span status as error is what the proposed change does. Does your statement mean that you're opposing the change and clients of micrometer should rather switch to using the native otel API? |
I'm saying that this would be the way to go without this change. With this change we're adding new API and we're always trying to be cautious about that |
Hey! It would be really nice if we could attach error events to spans without having to pass
Throwable
s around. This is an attempt to cater for a more functional style of programming where exceptions are avoided and errors are part of methods' signatures.I'm unsure whether
this.delegate.tag("error", message);
is enough for the Brave bridge. I didn't find many options in the native API.Thanks for considering this proposal!