Skip to content

Commit

Permalink
fix(otelgin): do not override spanname if empty
Browse files Browse the repository at this point in the history
  • Loading branch information
gunturaf committed Oct 14, 2024
1 parent f3da1c6 commit 6403414
Showing 1 changed file with 1 addition and 3 deletions.
4 changes: 1 addition & 3 deletions instrumentation/github.com/gin-gonic/gin/otelgin/gintrace.go
Original file line number Diff line number Diff line change
Expand Up @@ -136,9 +136,7 @@ func Middleware(service string, opts ...Option) gin.HandlerFunc {
if spanName == "" {
spanName = fmt.Sprintf("HTTP %s route not found", c.Request.Method)
} else {
rAttr := semconv.HTTPRoute(spanName)
opts = append(opts, oteltrace.WithAttributes(rAttr))
metricAttrs = append(metricAttrs, rAttr)
metricAttrs = append(metricAttrs, semconv.HTTPRoute(spanName))
}
ctx, span := tracer.Start(ctx, spanName, opts...)
defer span.End()
Expand Down

0 comments on commit 6403414

Please sign in to comment.