From f251e420e00257cb335073619b5d3627d974592e Mon Sep 17 00:00:00 2001 From: ensiouel <ensiouel@gmail.com> Date: Thu, 21 Dec 2023 20:03:03 +0300 Subject: [PATCH] fix typo --- pkg/cache/metrics_middleware.go | 6 +++--- pkg/metrics/cache.go | 14 +++++++------- pkg/metrics/request.go | 16 ++++++++-------- 3 files changed, 18 insertions(+), 18 deletions(-) diff --git a/pkg/cache/metrics_middleware.go b/pkg/cache/metrics_middleware.go index 22e42936..a9104490 100644 --- a/pkg/cache/metrics_middleware.go +++ b/pkg/cache/metrics_middleware.go @@ -5,13 +5,13 @@ import ( "git.perx.ru/perxis/perxis-go/pkg/metrics" "go.opentelemetry.io/otel/attribute" - metricotel "go.opentelemetry.io/otel/metric" + otelmetric "go.opentelemetry.io/otel/metric" ) type metricsMiddleware struct { next Cache cacheMetrics *metrics.CacheMetrics - attributes metricotel.MeasurementOption + attributes otelmetric.MeasurementOption } // MetricsMiddleware возвращает обертку над кэшем, которая используется для отслеживания количества хитов и промахов в кэше. @@ -19,7 +19,7 @@ func MetricsMiddleware(next Cache, cacheMetrics *metrics.CacheMetrics, keyValues return &metricsMiddleware{ next: next, cacheMetrics: cacheMetrics, - attributes: metricotel.WithAttributes(keyValues...), + attributes: otelmetric.WithAttributes(keyValues...), } } diff --git a/pkg/metrics/cache.go b/pkg/metrics/cache.go index 2104a38c..11cec0bd 100644 --- a/pkg/metrics/cache.go +++ b/pkg/metrics/cache.go @@ -2,34 +2,34 @@ package metrics import ( "go.opentelemetry.io/otel" - metricotel "go.opentelemetry.io/otel/metric" + otelmetric "go.opentelemetry.io/otel/metric" ) type CacheMetrics struct { - HitsTotal metricotel.Int64Counter - MissesTotal metricotel.Int64Counter - InvalidatesTotal metricotel.Int64Counter + HitsTotal otelmetric.Int64Counter + MissesTotal otelmetric.Int64Counter + InvalidatesTotal otelmetric.Int64Counter } func NewCacheMetrics(scope string) (*CacheMetrics, error) { meter := otel.Meter(scope) hitsTotal, err := meter.Int64Counter("cache_hits", - metricotel.WithDescription("Количество найденных в кэше значений"), + otelmetric.WithDescription("Количество найденных в кэше значений"), ) if err != nil { return nil, err } missesTotal, err := meter.Int64Counter("cache_misses", - metricotel.WithDescription("Количество не найденных в кэше значений"), + otelmetric.WithDescription("Количество не найденных в кэше значений"), ) if err != nil { return nil, err } invalidatesTotal, err := meter.Int64Counter("cache_invalidates", - metricotel.WithDescription("Количество инвалидаций кэша"), + otelmetric.WithDescription("Количество инвалидаций кэша"), ) if err != nil { return nil, err diff --git a/pkg/metrics/request.go b/pkg/metrics/request.go index fb21e66c..1128a203 100644 --- a/pkg/metrics/request.go +++ b/pkg/metrics/request.go @@ -2,13 +2,13 @@ package metrics import ( "go.opentelemetry.io/otel" - metricotel "go.opentelemetry.io/otel/metric" + otelmetric "go.opentelemetry.io/otel/metric" ) type RequestMetrics struct { - Total metricotel.Int64Counter - FailedTotal metricotel.Int64Counter - DurationMilliseconds metricotel.Int64Histogram + Total otelmetric.Int64Counter + FailedTotal otelmetric.Int64Counter + DurationMilliseconds otelmetric.Int64Histogram } // NewRequestMetrics возвращает метрики для подсчета количества удачных/неудачных запросов, а так же длительности ответов. @@ -18,22 +18,22 @@ func NewRequestMetrics(scope string) (*RequestMetrics, error) { meter := otel.Meter(scope) total, err := meter.Int64Counter("requests", - metricotel.WithDescription("Количество запросов"), + otelmetric.WithDescription("Количество запросов"), ) if err != nil { return nil, err } failedTotal, err := meter.Int64Counter("requests_failed", - metricotel.WithDescription("Количество запросов, вернувших ошибку"), + otelmetric.WithDescription("Количество запросов, вернувших ошибку"), ) if err != nil { return nil, err } durationMilliseconds, err := meter.Int64Histogram("request_duration", - metricotel.WithDescription("Длительность обработки запроса"), - metricotel.WithUnit("ms"), + otelmetric.WithDescription("Длительность обработки запроса"), + otelmetric.WithUnit("ms"), ) if err != nil { return nil, err -- GitLab