From c4f924cfb5cc7fc078cfa6f29f43c22a66cacf72 Mon Sep 17 00:00:00 2001 From: "Alex Ellis (OpenFaaS Ltd)" Date: Thu, 12 Mar 2020 13:47:32 +0000 Subject: [PATCH] Update Started variable to GatewayFunctionInvocationStarted Signed-off-by: Alex Ellis (OpenFaaS Ltd) --- gateway/handlers/notifiers.go | 2 +- gateway/metrics/exporter.go | 4 ++-- gateway/metrics/metrics.go | 22 +++++++++++----------- 3 files changed, 14 insertions(+), 14 deletions(-) diff --git a/gateway/handlers/notifiers.go b/gateway/handlers/notifiers.go index 3bf0ae69..ce581cf5 100644 --- a/gateway/handlers/notifiers.go +++ b/gateway/handlers/notifiers.go @@ -63,7 +63,7 @@ func (p PrometheusFunctionNotifier) Notify(method string, URL string, originalUR Inc() } else if event == "started" { serviceName := getServiceName(originalURL) - p.Metrics.StartedCounter.WithLabelValues(serviceName).Inc() + p.Metrics.GatewayFunctionInvocationStarted.WithLabelValues(serviceName).Inc() } } diff --git a/gateway/metrics/exporter.go b/gateway/metrics/exporter.go index 8adbfab8..d784209d 100644 --- a/gateway/metrics/exporter.go +++ b/gateway/metrics/exporter.go @@ -41,7 +41,7 @@ func (e *Exporter) Describe(ch chan<- *prometheus.Desc) { e.metricOptions.GatewayFunctionInvocation.Describe(ch) e.metricOptions.GatewayFunctionsHistogram.Describe(ch) e.metricOptions.ServiceReplicasGauge.Describe(ch) - e.metricOptions.StartedCounter.Describe(ch) + e.metricOptions.GatewayFunctionInvocationStarted.Describe(ch) e.metricOptions.ServiceMetrics.Counter.Describe(ch) e.metricOptions.ServiceMetrics.Histogram.Describe(ch) @@ -52,7 +52,7 @@ func (e *Exporter) Collect(ch chan<- prometheus.Metric) { e.metricOptions.GatewayFunctionInvocation.Collect(ch) e.metricOptions.GatewayFunctionsHistogram.Collect(ch) - e.metricOptions.StartedCounter.Collect(ch) + e.metricOptions.GatewayFunctionInvocationStarted.Collect(ch) e.metricOptions.ServiceReplicasGauge.Reset() for _, service := range e.services { diff --git a/gateway/metrics/metrics.go b/gateway/metrics/metrics.go index fc5a763a..5e038d73 100644 --- a/gateway/metrics/metrics.go +++ b/gateway/metrics/metrics.go @@ -13,11 +13,11 @@ import ( // MetricOptions to be used by web handlers type MetricOptions struct { - GatewayFunctionInvocation *prometheus.CounterVec - GatewayFunctionsHistogram *prometheus.HistogramVec - ServiceReplicasGauge *prometheus.GaugeVec - ServiceMetrics *ServiceMetricOptions - StartedCounter *prometheus.CounterVec + GatewayFunctionInvocation *prometheus.CounterVec + GatewayFunctionsHistogram *prometheus.HistogramVec + GatewayFunctionInvocationStarted *prometheus.CounterVec + ServiceReplicasGauge *prometheus.GaugeVec + ServiceMetrics *ServiceMetricOptions } // ServiceMetricOptions provides RED metrics @@ -82,7 +82,7 @@ func BuildMetricsOptions() MetricOptions { []string{"method", "path", "status"}, ) - startedCounter := prometheus.NewCounterVec( + gatewayFunctionInvocationStarted := prometheus.NewCounterVec( prometheus.CounterOpts{ Namespace: "gateway", Subsystem: "function", @@ -98,11 +98,11 @@ func BuildMetricsOptions() MetricOptions { } metricsOptions := MetricOptions{ - GatewayFunctionsHistogram: gatewayFunctionsHistogram, - GatewayFunctionInvocation: gatewayFunctionInvocation, - ServiceReplicasGauge: serviceReplicas, - ServiceMetrics: serviceMetricOptions, - StartedCounter: startedCounter, + GatewayFunctionsHistogram: gatewayFunctionsHistogram, + GatewayFunctionInvocation: gatewayFunctionInvocation, + ServiceReplicasGauge: serviceReplicas, + ServiceMetrics: serviceMetricOptions, + GatewayFunctionInvocationStarted: gatewayFunctionInvocationStarted, } return metricsOptions