Skip to content

Fix Sidekiq feature category logging

The intent of our feature category logging is:

  1. If the worker is owned by a feature category, we log that category.
  2. If the worker is not owned, we use the category from the surrounding context.

This change aims to achieve that by adding a special case in the logging code. We achieve the same aims for metrics with server middleware, but logging happens outside of middleware.

Testing

  1. Set up a web hook on a project (you can use a request bin, it doesn't matter).
  2. Visit /-/pipelines/new in the project, create an issue mentioning someone, create an MR mentioning someone, etc.
  3. Observe the correct results in the logs.
$ gdk tail rails-background-jobs | grep done | grep -v Cronjob | sed 's/^.* : ....//' | jq '[.class, ."meta.feature_category", ."meta.caller_id"]'
[
  "Ci::DeleteObjectsWorker",
  "continuous_integration",
  "Ci::ScheduleDeleteObjectsCronWorker"
]
[
  "Ci::DeleteObjectsWorker",
  "continuous_integration",
  "Ci::ScheduleDeleteObjectsCronWorker"
]
[
  "ExternalServiceReactiveCachingWorker",
  "continuous_integration",
  "Projects::PipelinesController#config_variables"
]
[
  "ProjectCacheWorker",
  "source_code_management",
  "PostReceive"
]
[
  "Namespaces::ScheduleAggregationWorker",
  "source_code_management",
  "ProjectCacheWorker"
]
[
  "PostReceive",
  "source_code_management",
  "POST /api/:version/internal/post_receive"
]
[
  "Namespaces::OnboardingPipelineCreatedWorker",
  "onboarding",
  "PostReceive"
]
[
  "Ci::InitialPipelineProcessWorker",
  "continuous_integration",
  "PostReceive"
]
[
  "PipelineProcessWorker",
  "continuous_integration",
  "Ci::InitialPipelineProcessWorker"
]
[
  "MergeRequests::SyncCodeOwnerApprovalRulesWorker",
  "source_code_management",
  "Projects::MergeRequests::CreationsController#create"
]
[
  "BuildHooksWorker",
  "continuous_integration",
  "PostReceive"
]
[
  "JiraConnect::SyncBuildsWorker",
  "integrations",
  "Ci::InitialPipelineProcessWorker"
]
[
  "WebHookWorker",
  "integrations",
  "PostReceive"
]
[
  "BuildQueueWorker",
  "continuous_integration",
  "Ci::InitialPipelineProcessWorker"
]
[
  "ExpirePipelineCacheWorker",
  "continuous_integration",
  "Ci::InitialPipelineProcessWorker"
]
[
  "ExpireJobCacheWorker",
  "continuous_integration",
  "Ci::InitialPipelineProcessWorker"
]
[
  "PipelineHooksWorker",
  "continuous_integration",
  "Ci::InitialPipelineProcessWorker"
]
[
  "NewMergeRequestWorker",
  "code_review",
  "Projects::MergeRequests::CreationsController#create"
]
[
  "Ci::SyncReportsToReportApprovalRulesWorker",
  "continuous_integration",
  "NewMergeRequestWorker"
]
[
  "WebHooks::LogExecutionWorker",
  "integrations",
  "WebHookWorker"
]
[
  "WebHookWorker",
  "integrations",
  "Projects::MergeRequests::CreationsController#create"
]
[
  "WebHookWorker",
  "integrations",
  "BuildHooksWorker"
]
[
  "WebHookWorker",
  "integrations",
  "PipelineHooksWorker"
]
[
  "ExpirePipelineCacheWorker",
  "continuous_integration",
  "ExpireJobCacheWorker"
]
[
  "MergeRequestMergeabilityCheckWorker",
  "code_review",
  "Projects::MergeRequestsController#show"
]
[
  "WebHooks::LogExecutionWorker",
  "integrations",
  "WebHookWorker"
]
[
  "WebHooks::LogExecutionWorker",
  "integrations",
  "WebHookWorker"
]
[
  "WebHooks::LogExecutionWorker",
  "integrations",
  "WebHookWorker"
]
[
  "ActionMailer::MailDeliveryJob",
  "code_review",
  "NewMergeRequestWorker"
]
[
  "IssuePlacementWorker",
  "issue_tracking",
  "Projects::IssuesController#create"
]
[
  "Namespaces::OnboardingIssueCreatedWorker",
  "onboarding",
  "Projects::IssuesController#create"
]
[
  "NewIssueWorker",
  "issue_tracking",
  "Projects::IssuesController#create"
]
[
  "ActionMailer::MailDeliveryJob",
  "issue_tracking",
  "NewIssueWorker"
]
[
  "WebHookWorker",
  "integrations",
  "Projects::IssuesController#create"
]
[
  "WebHooks::LogExecutionWorker",
  "integrations",
  "WebHookWorker"
]
[
  "ExternalServiceReactiveCachingWorker",
  "continuous_integration",
  "ExternalServiceReactiveCachingWorker"
]

One option for gitlab-com/gl-infra/scalability#1164 (closed).

Merge request reports

Loading