Skip to content

Commit e7a8bc3

Browse files
committed
updated response label functions
1 parent 5b093a1 commit e7a8bc3

File tree

1 file changed

+2
-5
lines changed

1 file changed

+2
-5
lines changed

pkg/observability/newcontext.go

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -71,16 +71,13 @@ func WithLowCardinalityMessagingLabels(ctx context.Context, destinationTemplate,
7171
return ctx
7272
}
7373

74-
func WithResponseLabels(ctx context.Context, r *http.Response) context.Context {
74+
func WithResponseLabels(ctx context.Context, statusCode int) context.Context {
7575
labeler, ok := otelhttp.LabelerFromContext(ctx)
7676
if !ok {
7777
ctx = otelhttp.ContextWithLabeler(ctx, labeler)
7878
}
7979

80-
if r != nil {
81-
labeler.Add(ResponseStatusCode.With(int(r.StatusCode)))
82-
labeler.Add(ResponseStatusText.With(r.Status))
83-
}
80+
labeler.Add(ResponseStatusCode.With(statusCode))
8481

8582
return ctx
8683
}

0 commit comments

Comments
 (0)