From 8389939f1817ec161b0ba67ac5521e84fda169c6 Mon Sep 17 00:00:00 2001 From: "Philippe M. Chiasson" Date: Wed, 25 Jan 2023 21:24:41 -0500 Subject: [PATCH 1/2] Add external_dns_controller_last_reconcile_timestamp_seconds metric --- controller/controller.go | 12 ++++++++++++ docs/faq.md | 1 + 2 files changed, 13 insertions(+) diff --git a/controller/controller.go b/controller/controller.go index 528d870faa..f3913333a9 100644 --- a/controller/controller.go +++ b/controller/controller.go @@ -72,6 +72,14 @@ var ( Help: "Timestamp of last successful sync with the DNS provider", }, ) + lastReconcileTimestamp = prometheus.NewGauge( + prometheus.GaugeOpts{ + Namespace: "external_dns", + Subsystem: "controller", + Name: "last_reconcile_timestamp_seconds", + Help: "Timestamp of last attempted sync with the DNS provider", + }, + ) controllerNoChangesTotal = prometheus.NewCounter( prometheus.CounterOpts{ Namespace: "external_dns", @@ -126,6 +134,7 @@ func init() { prometheus.MustRegister(sourceEndpointsTotal) prometheus.MustRegister(registryEndpointsTotal) prometheus.MustRegister(lastSyncTimestamp) + prometheus.MustRegister(lastReconcileTimestamp) prometheus.MustRegister(deprecatedRegistryErrors) prometheus.MustRegister(deprecatedSourceErrors) prometheus.MustRegister(controllerNoChangesTotal) @@ -161,6 +170,8 @@ type Controller struct { // RunOnce runs a single iteration of a reconciliation loop. func (c *Controller) RunOnce(ctx context.Context) error { + lastReconcileTimestamp.SetToCurrentTime() + records, err := c.Registry.Records(ctx) if err != nil { registryErrorsTotal.Inc() @@ -235,6 +246,7 @@ func (c *Controller) RunOnce(ctx context.Context) error { } lastSyncTimestamp.SetToCurrentTime() + return nil } diff --git a/docs/faq.md b/docs/faq.md index 703669680f..043f1f686d 100644 --- a/docs/faq.md +++ b/docs/faq.md @@ -181,6 +181,7 @@ Here is the full list of available metrics provided by ExternalDNS: | Name | Description | Type | | --------------------------------------------------- | ------------------------------------------------------- | ------- | | external_dns_controller_last_sync_timestamp_seconds | Timestamp of last successful sync with the DNS provider | Gauge | +| external_dns_controller_last_reconcile_timestamp_seconds | Timestamp of last attempted sync with the DNS provider | Gauge | | external_dns_registry_endpoints_total | Number of Endpoints in all sources | Gauge | | external_dns_registry_errors_total | Number of Registry errors | Counter | | external_dns_source_endpoints_total | Number of Endpoints in the registry | Gauge | From 786cd5da510258977a7bb78d80de74b8cacf3e2c Mon Sep 17 00:00:00 2001 From: "Philippe M. Chiasson" Date: Wed, 25 Jan 2023 21:25:34 -0500 Subject: [PATCH 2/2] Fix table indentation --- docs/faq.md | 22 +++++++++++----------- 1 file changed, 11 insertions(+), 11 deletions(-) diff --git a/docs/faq.md b/docs/faq.md index 043f1f686d..3a763eaada 100644 --- a/docs/faq.md +++ b/docs/faq.md @@ -178,18 +178,18 @@ You can use the host label in the metric to figure out if the request was agains Here is the full list of available metrics provided by ExternalDNS: -| Name | Description | Type | -| --------------------------------------------------- | ------------------------------------------------------- | ------- | -| external_dns_controller_last_sync_timestamp_seconds | Timestamp of last successful sync with the DNS provider | Gauge | +| Name | Description | Type | +| -------------------------------------------------------- | ------------------------------------------------------- | ------- | +| external_dns_controller_last_sync_timestamp_seconds | Timestamp of last successful sync with the DNS provider | Gauge | | external_dns_controller_last_reconcile_timestamp_seconds | Timestamp of last attempted sync with the DNS provider | Gauge | -| external_dns_registry_endpoints_total | Number of Endpoints in all sources | Gauge | -| external_dns_registry_errors_total | Number of Registry errors | Counter | -| external_dns_source_endpoints_total | Number of Endpoints in the registry | Gauge | -| external_dns_source_errors_total | Number of Source errors | Counter | -| external_dns_controller_verified_records | Number of DNS A-records that exists both in | Gauge | -| | source & registry | | -| external_dns_registry_a_records | Number of A records in registry | Gauge | -| external_dns_source_a_records | Number of A records in source | Gauge | +| external_dns_registry_endpoints_total | Number of Endpoints in all sources | Gauge | +| external_dns_registry_errors_total | Number of Registry errors | Counter | +| external_dns_source_endpoints_total | Number of Endpoints in the registry | Gauge | +| external_dns_source_errors_total | Number of Source errors | Counter | +| external_dns_controller_verified_records | Number of DNS A-records that exists both in | Gauge | +| | source & registry | | +| external_dns_registry_a_records | Number of A records in registry | Gauge | +| external_dns_source_a_records | Number of A records in source | Gauge | ### How can I run ExternalDNS under a specific GCP Service Account, e.g. to access DNS records in other projects?