refactor(swarm-otel): one declaration for a published scrape target
`collectorAudiences` was a list of URLs services contributed so the collector's client could be registered for them. Slice C needs the same URLs as scrape jobs, and a job needs a name the audience list has no room for — so services would have contributed to two options that must agree. They now contribute `publishedScrapeTargets` once, as `<job> = "<url>"`, and the client's audiences derive from it. The drift that would have needed maintaining is gone, and its failure mode was the quiet one: a target whose audience was forgotten authenticates against nothing and reads as a broken scrape rather than a missing registration. Adds an assertion for the one collision the module system cannot catch. Two definitions of the same key within one option are already refused (measured); across the two scrape options nothing arbitrates, and both entries would render into a single scrape_configs list under one job_name.
This commit is contained in:
parent
94204ac82b
commit
94ef8428e0
2 changed files with 80 additions and 41 deletions
|
|
@ -442,17 +442,20 @@ in
|
|||
url = "https://${cfg.domain}/";
|
||||
};
|
||||
|
||||
# The address a scraper has to hold a token for. Same `behindGateway`
|
||||
# guard, and for a stronger reason than the two above: with it off
|
||||
# there is no `= /metrics` location and no `auth_request` in front of
|
||||
# it, so the URL this names does not exist to be authorised.
|
||||
# The metrics endpoint, declared once: the collector both scrapes this
|
||||
# URL and derives from it the audience its token is minted for. Same
|
||||
# `behindGateway` guard, and for a stronger reason than the two above:
|
||||
# with it off there is no `= /metrics` location and no `auth_request`
|
||||
# in front of it, so the URL this names does not exist to be scraped
|
||||
# or authorised.
|
||||
#
|
||||
# ⚠️ Written as the exact URL a collector requests, because that is
|
||||
# what authelia compares against — this string agreeing with the
|
||||
# `location` block above it is the whole mechanism. A near miss is a
|
||||
# correctly minted token refused at the target.
|
||||
services.hyperhive.swarm.otel.collectorAudiences =
|
||||
lib.optional cfg.behindGateway "https://${cfg.domain}/metrics";
|
||||
services.hyperhive.swarm.otel.publishedScrapeTargets = lib.optionalAttrs cfg.behindGateway {
|
||||
forgejo = "https://${cfg.domain}/metrics";
|
||||
};
|
||||
|
||||
# `server_name = forge.domain`, proxies all `/` → forgejo. Tuned for
|
||||
# git: `client_max_body_size 1G`, `proxy_read_timeout 1h` (multi-GB
|
||||
|
|
|
|||
Loading…
Reference in a new issue