aboutsummaryrefslogtreecommitdiffstats
path: root/routing-generator
diff options
context:
space:
mode:
authorOla Aunronning <olaa@yahooinc.com>2023-01-05 11:15:00 +0100
committerOla Aunronning <olaa@yahooinc.com>2023-01-05 11:15:00 +0100
commitcea8c9fc79badebf4b39725a94cfa806ec774872 (patch)
treeab8c2eefaa3754dbc692f016c8e72e60b571a21c /routing-generator
parentd55b87ad157b8e8c4597bf8800edbae8254b7c00 (diff)
Add routing config reload metric
Diffstat (limited to 'routing-generator')
-rw-r--r--routing-generator/src/main/java/com/yahoo/vespa/hosted/routing/nginx/NginxMetricsReporter.java4
1 files changed, 4 insertions, 0 deletions
diff --git a/routing-generator/src/main/java/com/yahoo/vespa/hosted/routing/nginx/NginxMetricsReporter.java b/routing-generator/src/main/java/com/yahoo/vespa/hosted/routing/nginx/NginxMetricsReporter.java
index b9ab1dbe9b6..e5727955005 100644
--- a/routing-generator/src/main/java/com/yahoo/vespa/hosted/routing/nginx/NginxMetricsReporter.java
+++ b/routing-generator/src/main/java/com/yahoo/vespa/hosted/routing/nginx/NginxMetricsReporter.java
@@ -48,6 +48,7 @@ public class NginxMetricsReporter extends AbstractComponent implements Runnable
static final String UPSTREAM_DOWN_METRIC = "nginx.upstreams.down";
static final String UPSTREAM_UNKNOWN_METRIC = "nginx.upstreams.unknown";
static final String CONFIG_AGE_METRIC = "upstreams_configuration_age";
+ static final String CONFIG_RELOAD_TIME = "upstreams_configuration_reload_time";
private final Metric metric;
private final HealthStatus healthStatus;
@@ -85,11 +86,14 @@ public class NginxMetricsReporter extends AbstractComponent implements Runnable
Optional<Instant> temporaryConfigModified = lastModified(temporaryNginxConfiguration);
if (temporaryConfigModified.isEmpty()) {
metric.set(CONFIG_AGE_METRIC, 0, metric.createContext(Map.of()));
+ metric.set(CONFIG_RELOAD_TIME, 0, metric.createContext(Map.of()));
return;
}
Instant configModified = lastModified(nginxConfiguration).orElse(Instant.EPOCH);
long secondsDiff = Math.abs(Duration.between(configModified, temporaryConfigModified.get()).toSeconds());
+ long reloadTime = Math.abs(Duration.between(temporaryConfigModified.get(), Instant.now()).toSeconds());
metric.set(CONFIG_AGE_METRIC, secondsDiff, metric.createContext(Map.of()));
+ metric.set(CONFIG_RELOAD_TIME, reloadTime, metric.createContext(Map.of()));
}
private void reportHealth(RoutingTable table) {