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. |
|
@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 <42@dmathieu.com>
| - 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.
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 |
|
Still got this error, and well, it's quite difficult to catch because of middleware debugging issues. In echo style, the handlers and middlewares should not call c.Error explicitly, and refactoring whole project just to fit the handling logic in this middleware is not great. Any plans to fix? |
|
This PR has had no response by its owner for 2 years. I think it's safe to say that you can take its commits, merge with the main branch and open a new one. |
|
@dmathieu can this be done as a breaking change or just an option with current implementation by default? |
|
The package isn't stable. So it can be a breaking change. |
Add WithSkipErrorHandler configuration option to support Echo's native error handling pattern where handlers return errors instead of calling c.Error() explicitly. This prevents double responses on errors propagated to the otelecho middleware. Fixes open-telemetry#4420 otelecho: config option to skip global error handler call remove again correct naming correct changelog Update CHANGELOG.md Co-authored-by: Damien Mathieu <42@dmathieu.com> fix: clean up fix: lint
First try at implementing #4419