pkg/operator/genevalogging: scrape OTel self-telemetry and alert on silence - #4983
pkg/operator/genevalogging: scrape OTel self-telemetry and alert on silence#4983ventifus wants to merge 1 commit into
Conversation
There was a problem hiding this comment.
Pull request overview
This PR enhances the Geneva logging operator’s OTel exporter deployment so cluster Prometheus can scrape OTel Collector self-telemetry metrics and an SRE alert can detect DaemonSet pods that are down or have stopped exporting logs.
Changes:
- Expose OTel Collector self-telemetry metrics via a Prometheus pull reader on
0.0.0.0:8888and add ametricscontainer port. - Integrate with OpenShift cluster monitoring: label the namespace, add RBAC for
prometheus-k8s, and create aPodMonitorto scrape both exporter DaemonSets. - Add a
PrometheusRulecontaining theOTelExporterNoLogsShippedSREalert.
Reviewed changes
Copilot reviewed 4 out of 4 changed files in this pull request and generated 2 comments.
| File | Description |
|---|---|
| pkg/operator/controllers/genevalogging/staticfiles/otel-config.yaml.tmpl | Adds OTel Collector self-telemetry metrics configuration with a Prometheus pull reader (host/port 8888). |
| pkg/operator/controllers/genevalogging/genevalogging.go | Adds namespace monitoring label, RBAC, PodMonitor, PrometheusRule, and exposes the metrics container port. |
| pkg/operator/controllers/genevalogging/genevalogging_test.go | Extends unit tests to validate the new monitoring resources and metrics port/config expectations. |
| pkg/operator/controllers/genevalogging/genevalogging_controller.go | Updates controller ownership to include the new monitoring and RBAC resources. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
6e6d884 to
431e318
Compare
431e318 to
e0bf3b9
Compare
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 4 out of 4 changed files in this pull request and generated 1 comment.
Comments suppressed due to low confidence (1)
pkg/operator/controllers/genevalogging/genevalogging.go:188
- The alert is configured with
For: "10m", which delays firing in all cases (includingup != 1). This contradicts the PR description claim that scrape/down failures fire immediately. If the intent is immediate alerting on down/crashloop while still waiting 1h for silence, remove theForclause (the 1hrate()window already gates the silence case).
Alert: "OTelExporterNoLogsShippedSRE",
For: "10m",
Expr: intstr.FromString(
e0bf3b9 to
7ade5b7
Compare
|
/azp run ci |
|
Azure Pipelines: Successfully started running 1 pipeline(s). |
jaitaiwan
left a comment
There was a problem hiding this comment.
Ex-AROer... Was pinged by this repo; got bored so here's some nits 👍 LGTM otherwise
7ade5b7 to
1b9a157
Compare
|
/azp run ci |
|
Azure Pipelines: Successfully started running 1 pipeline(s). |
1b9a157 to
7401c21
Compare
7401c21 to
830820e
Compare
|
Please rebase pull request. |
830820e to
7a1c94d
Compare
7a1c94d to
cfd177e
Compare
Fixes ARO-28161
What this does
Enables Prometheus scraping of OTel exporter self-telemetry and adds an SRE alert for pods that stop shipping logs.
Metrics endpoint
Adds
service.telemetry.metricsto the OTel config, exposing self-telemetry on0.0.0.0:8888via a Prometheus pull reader. This uses thereadersconfig introduced in OTel Collector v0.30+; the legacyaddressfield is no longer valid.A
metricscontainer port (8888) is added to both DaemonSet specs.Cluster Prometheus integration
openshift-azure-loggingwithopenshift.io/cluster-monitoring: "true"so the cluster Prometheus evaluates rules from the namespace.RoleandRoleBindinggrantingprometheus-k8s(inopenshift-monitoring) read access to services, endpoints, and pods inopenshift-azure-logging.PodMonitortargeting both OTel exporter DaemonSets on themetricsport. Relabels__meta_kubernetes_pod_node_nameasnodeon each scraped series.Alert
Adds
PrometheusRule/otel-exporter-alertswith a single critical alert:OTelExporterNoLogsShippedSRE.Fires for any OTel exporter pod that is NOT both scrapeable and actively exporting logs. The
For: "10m"pending duration suppresses transient firing during pod restarts.Effective timing by failure mode:
up != 1): alert fires after 10 minutes.rate == 0): alert fires after the 1h rate window drains plus the 10-minute For — roughly 1h10m after exporting stops.The
namespacelabel in the selectors is not present in the raw OTel metric; Prometheus adds it at scrape time via Kubernetes service discovery.Verified
Manually tested on a dev cluster. Confirmed
OTelExporterNoLogsShippedSREfires when a pod enters CrashLoopBackOff and resolves when the pod recovers.