You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I've been using otel-fiber for a while, and I've noticed that by editing the fiber.go (around line 123) file in this way, I can set the main span status to error:
iferr:=c.Next(); err!=nil {
span.RecordError(err)
span.SetStatus(codes.Error, err.Message) //<-- added this line// invokes the registered HTTP error handler// to get the correct response status code_=c.App().Config().ErrorHandler(c, err)
}
Now, this solution works every time there is an error returned, but clearly not when there is a panic inside the handler function or one of the sub-functions, since no error is returned from the handler. I checked with breaks in debug mode, and the program never enters the if statemen, so the span is not set to Error.
What sounds strange is that the error is still recorded and logged as "event" in the span, and i can find it in the Uptrace application, with all the exception-related info, even if span.RecordError(err) is (apparently) never called.
Can anyone explain this behavior? I'm sure I'm missing something.
Is worth noting that i am using the recover middleware, in this order:
Question Description
I've been using otel-fiber for a while, and I've noticed that by editing the fiber.go (around line 123) file in this way, I can set the main span status to error:
Now, this solution works every time there is an error returned, but clearly not when there is a panic inside the handler function or one of the sub-functions, since no error is returned from the handler. I checked with breaks in debug mode, and the program never enters the
if
statemen, so the span is not set to Error.What sounds strange is that the error is still recorded and logged as "event" in the span, and i can find it in the Uptrace application, with all the exception-related info, even if
span.RecordError(err)
is (apparently) never called.Can anyone explain this behavior? I'm sure I'm missing something.
Is worth noting that i am using the
recover
middleware, in this order:Thanks
Code Snippet (optional)
No response
Checklist:
The text was updated successfully, but these errors were encountered: