common
common copied to clipboard
HTTP Logging doesn't print user-id
While I think the idea was to print user/org ids, with http req logging, as seen here: https://github.com/weaveworks/common/blob/master/middleware/logging.go#L40 we don't.
This is because logging is currently the first middleware and auth is usually the last. Which means the context that the logging middleware has access to doesn't have the user/org-ids.
Not sure how to put the auth middleware at the first though....
good spot!
We could prepend the supplied server.Config.HTTPMiddleware instead of appending it.
Might need to tweak the opentracing handler.
Or server.Config could have pre- and post- middleware.
Oh, I am not sure that'll help. Because AFAICS, the auth part comes here: https://github.com/weaveworks/cortex/blob/master/cmd/querier/main.go#L106-L109
I don't see why it needs to be done that way. It is allowing non-authenticated access to /ring, but that doesn't seem essential.
Looking into this again, https://github.com/weaveworks/common/blob/master/middleware/logging.go#L36 should inject the user-id into the context, not sure why it doesn't.