Skip to content

span error based on http status #11

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.

Activity

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

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