changed MetricPrefix to Labels
Some checks failed
automerge / automerge (pull_request) Has been skipped
autoapprove / autoapprove (pull_request) Failing after 5s
dependabot-automerge / automerge (pull_request) Has been skipped
codeql / analyze (go) (pull_request) Has been cancelled
prbuild / test (pull_request) Has been cancelled
prbuild / lint (pull_request) Has been cancelled

This commit is contained in:
Денис Евстигнеев 2024-09-21 13:59:54 +03:00 committed by Евстигнеев Денис Сергеевич
parent fa3d18b353
commit ecad15fe17
2 changed files with 9 additions and 1 deletions

1
.gitignore vendored Normal file
View File

@ -0,0 +1 @@
.idea

View File

@ -27,6 +27,9 @@ var (
DefaultMeterStatsInterval = 5 * time.Second DefaultMeterStatsInterval = 5 * time.Second
// DefaultMeterMetricPrefix holds default metric prefix // DefaultMeterMetricPrefix holds default metric prefix
DefaultMeterMetricPrefix = "micro_store_" DefaultMeterMetricPrefix = "micro_store_"
labelHost = "redis_host"
labelName = "redis_name"
) )
// Options struct holds wrapper options // Options struct holds wrapper options
@ -36,6 +39,8 @@ type Options struct {
Tracer tracer.Tracer Tracer tracer.Tracer
MeterMetricPrefix string MeterMetricPrefix string
MeterStatsInterval time.Duration MeterStatsInterval time.Duration
RedisHost string
RedisName string
} }
// Option func signature // Option func signature
@ -56,7 +61,9 @@ func NewOptions(opts ...Option) Options {
} }
options.Meter = options.Meter.Clone( 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)) options.Logger = options.Logger.Clone(logger.WithCallerSkipCount(1))