From 593da3603ec8034478ae550972d57db13670cf83 Mon Sep 17 00:00:00 2001 From: Aliaksandr Valialkin Date: Fri, 30 Sep 2022 07:34:14 +0300 Subject: [PATCH] lib/bytesutil: move InternString() from lib/promscrape/discoverytutils to lib/bytesutil lib/bytesutil is more appropriate place for InternString() function --- lib/{promscrape/discoveryutils => bytesutil}/internstring.go | 2 +- .../discoveryutils => bytesutil}/internstring_test.go | 2 +- .../discoveryutils => bytesutil}/internstring_timing_test.go | 2 +- lib/promscrape/config.go | 5 ++--- 4 files changed, 5 insertions(+), 6 deletions(-) rename lib/{promscrape/discoveryutils => bytesutil}/internstring.go (96%) rename lib/{promscrape/discoveryutils => bytesutil}/internstring_test.go (97%) rename lib/{promscrape/discoveryutils => bytesutil}/internstring_timing_test.go (95%) diff --git a/lib/promscrape/discoveryutils/internstring.go b/lib/bytesutil/internstring.go similarity index 96% rename from lib/promscrape/discoveryutils/internstring.go rename to lib/bytesutil/internstring.go index 42f429d96..9318bc980 100644 --- a/lib/promscrape/discoveryutils/internstring.go +++ b/lib/bytesutil/internstring.go @@ -1,4 +1,4 @@ -package discoveryutils +package bytesutil import ( "sync" diff --git a/lib/promscrape/discoveryutils/internstring_test.go b/lib/bytesutil/internstring_test.go similarity index 97% rename from lib/promscrape/discoveryutils/internstring_test.go rename to lib/bytesutil/internstring_test.go index 9a4b72c3b..8d5630967 100644 --- a/lib/promscrape/discoveryutils/internstring_test.go +++ b/lib/bytesutil/internstring_test.go @@ -1,4 +1,4 @@ -package discoveryutils +package bytesutil import ( "fmt" diff --git a/lib/promscrape/discoveryutils/internstring_timing_test.go b/lib/bytesutil/internstring_timing_test.go similarity index 95% rename from lib/promscrape/discoveryutils/internstring_timing_test.go rename to lib/bytesutil/internstring_timing_test.go index 18877c9a9..d7995542c 100644 --- a/lib/promscrape/discoveryutils/internstring_timing_test.go +++ b/lib/bytesutil/internstring_timing_test.go @@ -1,4 +1,4 @@ -package discoveryutils +package bytesutil import ( "fmt" diff --git a/lib/promscrape/config.go b/lib/promscrape/config.go index d193b4b8f..cd0a179b6 100644 --- a/lib/promscrape/config.go +++ b/lib/promscrape/config.go @@ -34,7 +34,6 @@ import ( "github.com/VictoriaMetrics/VictoriaMetrics/lib/promscrape/discovery/kubernetes" "github.com/VictoriaMetrics/VictoriaMetrics/lib/promscrape/discovery/openstack" "github.com/VictoriaMetrics/VictoriaMetrics/lib/promscrape/discovery/yandexcloud" - "github.com/VictoriaMetrics/VictoriaMetrics/lib/promscrape/discoveryutils" "github.com/VictoriaMetrics/VictoriaMetrics/lib/promutils" "github.com/VictoriaMetrics/VictoriaMetrics/lib/proxy" "github.com/VictoriaMetrics/metrics" @@ -1330,8 +1329,8 @@ func (swc *scrapeWorkConfig) getScrapeWork(target string, extraLabels, metaLabel func internLabelStrings(labels []prompbmarshal.Label) { for i := range labels { label := &labels[i] - label.Name = discoveryutils.InternString(label.Name) - label.Value = discoveryutils.InternString(label.Value) + label.Name = bytesutil.InternString(label.Name) + label.Value = bytesutil.InternString(label.Value) } }