Repository navigation
fix(alloy): cluster the pod and cAdvisor metrics scrapes - #94
Merged
Merged
Conversation
Alloy runs as a DaemonSet with clustering enabled. Only pyroscope.scrape uses it. prometheus.scrape for pods and cAdvisor has no clustering block, so every Alloy pod scrapes every target. The remote_write config drops the instance label, so each pod writes the same series to Prometheus. Prometheus rejects the duplicates as out of order samples. Enable clustering on both prometheus.scrape components so that the pods share the targets.
jtslear
force-pushed
the
skarbek/alloy-scrape-clustering
branch
from
October 16, 2026 15:04
6136bf1 to
7713be6
Compare
jtslear
marked this pull request as ready for review
October 16, 2026 15:28
dannykopping
approved these changes
Oct 16, 2026
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
Enable
clusteringonprometheus.scrape "pods"andprometheus.scrape "cadvisor"in the collector config.Review of coder/dogfood#702 (v0.8.0 bump), Linear PLE-22 (metrics gaps and Prometheus out-of-order samples): https://github.com/coder/dogfood/pull/702#discussion_r4286742478 . The review noted the cause as likely, from reading the config: https://github.com/coder/dogfood/pull/702#pullrequestreview-5538197905
Why
Alloy runs as a DaemonSet with
alloy.clustering.enabled: true, but onlypyroscope.scrapehas aclusteringblock. Each Alloy pod therefore scrapes every pod and every node.remote_writedrops theinstancelabel, so every pod writes the same series, and Prometheus rejects the copies without of order sample. This is the same onmainand on the previousgrafana-agentconfig.Test
Using Kind for testing, the cluster has one node, so a DaemonSet gives one peer. I simulated several nodes with
--set alloy.controller.type=statefulset --set alloy.controller.replicas=2. Both pods join the cluster (cluster_node_peers= 2).Totals for both Alloy pods, from
prometheus_remote_storage_samples_totaland..._failed_total:main, 2 peersTarget split on this branch (
prometheus_target_scrape_pool_targets):prometheus.scrape.podsprometheus.scrape.cadvisorEach target now belongs to one peer, and all targets are still scraped (10 pods with
up == 1).Limits
instanceis dropped (CRF-18 in the review). I did not test that.Notes
compiled/resources.yamlregenerated withmake build.