Skip to content

Commit

Permalink
feat: add keel attr
Browse files Browse the repository at this point in the history
  • Loading branch information
franklinkim committed Apr 17, 2024
1 parent 2038db3 commit c6734a4
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions net/http/middleware/telemetry.go
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,13 @@ func TelemetryWithOptions(opts TelemetryOptions) Middleware {
otel.GetTextMapPropagator().Inject(r.Context(), propagation.HeaderCarrier(w.Header()))
}

if labeler, ok := otelhttp.LabelerFromContext(r.Context()); ok {
labeler.Add(
log.KeelServiceTypeKey.String("http"),
log.KeelServiceNameKey.String(name),
)
}

if labeler, ok := httplog.LabelerFromRequest(r); ok {
if spanCtx := trace.SpanContextFromContext(r.Context()); spanCtx.IsValid() && spanCtx.IsSampled() {
labeler.Add(log.FTraceID(spanCtx.TraceID().String()))
Expand Down

0 comments on commit c6734a4

Please sign in to comment.