From 54435a358b45ced82913004796c93e2e96637343 Mon Sep 17 00:00:00 2001 From: Vladislav Sukhin Date: Tue, 26 Mar 2024 17:18:24 +0300 Subject: [PATCH] fix: use summary metric --- internal/app/api/metrics/metrics.go | 18 ++++++++++-------- 1 file changed, 10 insertions(+), 8 deletions(-) diff --git a/internal/app/api/metrics/metrics.go b/internal/app/api/metrics/metrics.go index ddb2b71c471..d479be2b93c 100644 --- a/internal/app/api/metrics/metrics.go +++ b/internal/app/api/metrics/metrics.go @@ -16,9 +16,10 @@ var testExecutionsCount = promauto.NewCounterVec(prometheus.CounterOpts{ Help: "The total number of test executions", }, []string{"type", "name", "result", "labels", "test_uri"}) -var testExecutionsDurationMs = promauto.NewHistogramVec(prometheus.HistogramOpts{ - Name: "testkube_test_executions_duration_ms", - Help: "The duration of test executions", +var testExecutionsDurationMs = promauto.NewSummaryVec(prometheus.SummaryOpts{ + Name: "testkube_test_executions_duration_ms", + Help: "The duration of test executions", + Objectives: map[float64]float64{0.5: 0.05, 0.9: 0.01, 0.95: 0.005, 0.99: 0.001}, }, []string{"type", "name", "result", "labels", "test_uri"}) var testSuiteExecutionsCount = promauto.NewCounterVec(prometheus.CounterOpts{ @@ -26,9 +27,10 @@ var testSuiteExecutionsCount = promauto.NewCounterVec(prometheus.CounterOpts{ Help: "The total number of test suite executions", }, []string{"name", "result", "labels", "testsuite_uri"}) -var testSuiteExecutionsDurationMs = promauto.NewHistogramVec(prometheus.HistogramOpts{ - Name: "testkube_testsuite_executions_duration_ms", - Help: "The duration of test suite executions", +var testSuiteExecutionsDurationMs = promauto.NewSummaryVec(prometheus.SummaryOpts{ + Name: "testkube_testsuite_executions_duration_ms", + Help: "The duration of test suite executions", + Objectives: map[float64]float64{0.5: 0.05, 0.9: 0.01, 0.95: 0.005, 0.99: 0.001}, }, []string{"name", "result", "labels", "testsuite_uri"}) var testCreationCount = promauto.NewCounterVec(prometheus.CounterOpts{ @@ -138,9 +140,9 @@ func NewMetrics() Metrics { type Metrics struct { TestExecutionsCount *prometheus.CounterVec - TestExecutionsDurationMs *prometheus.HistogramVec + TestExecutionsDurationMs *prometheus.SummaryVec TestSuiteExecutionsCount *prometheus.CounterVec - TestSuiteExecutionsDurationMs *prometheus.HistogramVec + TestSuiteExecutionsDurationMs *prometheus.SummaryVec TestCreations *prometheus.CounterVec TestSuiteCreations *prometheus.CounterVec TestUpdates *prometheus.CounterVec