Skip to content

Conversation

@matlockx
Copy link

@matlockx matlockx commented Dec 8, 2021

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

Martin Joehren and others added 6 commits December 8, 2021 11:37
@lucacome lucacome requested a review from Copilot June 10, 2025 21:35
Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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())

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants