Add extra fields to the context in the logs
Why
https://gitlab.com/gitlab-org/labkit-ruby/merge_requests/22 and gitlab-org/gitlab!20791 (merged) introduces Gitlab::ApplicationContext
which is used to structure context data and fan-out to Labkit::Middleware::Sidekiq::Client
and eventually pick it up at Labkit::Middleware::Sidekiq::Server
for logging.
These logs are indexed and used at Kibana under the meta.
namespace. Though, only user
, project
and root_namespace
are currently available.
What
The focus here is introducing the following attributes:
-
caller_id
: Which can be the Controller#action, API path (/api/:route
) orWorkerClassName
-
subscription_plan
: Which can be found at thenamespace
level asgitlab_subscription
Changes in both gitlab-rails
and labkit
will be required considering we'll provide extra fields that need to be recognized by KNOWN_KEYS
.
From the discussion in #9 (comment 249713704)
Edited by Oswaldo Ferreira