From b28b399420d3e90428c8d472290a38274773f78a Mon Sep 17 00:00:00 2001 From: Chris Martin Date: Fri, 12 Jul 2024 14:00:34 +0100 Subject: [PATCH] Expose Metrics Port On Lookout, Fix Units Of Ingestion Rate (#3784) * fix lookout service monitor Signed-off-by: Chris Martin * expose metrics port for lookout, fix lookout ingester message rate Signed-off-by: Chris Martin --------- Signed-off-by: Chris Martin Co-authored-by: Chris Martin --- deployment/lookout-v2/templates/deployment.yaml | 3 +++ internal/lookoutingesterv2/metrics/metrics.go | 6 ++++-- 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/deployment/lookout-v2/templates/deployment.yaml b/deployment/lookout-v2/templates/deployment.yaml index 6aae7ae657b..8e4fdb1d0a9 100644 --- a/deployment/lookout-v2/templates/deployment.yaml +++ b/deployment/lookout-v2/templates/deployment.yaml @@ -53,6 +53,9 @@ spec: protocol: TCP name: pprof {{- end }} + - containerPort: {{ .Values.applicationConfig.metricsPort }} + protocol: TCP + name: metrics volumeMounts: - name: user-config mountPath: /config/application_config.yaml diff --git a/internal/lookoutingesterv2/metrics/metrics.go b/internal/lookoutingesterv2/metrics/metrics.go index 159661bfa52..644ed10bf59 100644 --- a/internal/lookoutingesterv2/metrics/metrics.go +++ b/internal/lookoutingesterv2/metrics/metrics.go @@ -48,13 +48,15 @@ func Get() *Metrics { } func (m *Metrics) RecordAvRowChangeTime(numRows int, duration time.Duration) { - avRowChangeTimeHist.Observe(float64(numRows) / float64(duration.Microseconds()*1000)) + rowsPerMilli := float64(duration.Milliseconds()) / float64(numRows) + avRowChangeTimeHist.Observe(rowsPerMilli) } func (m *Metrics) RecordAvRowChangeTimeByOperation(table string, operation metrics.DBOperation, numRows int, duration time.Duration) { + rowsPerMilli := float64(duration.Milliseconds()) / float64(numRows) avRowChangeTimeByOperationHist. With(map[string]string{"table": table, "operation": string(operation)}). - Observe(float64(numRows) / float64(duration.Microseconds()*1000)) + Observe(rowsPerMilli) } func (m *Metrics) RecordRowsChange(table string, operation metrics.DBOperation, numRows int) {