diff options
author | robot-piglet <robot-piglet@yandex-team.com> | 2023-11-28 17:06:26 +0300 |
---|---|---|
committer | robot-piglet <robot-piglet@yandex-team.com> | 2023-11-28 18:05:48 +0300 |
commit | e86f906e854caf259f096dd20f0f09425a178d28 (patch) | |
tree | 3ca53abe8d890f08057356f5815f3b8a81c019a4 | |
parent | d43e6d465089192222d8c01c10b03863ad285359 (diff) | |
download | ydb-e86f906e854caf259f096dd20f0f09425a178d28.tar.gz |
Intermediate changes
-rw-r--r-- | library/go/core/metrics/prometheus/registry.go | 2 | ||||
-rw-r--r-- | library/go/core/metrics/prometheus/registry_opts.go | 9 |
2 files changed, 8 insertions, 3 deletions
diff --git a/library/go/core/metrics/prometheus/registry.go b/library/go/core/metrics/prometheus/registry.go index e10aef935e..d43e926717 100644 --- a/library/go/core/metrics/prometheus/registry.go +++ b/library/go/core/metrics/prometheus/registry.go @@ -16,7 +16,7 @@ var _ metrics.Registry = (*Registry)(nil) var _ metrics.MetricsStreamer = (*Registry)(nil) type Registry struct { - rg *prometheus.Registry + rg PrometheusRegistry m *sync.Mutex subregistries map[string]*Registry diff --git a/library/go/core/metrics/prometheus/registry_opts.go b/library/go/core/metrics/prometheus/registry_opts.go index 1dab30d40d..2ced795b0c 100644 --- a/library/go/core/metrics/prometheus/registry_opts.go +++ b/library/go/core/metrics/prometheus/registry_opts.go @@ -10,10 +10,15 @@ import ( "github.com/ydb-platform/ydb/library/go/core/metrics/internal/pkg/registryutil" ) +type PrometheusRegistry interface { + prometheus.Registerer + prometheus.Gatherer +} + type RegistryOpts struct { Prefix string Tags map[string]string - rg *prometheus.Registry + rg PrometheusRegistry Collectors []func(metrics.Registry) NameSanitizer func(string) string StreamFormat expfmt.Format @@ -58,7 +63,7 @@ func (o *RegistryOpts) AppendPrefix(prefix string) *RegistryOpts { // // This is primarily used to unite externally defined metrics with metrics kept // in the core registry. -func (o *RegistryOpts) SetRegistry(rg *prometheus.Registry) *RegistryOpts { +func (o *RegistryOpts) SetRegistry(rg PrometheusRegistry) *RegistryOpts { o.rg = rg return o } |