From e9a657e89534aebb85e8842cb0fbc6c71da506d4 Mon Sep 17 00:00:00 2001 From: Vasiliy Tolstov Date: Fri, 23 Jul 2021 08:59:50 +0300 Subject: [PATCH] fast path for labels Signed-off-by: Vasiliy Tolstov --- victoriametrics.go | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/victoriametrics.go b/victoriametrics.go index fc7b938..4cc5c8e 100644 --- a/victoriametrics.go +++ b/victoriametrics.go @@ -25,6 +25,11 @@ func (r *victoriametricsMeter) buildName(name string, labels ...string) string { if len(r.opts.MetricPrefix) > 0 { name = r.opts.MetricPrefix + name } + + if len(labels) == 0 { + return name + } + if len(r.opts.LabelPrefix) == 0 { return meter.BuildName(name, labels...) }