From 6a1aab88fd1873de8bcc26886ec2b19f2de785a3 Mon Sep 17 00:00:00 2001 From: Aliaksandr Valialkin Date: Fri, 28 Feb 2020 20:19:35 +0200 Subject: [PATCH] lib/protoparser: metrics renaming: `vm_protoparser__*` -> `vm_protoparser_*{type=""}` This should improve composability of these metrics in PromQL queries --- lib/protoparser/graphite/streamparser.go | 6 +++--- lib/protoparser/influx/streamparser.go | 6 +++--- lib/protoparser/opentsdb/streamparser.go | 6 +++--- lib/protoparser/opentsdbhttp/streamparser.go | 8 ++++---- lib/protoparser/promremotewrite/streamparser.go | 8 ++++---- lib/protoparser/vmimport/streamparser.go | 6 +++--- 6 files changed, 20 insertions(+), 20 deletions(-) diff --git a/lib/protoparser/graphite/streamparser.go b/lib/protoparser/graphite/streamparser.go index a79d5a20eb..faf6069b5f 100644 --- a/lib/protoparser/graphite/streamparser.go +++ b/lib/protoparser/graphite/streamparser.go @@ -100,9 +100,9 @@ func (ctx *streamContext) reset() { } var ( - readCalls = metrics.NewCounter(`vm_protoparser_graphite_read_calls_total`) - readErrors = metrics.NewCounter(`vm_protoparser_graphite_read_errors_total`) - rowsRead = metrics.NewCounter(`vm_protoparser_graphite_rows_read_total`) + readCalls = metrics.NewCounter(`vm_protoparser_read_calls_total{type="graphite"}`) + readErrors = metrics.NewCounter(`vm_protoparser_read_errors_total{type="graphite"}`) + rowsRead = metrics.NewCounter(`vm_protoparser_rows_read_total{type="graphite"}`) ) func getStreamContext() *streamContext { diff --git a/lib/protoparser/influx/streamparser.go b/lib/protoparser/influx/streamparser.go index c09976d175..7e4482daf7 100644 --- a/lib/protoparser/influx/streamparser.go +++ b/lib/protoparser/influx/streamparser.go @@ -97,9 +97,9 @@ func (ctx *streamContext) Read(r io.Reader, tsMultiplier int64) bool { } var ( - readCalls = metrics.NewCounter(`vm_protoparser_influx_read_calls_total`) - readErrors = metrics.NewCounter(`vm_protoparser_influx_read_errors_total`) - rowsRead = metrics.NewCounter(`vm_protoparser_influx_rows_read_total`) + readCalls = metrics.NewCounter(`vm_protoparser_read_calls_total{type="influx"}`) + readErrors = metrics.NewCounter(`vm_protoparser_read_errors_total{type="influx"}`) + rowsRead = metrics.NewCounter(`vm_protoparser_rows_read_total{type="influx"}`) ) type streamContext struct { diff --git a/lib/protoparser/opentsdb/streamparser.go b/lib/protoparser/opentsdb/streamparser.go index 0b356147fa..f5bdf844d8 100644 --- a/lib/protoparser/opentsdb/streamparser.go +++ b/lib/protoparser/opentsdb/streamparser.go @@ -98,9 +98,9 @@ func (ctx *streamContext) reset() { } var ( - readCalls = metrics.NewCounter(`vm_protoparser_opentsdb_read_calls_total`) - readErrors = metrics.NewCounter(`vm_protoparser_opentsdb_read_errors_total`) - rowsRead = metrics.NewCounter(`vm_protoparser_opentsdb_rows_read_total`) + readCalls = metrics.NewCounter(`vm_protoparser_read_calls_total{type="opentsdb"}`) + readErrors = metrics.NewCounter(`vm_protoparser_read_errors_total{type="opentsdb"}`) + rowsRead = metrics.NewCounter(`vm_protoparser_rows_read_total{type="opentsdb"}`) ) func getStreamContext() *streamContext { diff --git a/lib/protoparser/opentsdbhttp/streamparser.go b/lib/protoparser/opentsdbhttp/streamparser.go index 61f942ca32..f3c18c72ff 100644 --- a/lib/protoparser/opentsdbhttp/streamparser.go +++ b/lib/protoparser/opentsdbhttp/streamparser.go @@ -96,10 +96,10 @@ func (ctx *streamContext) reset() { } var ( - readCalls = metrics.NewCounter(`vm_protoparser_opentsdbhttp_read_calls_total`) - readErrors = metrics.NewCounter(`vm_protoparser_opentsdbhttp_read_errors_total`) - rowsRead = metrics.NewCounter(`vm_protoparser_opentsdbhttp_rows_read_total`) - unmarshalErrors = metrics.NewCounter(`vm_protoparser_opentsdbhttp_unmarshal_errors_total`) + readCalls = metrics.NewCounter(`vm_protoparser_read_calls_total{type="opentsdbhttp"}`) + readErrors = metrics.NewCounter(`vm_protoparser_read_errors_total{type="opentsdbhttp"}`) + rowsRead = metrics.NewCounter(`vm_protoparser_rows_read_total{type="opentsdbhttp"}`) + unmarshalErrors = metrics.NewCounter(`vm_protoparser_unmarshal_errors_total{type="opentsdbhttp"}`) ) func getStreamContext() *streamContext { diff --git a/lib/protoparser/promremotewrite/streamparser.go b/lib/protoparser/promremotewrite/streamparser.go index e3576b4c53..af8b593a98 100644 --- a/lib/protoparser/promremotewrite/streamparser.go +++ b/lib/protoparser/promremotewrite/streamparser.go @@ -62,10 +62,10 @@ func (ctx *pushCtx) Read(r *http.Request) error { } var ( - readCalls = metrics.NewCounter(`vm_protoparser_promremotewrite_read_calls_total`) - readErrors = metrics.NewCounter(`vm_protoparser_promremotewrite_read_errors_total`) - rowsRead = metrics.NewCounter(`vm_protoparser_promremotewrite_rows_read_total`) - unmarshalErrors = metrics.NewCounter(`vm_protoparser_promremotewrite_unmarshal_errors`) + readCalls = metrics.NewCounter(`vm_protoparser_read_calls_total{type="promremotewrite"}`) + readErrors = metrics.NewCounter(`vm_protoparser_read_errors_total{type="promremotewrite"}`) + rowsRead = metrics.NewCounter(`vm_protoparser_rows_read_total{type="promremotewrite"}`) + unmarshalErrors = metrics.NewCounter(`vm_protoparser_unmarshal_errors{type="promremotewrite"}`) ) func getPushCtx() *pushCtx { diff --git a/lib/protoparser/vmimport/streamparser.go b/lib/protoparser/vmimport/streamparser.go index aef23624e7..77d0ff84ac 100644 --- a/lib/protoparser/vmimport/streamparser.go +++ b/lib/protoparser/vmimport/streamparser.go @@ -60,9 +60,9 @@ func (ctx *streamContext) Read(r io.Reader) bool { } var ( - readCalls = metrics.NewCounter(`vm_protoparser_vmimport_read_calls_total`) - readErrors = metrics.NewCounter(`vm_protoparser_vmimport_read_errors_total`) - rowsRead = metrics.NewCounter(`vm_protoparser_vmimport_rows_read_total`) + readCalls = metrics.NewCounter(`vm_protoparser_read_calls_total{type="vmimport"}`) + readErrors = metrics.NewCounter(`vm_protoparser_read_errors_total{type="vmimport"}`) + rowsRead = metrics.NewCounter(`vm_protoparser_rows_read_total{type="vmimport"}`) ) type streamContext struct {