Skip to content

Commit

Permalink
feat: customizable request id field key
Browse files Browse the repository at this point in the history
  • Loading branch information
samber committed May 9, 2024
1 parent 24ac46a commit cd3b3b1
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions middleware.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,9 @@ type customAttributesCtxKeyType struct{}
var customAttributesCtxKey = customAttributesCtxKeyType{}

var (
TraceIDKey = "trace-id"
SpanIDKey = "span-id"
TraceIDKey = "trace-id"
SpanIDKey = "span-id"
RequestIDKey = "id"

RequestBodyMaxSize = 64 * 1024 // 64KB
ResponseBodyMaxSize = 64 * 1024 // 64KB
Expand Down Expand Up @@ -173,7 +174,7 @@ func NewWithConfig(logger *slog.Logger, config Config) fiber.Handler {
}

if config.WithRequestID {
baseAttributes = append(baseAttributes, slog.String("id", requestID))
baseAttributes = append(baseAttributes, slog.String(RequestIDKey, requestID))
}

// otel
Expand Down

0 comments on commit cd3b3b1

Please sign in to comment.