Skip to content

Fix custom_labels merge in Sidekiq process and stats collectors#367

Open
marwan-tanager wants to merge 1 commit intodiscourse:mainfrom
accredible:DGR-3799-fix-sidekiq-custom-labels
Open

Fix custom_labels merge in Sidekiq process and stats collectors#367
marwan-tanager wants to merge 1 commit intodiscourse:mainfrom
accredible:DGR-3799-fix-sidekiq-custom-labels

Conversation

@marwan-tanager
Copy link
Copy Markdown

Summary

  • Fix custom_labels (including service_component) being discarded by the Sidekiq process and stats collectors
  • Align both collectors with the queue collector's existing pattern of merging custom_labels into the labels hash

Problem

The client side sends custom_labels with every payload via send_json, but only the queue collector's collect() method merges them into the labels hash. The process collector discards them entirely, and the stats collector both discards them in collect() and never passes labels to gauge.observe() in metrics().

Changes

  1. Process collector (sidekiq_process_collector.rb): merge custom_labels into process["labels"] in collect()
  2. Stats collector (sidekiq_stats_collector.rb): store custom_labels as object["labels"] in collect(), and pass labels to gauge.observe(value, labels) in metrics()
  3. Tests: added test_collecting_metrics_with_client_default_labels to both collector test files, updated integration test assertions in collector_test.rb

…ctors

The queue collector merges custom_labels (including service_component)
in collect(), but the process and stats collectors discarded them.
This caused process/stats metrics to lack service_component, making
Alloy fall back to service_name=acms instead of acms-sidekiq.

Process collector: merge custom_labels into process["labels"] in collect()
Stats collector: merge custom_labels in collect() and pass labels to
gauge.observe() in metrics()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

1 participant