Open
Conversation
* preserve error return value from middleware * do not touch the response
There was a problem hiding this comment.
Pull Request Overview
This PR adds support for custom error handlers to control span tagging for specific error scenarios, such as omitting the error tag for 404 responses. Key changes include introducing a configurable error handler in the middleware, updating module names and dependency versions, and adjusting example files accordingly.
- Added a new ErrorHandler type and associated functions in middleware.go.
- Updated the go.mod files with new module names, Go versions, and dependency versions.
- Updated example files (tracer/init.go, server.go) to accommodate the module name change.
Reviewed Changes
Copilot reviewed 7 out of 7 changed files in this pull request and generated no comments.
Show a summary per file
| File | Description |
|---|---|
| middleware.go | Introduces a configurable error handler and refactors middleware logic. |
| go.mod | Updates module name and dependency versions. |
| examples/tracer/init.go | Minor adjustments in error message printing. |
| examples/server.go | Updates module path and import organization. |
| examples/go.mod | Aligns module dependency and versioning with the new module name. |
Comments suppressed due to low confidence (2)
middleware.go:21
- [nitpick] Consider renaming 'DefaultErrorHandlerError' to 'DefaultErrorHandler' to avoid redundancy and improve clarity.
func DefaultErrorHandlerError(c echo.Context, err error, _ *http.Request, sp opentracing.Span) {
examples/tracer/init.go:15
- The use of fmt.Println with format specifiers will not format the error message correctly; consider using fmt.Printf or concatenating the error string properly.
fmt.Println("cannot parse jaeger env vars: %v\n", err.Error())
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This pr adds the possibility to add an own error handler to mutate the span, e.g. i do not want to add the error tag to the span when a specific error creates or stands for a 404