docs: document juju_unit label injection for wildcard and non-wildcard scrape targets#245
docs: document juju_unit label injection for wildcard and non-wildcard scrape targets#245Abuelodelanada wants to merge 2 commits intomainfrom
Conversation
sed-i
left a comment
There was a problem hiding this comment.
Looks good!
For quick reference in the future, could you please add a "Summary" section with a table such as
| juju_unit | juju_application | juju_charm | juju_model | juju_model_uuid | |
|---|---|---|---|---|---|
| cos-config | |||||
| gagent:juju-info | |||||
| gagent:cos-agent | |||||
| ... |
comparing which labels are present on which relations, and potentially contrasting label matchers and alert labels.
There was a problem hiding this comment.
Pull request overview
Documents how the prometheus_scrape library injects the juju_unit topology label into Prometheus scrape jobs for both wildcard and explicit (non-wildcard) scrape targets.
Changes:
- Expanded
juju-topology-labels.mdto describejuju_unitinjection behavior for wildcard vs non-wildcard scrape targets undermetrics-endpoint. - Updated the “Exposing a Metrics Endpoint” how-to with guidance and an example for using explicit FQDN/IP targets (e.g., for strict TLS/SNI).
- Minor Markdown whitespace/formatting cleanup in the affected sections.
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 1 comment.
| File | Description |
|---|---|
| docs/reference/juju-topology-labels.md | Adds reference documentation for juju_unit injection behavior for wildcard and non-wildcard scrape targets. |
| docs/how-to/exposing-a-metrics-endpoint.md | Adds author guidance and an example showing explicit targets and how juju_unit enrichment applies. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| The `*` wildcard in the target address is the most common pattern. At scrape | ||
| time, Prometheus expands it to one scrape job per unit, each labeled with the | ||
| corresponding `juju_unit` topology label. |
There was a problem hiding this comment.
The statement that Prometheus "expands" the * target is inaccurate: Prometheus treats static_configs.targets as literal host:port strings and does not expand *. The per-unit expansion/juju_unit enrichment is done before Prometheus receives the final scrape config (e.g., by the prometheus_scrape library / charm generating the jobs). Please reword to avoid attributing this behavior to Prometheus itself.
| The `*` wildcard in the target address is the most common pattern. At scrape | |
| time, Prometheus expands it to one scrape job per unit, each labeled with the | |
| corresponding `juju_unit` topology label. | |
| The `*` wildcard in the target address is the most common pattern. The | |
| `prometheus_scrape` library uses it to generate one scrape target per unit | |
| before Prometheus receives the final scrape configuration, and each target is | |
| labeled with the corresponding `juju_unit` topology label. |
Issue
Document how the prometheus_scrape library injects the juju_unit topology label into Prometheus scrape jobs, covering both wildcard and non-wildcard targets.
Checklist