Skip to content

http span and error.type #10

@aldas

Description

@aldas

Spec https://opentelemetry.io/docs/specs/semconv/http/http-spans/ says

[5] error.type: If the request fails with an error before response status code was sent or received, error.type SHOULD be set to exception type (its fully-qualified class name, if applicable) or a component-specific low cardinality error identifier.
If response status code was sent or received and status indicates an error according to HTTP span status definition, error.type SHOULD be set to the status code number (represented as a string), an exception type (if thrown) or a component-specific error identifier.
The error.type value SHOULD be predictable and SHOULD have low cardinality. Instrumentations SHOULD document the list of errors they report.
The cardinality of error.type within one instrumentation library SHOULD be low, but telemetry consumers that aggregate data from multiple instrumentation libraries and applications should be prepared for error.type to have high cardinality at query time, when no additional filters are applied.

Relates to this place:

echo-opentelemetry/otel.go

Lines 217 to 224 in a9468a6

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

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