Skip to content

fix(alloy): scrape all alloy pod targets on the Alloy HTTP port - #90

Merged
jtslear merged 1 commit into
mainfrom
skarbek/alloy-default-port-annotation
Oct 20, 2026
Merged

jtslear merged 1 commit into
mainfrom
skarbek/alloy-default-port-annotation

Conversation

@jtslear

@jtslear jtslear commented Oct 16, 2026 •

Copy link
Copy Markdown
Collaborator

Summary

Set prometheus.io/port: "12345" on the Alloy pod by default.

Review of coder/dogfood#702 (v0.8.0 bump) asked for dogfood settings to become chart defaults. Dogfood sets this annotation in its own values. Source: https://github.com/coder/dogfood/pull/702#pullrequestreview-5547941289

Why

Pod discovery makes one scrape target for each declared container port. It makes a target on port 80 for containers that declare no port. Alloy listens on 12345, not 80, so up{job="<ns>/alloy/config-reloader"} is always 0. The annotation points every target of the pod at the Alloy HTTP port.

Test

Kind cluster tested, baseline is main with default values.

up{pod=~"alloy.*"}
main alloy/alloy = 1, alloy/config-reloader = 0
this branch alloy/alloy = 1, alloy/config-reloader = 1

Method: helm upgrade with the local chart, wait for the DaemonSet rollout, query Prometheus.

Notes

  • The config-reloader target now scrapes Alloy's own /metrics. Its series are a copy of the alloy job under another job label. Raised in https://github.com/coder/dogfood/pull/702#discussion_r4286919738 and left as is.
  • The value must equal alloy.alloy.listenPort. Helm values cannot reference each other, so a comment records this.
  • compiled/resources.yaml regenerated with make build.

Pod discovery makes one scrape target for each declared container port.
It makes a target on port 80 for containers that declare no port, such
as config-reloader. Alloy does not listen on port 80, so the
config-reloader target is always down.

Set the prometheus.io/port annotation on the Alloy pod to the Alloy HTTP
port by default. Operators no longer need to set it in their own values.
@jtslear
jtslear force-pushed the skarbek/alloy-default-port-annotation branch from 443c4f9 to e704cdd Compare October 16, 2026 15:04
@jtslear
jtslear marked this pull request as ready for review October 16, 2026 15:35
@jtslear
jtslear requested a review from dannykopping as a code owner October 16, 2026 15:35

Copy link
Copy Markdown
Collaborator

Appreciate the follow-up here!

@jtslear
jtslear merged commit 140e60c into main Oct 20, 2026
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants