swarm-otel: scrape grafana through its published name
Grafana's own metrics were scraped over loopback through the `grafana-metrics` nginx vhost, declared only where grafana and the collector share a host, so a collector on any other host had no job for it. Its target is now declared on every host as `https://<swarm.grafana.domain>/metrics`, next to the other published targets, and grafana's vhost serves `= /metrics` behind the collector's auth subrequest (`/__grafana_metrics_authz`, the forge's shape). The rules derived from `publishedScrapeTargets` admit the collector's client there and deny every other subject. The loopback scrape is gone with the vhost that served it and its `swarm.grafana.metricsPort` option, so a single host still scrapes grafana once, now by name. A config that sets that option now fails evaluation with "option does not exist". On the published vhost `/metrics` was answered with 403 for everyone. It now answers the collector's token, and a plain session gets authelia's `deny`. The design note that ruled the published vhost out for scraping predates the collector's credential; it is replaced by the location's own comment and a line on `swarm.grafana.domain`. Part of #5205
This commit is contained in:
parent
6f071f7963
commit
54f6061d41
7 changed files with 145 additions and 99 deletions
|
|
@ -138,16 +138,15 @@ let
|
|||
&& !(refusedOver bare "deploy.forgejo.sso.clientSecretFile");
|
||||
}
|
||||
{
|
||||
# Authelia is a published target; ./swarm-otel-identity.nix covers it.
|
||||
name = "a host running the collector, authelia, grafana and nats scrapes grafana and nats on loopback, authelia not";
|
||||
# Authelia and grafana are published targets; ./swarm-otel-identity.nix
|
||||
# covers them.
|
||||
name = "a host running the collector, authelia, grafana and nats scrapes nats on loopback, authelia and grafana not";
|
||||
ok =
|
||||
let
|
||||
t = servicesHere.services.hyperhive.swarm.otel.scrapeTargets;
|
||||
port = n: toString servicesHere.services.hyperhive.swarm.${n}.metricsPort;
|
||||
in
|
||||
t.grafana == "127.0.0.1:${port "grafana"}"
|
||||
&& t.nats == "127.0.0.1:${port "nats"}"
|
||||
&& !(t ? authelia);
|
||||
t.nats == "127.0.0.1:${port "nats"}" && !(t ? authelia) && !(t ? grafana);
|
||||
}
|
||||
{
|
||||
name = "hosting the swarm's shared services runs the forge";
|
||||
|
|
|
|||
Loading…
Reference in a new issue