Metrics are not scraped
This page helps you when your scraper doesn’t collect Goiabada’s metrics.
What you see
Section titled “What you see”One of these:
- Goiabada isn’t among the scraper’s targets, and no
goiabada_series exist. - The targets are there, but down: Prometheus’s
upis0for them, with a connection refused, a timeout or a404as the error.
Why it happens
Section titled “Why it happens”Each server serves its metrics on a listener of its own, GET /metrics on port 9190 for the auth server and 9191 for the admin console, and the listener is off until you turn it on. Most failures are one of these:
- The listener is off. Every start writes a
metrics listener configurationrecord withenabled, and only an enabled listener writesstarting the metrics listener. The Docker Compose files and the native env file the setup wizard writes leave both off, and so does a Kubernetes manifest generated without metrics. - The scraper calls the wrong port or path. Any path but
/metricsanswers404, and the application’s own port, 9090 or 9091, serves no metrics. - The listener only listens on
127.0.0.1, becauseGOIABADA_AUTHSERVER_LISTEN_HOST_METRICSorGOIABADA_ADMINCONSOLE_LISTEN_HOST_METRICSsays so, and the scraper runs elsewhere. - The scraper doesn’t read what the manifest gives it. kube-prometheus-stack ignores the
prometheus.io/scrapepod annotations and scrapes only what a PodMonitor or ServiceMonitor names. The prometheus-communityprometheuschart reads the annotations. - No Prometheus selects the PodMonitor. A Prometheus the Prometheus Operator runs scrapes only the PodMonitors its
podMonitorSelectormatches, in the namespaces itspodMonitorNamespaceSelectormatches. kube-prometheus-stack, by default, only those labeledrelease: <its release name>. - A NetworkPolicy refuses the scraper. With the generated NetworkPolicies, only the namespace you named for the scraper,
monitoringunless you named another, reaches the metrics ports. A scraper in a service mesh that delivers on a port of its own, such as Istio’s ambient mode or Linkerd, arrives on that port instead, which they don’t admit: see Who can reach Goiabada. - Istio’s sidecars moved the annotations to their own port, 15020, which the generated NetworkPolicies refuse: see Pod annotations.
Fix it
Section titled “Fix it”-
Check the listener answers, from beside the server. On Kubernetes:
Terminal window kubectl port-forward -n goiabada deploy/goiabada-authserver 9190:9190curl -s http://localhost:9190/metrics | grep goiabada_build_infoWith Docker Compose, from a container on the Compose network,
curl -s http://goiabada-authserver:9190/metrics.If nothing answers, turn the listener on. On Kubernetes, write the manifest again with metrics on, and apply it. With Docker Compose or native binaries, set
GOIABADA_AUTHSERVER_METRICS_ENABLEDandGOIABADA_ADMINCONSOLE_METRICS_ENABLEDtotrue, in the override orgoiabada.env, and restart both servers. -
If the listener answers but the scraper can’t reach it, check the listen host. Leave
GOIABADA_AUTHSERVER_LISTEN_HOST_METRICSandGOIABADA_ADMINCONSOLE_LISTEN_HOST_METRICSunset, which listens on every address, unless the scraper runs on the same host. -
On Kubernetes, match the manifest to what scrapes your cluster. For kube-prometheus-stack, or any Prometheus the Operator runs, use a PodMonitor and give it the labels your Prometheus selects by:
Terminal window kubectl get prometheus -A -o jsonpath='{..podMonitorSelector}'Write the manifest again with them,
--podmonitor-labels, and apply it. For the prometheus-community chart, use the pod annotations. For Grafana Alloy or the OpenTelemetry Collector, keep the targets on themetricscontainer port and let the scraper’s service account list and watch pods in thegoiabadanamespace. -
With the NetworkPolicies on, check the namespace your scraper’s pods actually run in:
Terminal window kubectl get pods -A | grep -i -e prometheus -e alloy -e collectorIf it isn’t the one the policies admit, write the manifest again with
--metrics-namespaceset to it, and apply it.
The metrics listener
Section titled “The metrics listener”The metrics listener answers only GET /metrics, and isn’t part of the application’s routes. A scrape is neither logged nor counted in the request metrics, so the server’s own logs don’t show your scraper’s attempts. A port it can’t bind stops the server at start, as the other listeners’ do.
Alert on the scrape itself failing, Prometheus’s up at 0 for Goiabada’s targets, so a broken scrape doesn’t go unnoticed.