Closed scorpionknifes closed 2 months ago
I'm trying to use the official otelfiber and this library to log trace_id and user_id
app.Use(otelfiber.Middleware()) app.Use(slogfiber.NewWithConfig(logger, slogfiber.Config{ WithSpanID: true, WithTraceID: true, }))
I noticed the otelfiber library uses c.UserContext() https://github.com/gofiber/contrib/blob/c62abb213b0a82b35be9ecf39237760e0ee84c84/otelfiber/fiber.go#L119-L120
c.UserContext()
And this library uses c.Context() which trace doesn't exist. https://github.com/samber/slog-fiber/blob/7bd189e1a50676fb442b911788788584d14a9311/middleware.go#L181-L182
c.Context()
I'm not sure if i'm implementing this wrong or the library is deliberately using the fasthttp context?
Side note I think trace id and span id need to be trace_id instead of trace-id https://opentelemetry.io/docs/specs/otel/compatibility/logging_trace_context
trace_id
trace-id
i made a fix, thanks for the feedback
I'm trying to use the official otelfiber and this library to log trace_id and user_id
I noticed the otelfiber library uses
c.UserContext()
https://github.com/gofiber/contrib/blob/c62abb213b0a82b35be9ecf39237760e0ee84c84/otelfiber/fiber.go#L119-L120And this library uses
c.Context()
which trace doesn't exist. https://github.com/samber/slog-fiber/blob/7bd189e1a50676fb442b911788788584d14a9311/middleware.go#L181-L182I'm not sure if i'm implementing this wrong or the library is deliberately using the fasthttp context?