From 980c3bafa2ea01b8e2da9a283953ead08b6a682d Mon Sep 17 00:00:00 2001 From: Nadia Santalla Date: Wed, 15 Jan 2025 13:32:14 +0100 Subject: [PATCH] create `http_version` metric --- output.go | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/output.go b/output.go index 4ec57d1..173b40f 100644 --- a/output.go +++ b/output.go @@ -231,6 +231,18 @@ func (ms *metricStore) DeriveMetrics() { log.Debugf("Created %q from %q", statusCodeTS.name, ts.name) }() + func() { + strCode, _ := ts.tags.Get("proto") + newValue, _ := strconv.ParseFloat(strings.TrimPrefix(strCode, "HTTP/"), 32) + httpVersionTS := timeseries{ + name: "http_version", + metricType: metrics.Gauge, + tags: ts.tags, + } + ms.store[httpVersionTS] = value{newValue, 1} + log.Debugf("Created %q from %q", httpVersionTS.name, ts.name) + }() + // Rename to http_requests_failed_total case "http_req_failed": newTS := ts