Skip to content
Snippets Groups Projects
Commit f251e420 authored by ensiouel's avatar ensiouel
Browse files

fix typo

parent bf035609
No related branches found
No related tags found
No related merge requests found
......@@ -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...),
}
}
......
......@@ -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
......
......@@ -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
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment