janhoy opened a new pull request, #889: URL: https://github.com/apache/solr-operator/pull/889
🤖 AI assisted 🤖 Fixes #690 The operator now exposes metrics about its own work on the existing `/metrics` endpoint, next to the generic controller-runtime, workqueue, client-go and Go runtime metrics. All of them are prefixed `solr_operator_`. Gauges, computed at scrape time from the operator's cache so they reflect exactly what the operator sees and disappear with the resource: `managed_resources` per kind and namespace; `solrcloud_info` (Solr version), `solrcloud_desired_replicas`, `solrcloud_ready_replicas`, `solrcloud_up_to_date_replicas` and `solrcloud_ready` per SolrCloud; `solrcloud_cluster_operations` by operation and running/queued state; `solrbackup_state` (running/succeeded/failed) per SolrBackup; `solrprometheusexporter_ready` per exporter. Counters, incremented by the controllers: `reconciles_total` per resource and result (controller-runtime only counts per controller, this tells which resource); `solrcloud_cluster_operations_total` by operation and completed/failed/paused result; `solrbackup_runs_total` by result; `solr_api_requests_total` per SolrCloud and result. Counter series are removed when the operator sees the resource has been deleted. The reconcile and queue-depth stats asked for in the issue are already covered by `controller_runtime_*` and `workqueue_*`, so the docs point at those instead of duplicating them. The helm chart gets a `prometheus` section mirroring the `solr` chart: `prometheus.scrapeAnnotations.enable` (default `true`, since the operator pods have always carried `prometheus.io/scrape`) now also adds `prometheus.io/port` and `prometheus.io/path`, and `prometheus.podMonitor.*` creates a PodMonitor for the operator pods for a Prometheus Operator setup. The PodMonitor is not gated on CRD detection, so offline rendering works. New docs page `getting-started/operator-metrics.adoc` covers scraping, the metrics reference, the useful generic metrics, multi-replica behaviour and example alert queries. Upgrade note and chart changelog included. ### Testing Unit tests for the counters and the reconciler wrapper, fake-client tests for the collector including read errors, and an envtest spec that registers the collector on the real manager cache like `main.go` does and checks that series appear and disappear with a SolrCloud. `make lint`, `make check-docs` and `make unit-tests` pass. E2E tests were not run. Overlaps with #880 only in `values.yaml` (both add keys under `prometheus`) and the chart changelog. -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: [email protected] For queries about this service, please contact Infrastructure at: [email protected] --------------------------------------------------------------------- To unsubscribe, e-mail: [email protected] For additional commands, e-mail: [email protected]
