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

refactor: теперь MetricsMiddleware может принимать список attribute.KeyValue

parent 95ce5d74
No related branches found
No related tags found
No related merge requests found
......@@ -4,6 +4,7 @@ import (
"context"
"git.perx.ru/perxis/perxis-go/pkg/metrics"
"go.opentelemetry.io/otel/attribute"
metricotel "go.opentelemetry.io/otel/metric"
)
......@@ -14,11 +15,11 @@ type metricsMiddleware struct {
}
// MetricsMiddleware возвращает обертку над кэшем, которая используется для отслеживания количества хитов и промахов в кэше.
func MetricsMiddleware(next Cache, cacheMetrics *metrics.CacheMetrics, attributes ...string) Cache {
func MetricsMiddleware(next Cache, cacheMetrics *metrics.CacheMetrics, keyValues ...attribute.KeyValue) Cache {
return &metricsMiddleware{
next: next,
cacheMetrics: cacheMetrics,
attributes: metricotel.WithAttributes(metrics.AttributesFromKV(attributes)...),
attributes: metricotel.WithAttributes(keyValues...),
}
}
......
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