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

fix(items): добавлена метрика в CachingMiddleware

parent 57e77656
No related branches found
No related tags found
No related merge requests found
...@@ -18,12 +18,14 @@ import ( ...@@ -18,12 +18,14 @@ import (
itemsTransportGrpc "git.perx.ru/perxis/perxis-go/pkg/items/transport/grpc" itemsTransportGrpc "git.perx.ru/perxis/perxis-go/pkg/items/transport/grpc"
localesSvc "git.perx.ru/perxis/perxis-go/pkg/locales/middleware" localesSvc "git.perx.ru/perxis/perxis-go/pkg/locales/middleware"
localsTransportGrpc "git.perx.ru/perxis/perxis-go/pkg/locales/transport/grpc" localsTransportGrpc "git.perx.ru/perxis/perxis-go/pkg/locales/transport/grpc"
"git.perx.ru/perxis/perxis-go/pkg/metrics"
referencesSvc "git.perx.ru/perxis/perxis-go/pkg/references/middleware" referencesSvc "git.perx.ru/perxis/perxis-go/pkg/references/middleware"
referencesTransportGrpc "git.perx.ru/perxis/perxis-go/pkg/references/transport/grpc" referencesTransportGrpc "git.perx.ru/perxis/perxis-go/pkg/references/transport/grpc"
rolesSvc "git.perx.ru/perxis/perxis-go/pkg/roles/middleware" rolesSvc "git.perx.ru/perxis/perxis-go/pkg/roles/middleware"
rolesTransportGrpc "git.perx.ru/perxis/perxis-go/pkg/roles/transport/grpc" rolesTransportGrpc "git.perx.ru/perxis/perxis-go/pkg/roles/transport/grpc"
spacesSvc "git.perx.ru/perxis/perxis-go/pkg/spaces/middleware" spacesSvc "git.perx.ru/perxis/perxis-go/pkg/spaces/middleware"
spacesTransportGrpc "git.perx.ru/perxis/perxis-go/pkg/spaces/transport/grpc" spacesTransportGrpc "git.perx.ru/perxis/perxis-go/pkg/spaces/transport/grpc"
"github.com/prometheus/client_golang/prometheus"
"go.uber.org/zap" "go.uber.org/zap"
"google.golang.org/grpc" "google.golang.org/grpc"
) )
...@@ -75,13 +77,14 @@ func NewClient(conn *grpc.ClientConn, opts ...Option) *Content { ...@@ -75,13 +77,14 @@ func NewClient(conn *grpc.ClientConn, opts ...Option) *Content {
func WithCaching(client *Content, size int, ttl time.Duration) *Content { func WithCaching(client *Content, size int, ttl time.Duration) *Content {
c := *client c := *client
cacheMetrics := metrics.NewCacheMetrics(prometheus.DefaultRegisterer)
c.Clients = clientsSvc.CachingMiddleware(cache.NewCache(size, ttl))(client.Clients) c.Clients = clientsSvc.CachingMiddleware(cache.NewCache(size, ttl))(client.Clients)
c.Environments = environmentsSvc.CachingMiddleware(cache.NewCache(size, ttl))(client.Environments) c.Environments = environmentsSvc.CachingMiddleware(cache.NewCache(size, ttl))(client.Environments)
c.Locales = localesSvc.CachingMiddleware(cache.NewCache(size, ttl))(client.Locales) c.Locales = localesSvc.CachingMiddleware(cache.NewCache(size, ttl))(client.Locales)
c.Roles = rolesSvc.CachingMiddleware(cache.NewCache(size, ttl))(client.Roles) c.Roles = rolesSvc.CachingMiddleware(cache.NewCache(size, ttl))(client.Roles)
c.Spaces = spacesSvc.CachingMiddleware(cache.NewCache(size, ttl))(client.Spaces) c.Spaces = spacesSvc.CachingMiddleware(cache.NewCache(size, ttl))(client.Spaces)
c.Items = itemsSvc.CachingMiddleware(cache.NewCache(size, ttl), cache.NewCache(size, ttl), c.Environments)(client.Items) c.Items = itemsSvc.CachingMiddleware(cache.NewCache(size, ttl), cache.NewCache(size, ttl), cacheMetrics, c.Environments)(client.Items)
c.Collections = collectionsSvc.CachingMiddleware(cache.NewCache(size, ttl), c.Environments)(client.Collections) c.Collections = collectionsSvc.CachingMiddleware(cache.NewCache(size, ttl), c.Environments)(client.Collections)
c.Collaborators = collaboratorsSvc.CachingMiddleware(cache.NewCache(size, ttl))(client.Collaborators) c.Collaborators = collaboratorsSvc.CachingMiddleware(cache.NewCache(size, ttl))(client.Collaborators)
c.Invitations = invitationsSvc.CachingMiddleware(cache.NewCache(size, ttl))(client.Invitations) c.Invitations = invitationsSvc.CachingMiddleware(cache.NewCache(size, ttl))(client.Invitations)
......
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