From ecad15fe17addf6e8f8fef8ab64508ea7c79687a Mon Sep 17 00:00:00 2001 From: Evstigneev Denis Date: Sat, 21 Sep 2024 13:59:54 +0300 Subject: [PATCH] changed MetricPrefix to Labels --- .gitignore | 1 + options.go | 9 ++++++++- 2 files changed, 9 insertions(+), 1 deletion(-) create mode 100644 .gitignore diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..723ef36 --- /dev/null +++ b/.gitignore @@ -0,0 +1 @@ +.idea \ No newline at end of file diff --git a/options.go b/options.go index 654500e..b973f8d 100644 --- a/options.go +++ b/options.go @@ -27,6 +27,9 @@ var ( DefaultMeterStatsInterval = 5 * time.Second // DefaultMeterMetricPrefix holds default metric prefix DefaultMeterMetricPrefix = "micro_store_" + + labelHost = "redis_host" + labelName = "redis_name" ) // Options struct holds wrapper options @@ -36,6 +39,8 @@ type Options struct { Tracer tracer.Tracer MeterMetricPrefix string MeterStatsInterval time.Duration + RedisHost string + RedisName string } // Option func signature @@ -56,7 +61,9 @@ func NewOptions(opts ...Option) Options { } options.Meter = options.Meter.Clone( - meter.MetricPrefix(options.MeterMetricPrefix), + meter.Labels( + labelHost, options.RedisHost, + labelName, options.RedisName), ) options.Logger = options.Logger.Clone(logger.WithCallerSkipCount(1))