Fix custom_labels merge in Sidekiq process and stats collectors#367
Open
marwan-tanager wants to merge 1 commit intodiscourse:mainfrom
Open
Fix custom_labels merge in Sidekiq process and stats collectors#367marwan-tanager wants to merge 1 commit intodiscourse:mainfrom
custom_labels merge in Sidekiq process and stats collectors#367marwan-tanager wants to merge 1 commit intodiscourse:mainfrom
Conversation
…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()
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
custom_labels(includingservice_component) being discarded by the Sidekiq process and stats collectorscustom_labelsinto the labels hashProblem
The client side sends
custom_labelswith every payload viasend_json, but only the queue collector'scollect()method merges them into the labels hash. The process collector discards them entirely, and the stats collector both discards them incollect()and never passes labels togauge.observe()inmetrics().Changes
sidekiq_process_collector.rb): mergecustom_labelsintoprocess["labels"]incollect()sidekiq_stats_collector.rb): storecustom_labelsasobject["labels"]incollect(), and pass labels togauge.observe(value, labels)inmetrics()test_collecting_metrics_with_client_default_labelsto both collector test files, updated integration test assertions incollector_test.rb