Skip to content

span error based on http status #11

@vadimi

Description

@vadimi

Hello, I've discovered an issue with the new tracer implementation - when http status code that the route returns is 500, the span status is still set to Unset. The previous implementation of the tracer would set it to Error.

The only place where the tracer sets it to error is this:

err := next(c)
if err != nil {
  span.SetAttributes(semconv.ErrorType(err))
  span.SetStatus(codes.Error, err.Error())
  if config.OnNextError != nil {
    config.OnNextError(c, err)
  }
}

but in case of responses like return c.String(http.StatusInternalServerError, "error") err is always nil.

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