1
0
mirror of https://github.com/imgproxy/imgproxy.git synced 2024-11-18 16:31:44 +02:00

Merge pull request #1379 from maxd-wttj/fix-trace-error

Set trace status to Error when using OTEL exporter
This commit is contained in:
Sergei Aleksandrovich 2024-11-15 22:41:49 +06:00 committed by GitHub
commit f0276f3cc0
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -25,6 +25,7 @@ import (
"go.opentelemetry.io/contrib/propagators/aws/xray"
"go.opentelemetry.io/otel"
"go.opentelemetry.io/otel/attribute"
"go.opentelemetry.io/otel/codes"
"go.opentelemetry.io/otel/exporters/otlp/otlpmetric/otlpmetricgrpc"
"go.opentelemetry.io/otel/exporters/otlp/otlpmetric/otlpmetrichttp"
"go.opentelemetry.io/otel/exporters/otlp/otlptrace"
@ -483,7 +484,7 @@ func SendError(ctx context.Context, errType string, err error) {
attributes = append(attributes, semconv.ExceptionStacktraceKey.String(stack))
}
}
span.SetStatus(codes.Error, err.Error())
span.AddEvent(semconv.ExceptionEventName, trace.WithAttributes(attributes...))
}