diff --git a/pkg/cache/metrics_middleware.go b/pkg/cache/metrics_middleware.go index 22e42936e5a0c7d0619f391af64226220f52e666..a9104490c170a6bd608be4548d6dc7316590ef0a 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 2104a38c1153a91bf0f4c62811da5e711c70ff08..11cec0bd479a8fde36f7662b5eaa025edeec57a6 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 fb21e66c300c12b9d90fc3870b86de550625f61e..1128a203bfaa8327c48bbbba3b2d92b91182d1c8 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