Repository navigation
Description
Describe the bug
The pingsource-mt-adapter Deployment names container port 9090 metrics, but the adapter serves Prometheus metrics on 9092. A PodMonitor or scrape config that uses the metrics port gets connection refused.
- The adapter sets up metrics with
otel.SetupObservabilityOrDie, which defaults to port 9092 (DefaultMetricsPortinpkg/observability/config.go). See fix: metrics with prometheus default to same port as before #8669 and the closing comment on Restore component-specific default metrics ports #8889. - Fix ApiServerSource metrics port to 9092 #8895 fixed the same mismatch for the ApiServerSource adapter, but not for this Deployment.
- The
ping-sourcejob inconfig/monitoring/metrics/prometheus/100-prometheus-scrape-kn-eventing.yamlalso picks the port by the namemetrics, so it scrapes 9090 too.
Expected behavior
The port named metrics is the port the adapter serves metrics on.
To Reproduce
Set metrics-protocol: prometheus in config-observability and create any PingSource (the adapter has 0 replicas until one exists; if it is already running, restart it, since it reads config-observability only at startup). Then:
kubectl -n knative-eventing get deploy pingsource-mt-adapter \
-o jsonpath='{.spec.template.spec.containers[0].ports}'
kubectl -n knative-eventing port-forward deploy/pingsource-mt-adapter 9090 9092 &
sleep 2
curl -s -o /dev/null -w '%{http_code}\n' localhost:9092/metrics # 200
curl -s -o /dev/null -w '%{http_code}\n' localhost:9090/metrics # 000; port-forward logs "connection refused" and exitsWith the Prometheus Operator, this PodMonitor shows the target as down with dial tcp <pod-ip>:9090: connect: connection refused:
apiVersion: monitoring.coreos.com/v1
kind: PodMonitor
metadata:
name: pingsource-mt-adapter
namespace: knative-eventing
spec:
selector:
matchLabels:
eventing.knative.dev/source: ping-source-controller
sources.knative.dev/role: adapter
podMetricsEndpoints:
- port: metricsKnative release version
1.24.0, and main. The mismatch started in 1.19.1 and 1.20.0. In 1.18 the adapter served on 9090.
Additional context
The other components that serve on 9092 (mt-broker-ingress, mt-broker-filter, job-sink, the ApiServerSource adapter) already declare 9092. The same mismatch was reported in 2022 (#6509) and fixed then by serving on 9090 (#6615).
Metadata
Metadata
Assignees
Labels
Type
Projects
- StatusShow more project fieldsBacklog
Activity