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.
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: set
GOIABADA_AUTHSERVER_METRICS_ENABLEDtotrueon the auth server andGOIABADA_ADMINCONSOLE_METRICS_ENABLEDtotrueon the admin console, and restart them. On Kubernetes, also give each container itsmetricsport, as A manifest generated without metrics shows, or run the setup wizard again with metrics on and compare. -
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}'Add them under the PodMonitor’s
metadata.labels, or answer the setup wizard’s labels question with them. 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, change the
kubernetes.io/metadata.namein the second rule of bothgoiabada-authserverandgoiabada-adminconsoleNetworkPolicies to it, or run the setup wizard again with the right namespace.
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.