Skip to content

Not possible to set the span operation name to the matched route #10

@krosen040

Description

@krosen040

We would like to be able to set the span operation name to the matched gin route, however currently this is difficult. For example, if there is a route /user/:name, and a request is made to /user/foo, we would like to set the span name to the former.

The default span operation name is HTTP + method, e.g. HTTP GET. It's possible to override this default using the OperationNameFunc option, which gives access to the http.Request object, however I don't think that can be used to get the matched route (it's obviously possible to get the path, but that could contain path parameters, which we want to avoid).

As a side note, the gorilla/mux Opentracing middleware implementation defaults to the matched route as the operation name, see https://github.com/opentracing-contrib/go-gorilla/blob/3ee496ae11d5bebfd34703cee4efa29e0439a33d/gorilla/server.go#L35, which I think makes more sense than just the HTTP method used.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions