-
Notifications
You must be signed in to change notification settings - Fork 562
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
otelecho: remove global error handler call #4420
base: main
Are you sure you want to change the base?
otelecho: remove global error handler call #4420
Conversation
|
To be honest, I do not understand why PS. I never used echo. |
I'm not opposed to this. |
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.
This PR SGTM
@rattuscz Please do not forget to add a changelog. |
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## main #4420 +/- ##
=======================================
- Coverage 81.1% 80.8% -0.3%
=======================================
Files 150 150
Lines 10753 10349 -404
=======================================
- Hits 8725 8371 -354
+ Misses 1872 1834 -38
+ Partials 156 144 -12
|
Yes it seems weird to me too, it's probably propagated by copy pasting some example from echo documentation. Anyway it will be BC break if you simply remove it now as users of this package had to already solve it somehow on their end - either by ignoring some errors in the global error handler or by carefully stacking middlewares to get expected behavior. |
It is not a stable Go module so breaking change are acceptable if there are good reasons to do so. |
Okie, changed this to implement the removal. |
Co-authored-by: Damien Mathieu <[email protected]>
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.
Tests are failing.
@@ -38,6 +38,9 @@ This project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.htm | |||
|
|||
- Upgrade dependencies of OpenTelemetry Go to use the new [`v1.21.0`/`v0.44.0` release](https://github.com/open-telemetry/opentelemetry-go/releases/tag/v1.21.0). (#4582) | |||
|
|||
### Changed | |||
- Remove call to global error handler in `go.opentelemetry.io/contrib/instrumentation/github.com/labstack/echo/otelecho` (#4420) |
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.
This is also improperly placed in the changelog. It needs to be in the unreleased
section.
Oh well it actually depends on the http status code being already set (for example by error handler.. 😞 ). So this middleware would require some other middleware up in the chain calling the error handler or it needs to call the error handler itself. Otherwise even though the server works properly - global error handler is called by echo if err comes out of middlewares - it will not record correct http status code and span ok/error status. Any thoughts? 🤔 |
Well, it looks like the |
Sure I can fix the tests, if that's the way to go. In our projects we tend to have logger as the last middleware and eating the error returned from handler functions so the response is already set, error logged/handled and all is great. Will leave it here for a few days before commiting |
First try at implementing #4419