From e492790b5182cd46291ffd02cb17129eee2a46fb Mon Sep 17 00:00:00 2001
From: ensiouel <ensiouel@gmail.com>
Date: Thu, 21 Dec 2023 14:22:08 +0300
Subject: [PATCH] =?UTF-8?q?refactor:=20=D1=83=D0=B4=D0=B0=D0=BB=D0=B5?=
 =?UTF-8?q?=D0=BD=20=D1=88=D0=B0=D0=B1=D0=BB=D0=BE=D0=BD=20=D0=B4=D0=BB?=
 =?UTF-8?q?=D1=8F=20=D0=BC=D0=B5=D1=82=D1=80=D0=B8=D0=BA=20=D0=B7=D0=B0?=
 =?UTF-8?q?=D0=BF=D1=80=D0=BE=D1=81=D0=BE=D0=B2=20=D0=B8=20=D1=81=D0=B3?=
 =?UTF-8?q?=D0=B5=D0=BD=D0=B5=D1=80=D0=B8=D1=80=D0=BE=D0=B2=D0=B0=D0=BD?=
 =?UTF-8?q?=D0=BD=D1=8B=D0=B5=20=D1=84=D0=B0=D0=B9=D0=BB=D1=8B?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

---
 assets/templates/middleware/metrics           |  42 ---
 images/middleware/metrics_middleware.go       |  49 ---
 pkg/clients/middleware/metrics_middleware.go  | 132 --------
 .../middleware/metrics_middleware.go          | 104 -------
 .../middleware/metrics_middleware.go          | 133 --------
 .../middleware/metrics_middleware.go          | 146 ---------
 .../middleware/metrics_middleware.go          | 105 -------
 pkg/items/middleware/metrics_middleware.go    | 287 ------------------
 pkg/locales/middleware/metrics_middleware.go  |  76 -----
 pkg/members/middleware/metrics_middleware.go  | 118 -------
 .../middleware/metrics_middleware.go          | 105 -------
 .../middleware/metrics_middleware.go          |  63 ----
 pkg/roles/middleware/metrics_middleware.go    | 104 -------
 pkg/spaces/middleware/metrics_middleware.go   | 174 -----------
 pkg/users/middleware/metrics_middleware.go    | 119 --------
 15 files changed, 1757 deletions(-)
 delete mode 100644 assets/templates/middleware/metrics
 delete mode 100644 images/middleware/metrics_middleware.go
 delete mode 100644 pkg/clients/middleware/metrics_middleware.go
 delete mode 100644 pkg/collaborators/middleware/metrics_middleware.go
 delete mode 100644 pkg/collections/middleware/metrics_middleware.go
 delete mode 100644 pkg/environments/middleware/metrics_middleware.go
 delete mode 100644 pkg/invitations/middleware/metrics_middleware.go
 delete mode 100644 pkg/items/middleware/metrics_middleware.go
 delete mode 100644 pkg/locales/middleware/metrics_middleware.go
 delete mode 100644 pkg/members/middleware/metrics_middleware.go
 delete mode 100644 pkg/organizations/middleware/metrics_middleware.go
 delete mode 100644 pkg/references/middleware/metrics_middleware.go
 delete mode 100644 pkg/roles/middleware/metrics_middleware.go
 delete mode 100644 pkg/spaces/middleware/metrics_middleware.go
 delete mode 100644 pkg/users/middleware/metrics_middleware.go

diff --git a/assets/templates/middleware/metrics b/assets/templates/middleware/metrics
deleted file mode 100644
index 2c1a9209..00000000
--- a/assets/templates/middleware/metrics
+++ /dev/null
@@ -1,42 +0,0 @@
-import (
-    "context"
-
-    "github.com/prometheus/client_golang/prometheus"
-)
-
-{{ $decorator := (or .Vars.DecoratorName "metricsMiddleware") }}
-{{ $funcName := (or .Vars.FuncName ("MetricsMiddleware")) }}
-
-// {{ $decorator }} implements {{ .Interface.Type }} that is instrumented with metrics
-type {{ $decorator }} struct {
-    serviceName    string
-    requestMetrics *metrics.RequestMetrics
-    next {{ .Interface.Type }}
-}
-
-// {{ $funcName }} instruments an implementation of the {{ $decorator }} with metrics
-func {{ $funcName }} (requestMetrics *metrics.RequestMetrics) Middleware {
-    return func(next {{ .Interface.Type }}) {{ .Interface.Type }} {
-        return &{{ $decorator }}{
-            serviceName: strings.ToLower("{{ $.Interface.Name }}"),
-            requestMetrics: requestMetrics,
-            next: next,
-        }
-    }
-}
-
-{{ range $method := .Interface.Methods }}
-    // {{ $method.Name }} implements {{ $.Interface.Type }}
-    func (m {{ $decorator }}) {{ $method.Declaration }} {
-        labels := prometheus.Labels{"service": m.serviceName, "method": "{{ $method.Name }}"}
-        timer := prometheus.NewTimer(m.requestMetrics.DurationSeconds.With(labels))
-        defer timer.ObserveDuration()
-        m.requestMetrics.Total.With(labels).Inc()
-        {{ $method.ResultsNames }} = m.next.{{ $method.Call }}
-        if err != nil {
-            m.requestMetrics.FailedTotal.With(labels).Inc()
-            return
-        }
-        return
-    }
-{{ end }}
\ No newline at end of file
diff --git a/images/middleware/metrics_middleware.go b/images/middleware/metrics_middleware.go
deleted file mode 100644
index ffff7929..00000000
--- a/images/middleware/metrics_middleware.go
+++ /dev/null
@@ -1,49 +0,0 @@
-// Code generated by gowrap. DO NOT EDIT.
-// template: ..\..\assets\templates\middleware\metrics
-// gowrap: http://github.com/hexdigest/gowrap
-
-package middleware
-
-//go:generate gowrap gen -p git.perx.ru/perxis/perxis-go/images -i Images -t ..\..\assets\templates\middleware\metrics -o metrics_middleware.go -l ""
-
-import (
-	"context"
-	"strings"
-
-	"git.perx.ru/perxis/perxis-go/images"
-	"git.perx.ru/perxis/perxis-go/pkg/files"
-	"git.perx.ru/perxis/perxis-go/pkg/metrics"
-	"github.com/prometheus/client_golang/prometheus"
-)
-
-// metricsMiddleware implements images.Images that is instrumented with metrics
-type metricsMiddleware struct {
-	serviceName    string
-	requestMetrics *metrics.RequestMetrics
-	next           images.Images
-}
-
-// MetricsMiddleware instruments an implementation of the metricsMiddleware with metrics
-func MetricsMiddleware(requestMetrics *metrics.RequestMetrics) Middleware {
-	return func(next images.Images) images.Images {
-		return &metricsMiddleware{
-			serviceName:    strings.ToLower("Images"),
-			requestMetrics: requestMetrics,
-			next:           next,
-		}
-	}
-}
-
-// Get implements images.Images
-func (m metricsMiddleware) Get(ctx context.Context, source *files.File, opts *images.GetOptions) (result *files.File, err error) {
-	labels := prometheus.Labels{"service": m.serviceName, "method": "Get"}
-	timer := prometheus.NewTimer(m.requestMetrics.DurationSeconds.With(labels))
-	defer timer.ObserveDuration()
-	m.requestMetrics.Total.With(labels).Inc()
-	result, err = m.next.Get(ctx, source, opts)
-	if err != nil {
-		m.requestMetrics.FailedTotal.With(labels).Inc()
-		return
-	}
-	return
-}
diff --git a/pkg/clients/middleware/metrics_middleware.go b/pkg/clients/middleware/metrics_middleware.go
deleted file mode 100644
index f3e6207a..00000000
--- a/pkg/clients/middleware/metrics_middleware.go
+++ /dev/null
@@ -1,132 +0,0 @@
-// Code generated by gowrap. DO NOT EDIT.
-// template: ../../../assets/templates/middleware/metrics
-// gowrap: http://github.com/hexdigest/gowrap
-
-package middleware
-
-//go:generate gowrap gen -p git.perx.ru/perxis/perxis-go/pkg/clients -i Clients -t ../../../assets/templates/middleware/metrics -o metrics_middleware.go -l ""
-
-import (
-	"context"
-	"strings"
-
-	"git.perx.ru/perxis/perxis-go/pkg/clients"
-	"git.perx.ru/perxis/perxis-go/pkg/metrics"
-	"github.com/prometheus/client_golang/prometheus"
-)
-
-// metricsMiddleware implements clients.Clients that is instrumented with metrics
-type metricsMiddleware struct {
-	serviceName    string
-	requestMetrics *metrics.RequestMetrics
-	next           clients.Clients
-}
-
-// MetricsMiddleware instruments an implementation of the metricsMiddleware with metrics
-func MetricsMiddleware(requestMetrics *metrics.RequestMetrics) Middleware {
-	return func(next clients.Clients) clients.Clients {
-		return &metricsMiddleware{
-			serviceName:    strings.ToLower("Clients"),
-			requestMetrics: requestMetrics,
-			next:           next,
-		}
-	}
-}
-
-// Create implements clients.Clients
-func (m metricsMiddleware) Create(ctx context.Context, client *clients.Client) (created *clients.Client, err error) {
-	labels := prometheus.Labels{"service": m.serviceName, "method": "Create"}
-	timer := prometheus.NewTimer(m.requestMetrics.DurationSeconds.With(labels))
-	defer timer.ObserveDuration()
-	m.requestMetrics.Total.With(labels).Inc()
-	created, err = m.next.Create(ctx, client)
-	if err != nil {
-		m.requestMetrics.FailedTotal.With(labels).Inc()
-		return
-	}
-	return
-}
-
-// Delete implements clients.Clients
-func (m metricsMiddleware) Delete(ctx context.Context, spaceId string, id string) (err error) {
-	labels := prometheus.Labels{"service": m.serviceName, "method": "Delete"}
-	timer := prometheus.NewTimer(m.requestMetrics.DurationSeconds.With(labels))
-	defer timer.ObserveDuration()
-	m.requestMetrics.Total.With(labels).Inc()
-	err = m.next.Delete(ctx, spaceId, id)
-	if err != nil {
-		m.requestMetrics.FailedTotal.With(labels).Inc()
-		return
-	}
-	return
-}
-
-// Enable implements clients.Clients
-func (m metricsMiddleware) Enable(ctx context.Context, spaceId string, id string, enable bool) (err error) {
-	labels := prometheus.Labels{"service": m.serviceName, "method": "Enable"}
-	timer := prometheus.NewTimer(m.requestMetrics.DurationSeconds.With(labels))
-	defer timer.ObserveDuration()
-	m.requestMetrics.Total.With(labels).Inc()
-	err = m.next.Enable(ctx, spaceId, id, enable)
-	if err != nil {
-		m.requestMetrics.FailedTotal.With(labels).Inc()
-		return
-	}
-	return
-}
-
-// Get implements clients.Clients
-func (m metricsMiddleware) Get(ctx context.Context, spaceId string, id string) (client *clients.Client, err error) {
-	labels := prometheus.Labels{"service": m.serviceName, "method": "Get"}
-	timer := prometheus.NewTimer(m.requestMetrics.DurationSeconds.With(labels))
-	defer timer.ObserveDuration()
-	m.requestMetrics.Total.With(labels).Inc()
-	client, err = m.next.Get(ctx, spaceId, id)
-	if err != nil {
-		m.requestMetrics.FailedTotal.With(labels).Inc()
-		return
-	}
-	return
-}
-
-// GetBy implements clients.Clients
-func (m metricsMiddleware) GetBy(ctx context.Context, spaceId string, params *clients.GetByParams) (client *clients.Client, err error) {
-	labels := prometheus.Labels{"service": m.serviceName, "method": "GetBy"}
-	timer := prometheus.NewTimer(m.requestMetrics.DurationSeconds.With(labels))
-	defer timer.ObserveDuration()
-	m.requestMetrics.Total.With(labels).Inc()
-	client, err = m.next.GetBy(ctx, spaceId, params)
-	if err != nil {
-		m.requestMetrics.FailedTotal.With(labels).Inc()
-		return
-	}
-	return
-}
-
-// List implements clients.Clients
-func (m metricsMiddleware) List(ctx context.Context, spaceId string) (clients []*clients.Client, err error) {
-	labels := prometheus.Labels{"service": m.serviceName, "method": "List"}
-	timer := prometheus.NewTimer(m.requestMetrics.DurationSeconds.With(labels))
-	defer timer.ObserveDuration()
-	m.requestMetrics.Total.With(labels).Inc()
-	clients, err = m.next.List(ctx, spaceId)
-	if err != nil {
-		m.requestMetrics.FailedTotal.With(labels).Inc()
-		return
-	}
-	return
-}
-
-// Update implements clients.Clients
-func (m metricsMiddleware) Update(ctx context.Context, client *clients.Client) (err error) {
-	labels := prometheus.Labels{"service": m.serviceName, "method": "Update"}
-	timer := prometheus.NewTimer(m.requestMetrics.DurationSeconds.With(labels))
-	defer timer.ObserveDuration()
-	m.requestMetrics.Total.With(labels).Inc()
-	err = m.next.Update(ctx, client)
-	if err != nil {
-		m.requestMetrics.FailedTotal.With(labels).Inc()
-		return
-	}
-	return
-}
diff --git a/pkg/collaborators/middleware/metrics_middleware.go b/pkg/collaborators/middleware/metrics_middleware.go
deleted file mode 100644
index 38ed853d..00000000
--- a/pkg/collaborators/middleware/metrics_middleware.go
+++ /dev/null
@@ -1,104 +0,0 @@
-// Code generated by gowrap. DO NOT EDIT.
-// template: ../../../assets/templates/middleware/metrics
-// gowrap: http://github.com/hexdigest/gowrap
-
-package middleware
-
-//go:generate gowrap gen -p git.perx.ru/perxis/perxis-go/pkg/collaborators -i Collaborators -t ../../../assets/templates/middleware/metrics -o metrics_middleware.go -l ""
-
-import (
-	"context"
-	"strings"
-
-	"git.perx.ru/perxis/perxis-go/pkg/collaborators"
-	"git.perx.ru/perxis/perxis-go/pkg/metrics"
-	"github.com/prometheus/client_golang/prometheus"
-)
-
-// metricsMiddleware implements collaborators.Collaborators that is instrumented with metrics
-type metricsMiddleware struct {
-	serviceName    string
-	requestMetrics *metrics.RequestMetrics
-	next           collaborators.Collaborators
-}
-
-// MetricsMiddleware instruments an implementation of the metricsMiddleware with metrics
-func MetricsMiddleware(requestMetrics *metrics.RequestMetrics) Middleware {
-	return func(next collaborators.Collaborators) collaborators.Collaborators {
-		return &metricsMiddleware{
-			serviceName:    strings.ToLower("Collaborators"),
-			requestMetrics: requestMetrics,
-			next:           next,
-		}
-	}
-}
-
-// Get implements collaborators.Collaborators
-func (m metricsMiddleware) Get(ctx context.Context, spaceId string, subject string) (role string, err error) {
-	labels := prometheus.Labels{"service": m.serviceName, "method": "Get"}
-	timer := prometheus.NewTimer(m.requestMetrics.DurationSeconds.With(labels))
-	defer timer.ObserveDuration()
-	m.requestMetrics.Total.With(labels).Inc()
-	role, err = m.next.Get(ctx, spaceId, subject)
-	if err != nil {
-		m.requestMetrics.FailedTotal.With(labels).Inc()
-		return
-	}
-	return
-}
-
-// ListCollaborators implements collaborators.Collaborators
-func (m metricsMiddleware) ListCollaborators(ctx context.Context, spaceId string) (collaborators []*collaborators.Collaborator, err error) {
-	labels := prometheus.Labels{"service": m.serviceName, "method": "ListCollaborators"}
-	timer := prometheus.NewTimer(m.requestMetrics.DurationSeconds.With(labels))
-	defer timer.ObserveDuration()
-	m.requestMetrics.Total.With(labels).Inc()
-	collaborators, err = m.next.ListCollaborators(ctx, spaceId)
-	if err != nil {
-		m.requestMetrics.FailedTotal.With(labels).Inc()
-		return
-	}
-	return
-}
-
-// ListSpaces implements collaborators.Collaborators
-func (m metricsMiddleware) ListSpaces(ctx context.Context, subject string) (spaces []*collaborators.Collaborator, err error) {
-	labels := prometheus.Labels{"service": m.serviceName, "method": "ListSpaces"}
-	timer := prometheus.NewTimer(m.requestMetrics.DurationSeconds.With(labels))
-	defer timer.ObserveDuration()
-	m.requestMetrics.Total.With(labels).Inc()
-	spaces, err = m.next.ListSpaces(ctx, subject)
-	if err != nil {
-		m.requestMetrics.FailedTotal.With(labels).Inc()
-		return
-	}
-	return
-}
-
-// Remove implements collaborators.Collaborators
-func (m metricsMiddleware) Remove(ctx context.Context, spaceId string, subject string) (err error) {
-	labels := prometheus.Labels{"service": m.serviceName, "method": "Remove"}
-	timer := prometheus.NewTimer(m.requestMetrics.DurationSeconds.With(labels))
-	defer timer.ObserveDuration()
-	m.requestMetrics.Total.With(labels).Inc()
-	err = m.next.Remove(ctx, spaceId, subject)
-	if err != nil {
-		m.requestMetrics.FailedTotal.With(labels).Inc()
-		return
-	}
-	return
-}
-
-// Set implements collaborators.Collaborators
-func (m metricsMiddleware) Set(ctx context.Context, spaceId string, subject string, role string) (err error) {
-	labels := prometheus.Labels{"service": m.serviceName, "method": "Set"}
-	timer := prometheus.NewTimer(m.requestMetrics.DurationSeconds.With(labels))
-	defer timer.ObserveDuration()
-	m.requestMetrics.Total.With(labels).Inc()
-	err = m.next.Set(ctx, spaceId, subject, role)
-	if err != nil {
-		m.requestMetrics.FailedTotal.With(labels).Inc()
-		return
-	}
-	return
-}
diff --git a/pkg/collections/middleware/metrics_middleware.go b/pkg/collections/middleware/metrics_middleware.go
deleted file mode 100644
index fc244f73..00000000
--- a/pkg/collections/middleware/metrics_middleware.go
+++ /dev/null
@@ -1,133 +0,0 @@
-// Code generated by gowrap. DO NOT EDIT.
-// template: ../../../assets/templates/middleware/metrics
-// gowrap: http://github.com/hexdigest/gowrap
-
-package middleware
-
-//go:generate gowrap gen -p git.perx.ru/perxis/perxis-go/pkg/collections -i Collections -t ../../../assets/templates/middleware/metrics -o metrics_middleware.go -l ""
-
-import (
-	"context"
-	"strings"
-
-	"git.perx.ru/perxis/perxis-go/pkg/collections"
-	"git.perx.ru/perxis/perxis-go/pkg/metrics"
-	"git.perx.ru/perxis/perxis-go/pkg/schema"
-	"github.com/prometheus/client_golang/prometheus"
-)
-
-// metricsMiddleware implements collections.Collections that is instrumented with metrics
-type metricsMiddleware struct {
-	serviceName    string
-	requestMetrics *metrics.RequestMetrics
-	next           collections.Collections
-}
-
-// MetricsMiddleware instruments an implementation of the metricsMiddleware with metrics
-func MetricsMiddleware(requestMetrics *metrics.RequestMetrics) Middleware {
-	return func(next collections.Collections) collections.Collections {
-		return &metricsMiddleware{
-			serviceName:    strings.ToLower("Collections"),
-			requestMetrics: requestMetrics,
-			next:           next,
-		}
-	}
-}
-
-// Create implements collections.Collections
-func (m metricsMiddleware) Create(ctx context.Context, collection *collections.Collection) (created *collections.Collection, err error) {
-	labels := prometheus.Labels{"service": m.serviceName, "method": "Create"}
-	timer := prometheus.NewTimer(m.requestMetrics.DurationSeconds.With(labels))
-	defer timer.ObserveDuration()
-	m.requestMetrics.Total.With(labels).Inc()
-	created, err = m.next.Create(ctx, collection)
-	if err != nil {
-		m.requestMetrics.FailedTotal.With(labels).Inc()
-		return
-	}
-	return
-}
-
-// Delete implements collections.Collections
-func (m metricsMiddleware) Delete(ctx context.Context, spaceId string, envId string, collectionId string) (err error) {
-	labels := prometheus.Labels{"service": m.serviceName, "method": "Delete"}
-	timer := prometheus.NewTimer(m.requestMetrics.DurationSeconds.With(labels))
-	defer timer.ObserveDuration()
-	m.requestMetrics.Total.With(labels).Inc()
-	err = m.next.Delete(ctx, spaceId, envId, collectionId)
-	if err != nil {
-		m.requestMetrics.FailedTotal.With(labels).Inc()
-		return
-	}
-	return
-}
-
-// Get implements collections.Collections
-func (m metricsMiddleware) Get(ctx context.Context, spaceId string, envId string, collectionId string, options ...*collections.GetOptions) (collection *collections.Collection, err error) {
-	labels := prometheus.Labels{"service": m.serviceName, "method": "Get"}
-	timer := prometheus.NewTimer(m.requestMetrics.DurationSeconds.With(labels))
-	defer timer.ObserveDuration()
-	m.requestMetrics.Total.With(labels).Inc()
-	collection, err = m.next.Get(ctx, spaceId, envId, collectionId, options...)
-	if err != nil {
-		m.requestMetrics.FailedTotal.With(labels).Inc()
-		return
-	}
-	return
-}
-
-// List implements collections.Collections
-func (m metricsMiddleware) List(ctx context.Context, spaceId string, envId string, filter *collections.Filter) (collections []*collections.Collection, err error) {
-	labels := prometheus.Labels{"service": m.serviceName, "method": "List"}
-	timer := prometheus.NewTimer(m.requestMetrics.DurationSeconds.With(labels))
-	defer timer.ObserveDuration()
-	m.requestMetrics.Total.With(labels).Inc()
-	collections, err = m.next.List(ctx, spaceId, envId, filter)
-	if err != nil {
-		m.requestMetrics.FailedTotal.With(labels).Inc()
-		return
-	}
-	return
-}
-
-// SetSchema implements collections.Collections
-func (m metricsMiddleware) SetSchema(ctx context.Context, spaceId string, envId string, collectionId string, schema *schema.Schema) (err error) {
-	labels := prometheus.Labels{"service": m.serviceName, "method": "SetSchema"}
-	timer := prometheus.NewTimer(m.requestMetrics.DurationSeconds.With(labels))
-	defer timer.ObserveDuration()
-	m.requestMetrics.Total.With(labels).Inc()
-	err = m.next.SetSchema(ctx, spaceId, envId, collectionId, schema)
-	if err != nil {
-		m.requestMetrics.FailedTotal.With(labels).Inc()
-		return
-	}
-	return
-}
-
-// SetState implements collections.Collections
-func (m metricsMiddleware) SetState(ctx context.Context, spaceId string, envId string, collectionId string, state *collections.StateInfo) (err error) {
-	labels := prometheus.Labels{"service": m.serviceName, "method": "SetState"}
-	timer := prometheus.NewTimer(m.requestMetrics.DurationSeconds.With(labels))
-	defer timer.ObserveDuration()
-	m.requestMetrics.Total.With(labels).Inc()
-	err = m.next.SetState(ctx, spaceId, envId, collectionId, state)
-	if err != nil {
-		m.requestMetrics.FailedTotal.With(labels).Inc()
-		return
-	}
-	return
-}
-
-// Update implements collections.Collections
-func (m metricsMiddleware) Update(ctx context.Context, coll *collections.Collection) (err error) {
-	labels := prometheus.Labels{"service": m.serviceName, "method": "Update"}
-	timer := prometheus.NewTimer(m.requestMetrics.DurationSeconds.With(labels))
-	defer timer.ObserveDuration()
-	m.requestMetrics.Total.With(labels).Inc()
-	err = m.next.Update(ctx, coll)
-	if err != nil {
-		m.requestMetrics.FailedTotal.With(labels).Inc()
-		return
-	}
-	return
-}
diff --git a/pkg/environments/middleware/metrics_middleware.go b/pkg/environments/middleware/metrics_middleware.go
deleted file mode 100644
index dfa1905c..00000000
--- a/pkg/environments/middleware/metrics_middleware.go
+++ /dev/null
@@ -1,146 +0,0 @@
-// Code generated by gowrap. DO NOT EDIT.
-// template: ../../../assets/templates/middleware/metrics
-// gowrap: http://github.com/hexdigest/gowrap
-
-package middleware
-
-//go:generate gowrap gen -p git.perx.ru/perxis/perxis-go/pkg/environments -i Environments -t ../../../assets/templates/middleware/metrics -o metrics_middleware.go -l ""
-
-import (
-	"context"
-	"strings"
-
-	"git.perx.ru/perxis/perxis-go/pkg/environments"
-	"git.perx.ru/perxis/perxis-go/pkg/metrics"
-	"github.com/prometheus/client_golang/prometheus"
-)
-
-// metricsMiddleware implements environments.Environments that is instrumented with metrics
-type metricsMiddleware struct {
-	serviceName    string
-	requestMetrics *metrics.RequestMetrics
-	next           environments.Environments
-}
-
-// MetricsMiddleware instruments an implementation of the metricsMiddleware with metrics
-func MetricsMiddleware(requestMetrics *metrics.RequestMetrics) Middleware {
-	return func(next environments.Environments) environments.Environments {
-		return &metricsMiddleware{
-			serviceName:    strings.ToLower("Environments"),
-			requestMetrics: requestMetrics,
-			next:           next,
-		}
-	}
-}
-
-// Create implements environments.Environments
-func (m metricsMiddleware) Create(ctx context.Context, env *environments.Environment) (created *environments.Environment, err error) {
-	labels := prometheus.Labels{"service": m.serviceName, "method": "Create"}
-	timer := prometheus.NewTimer(m.requestMetrics.DurationSeconds.With(labels))
-	defer timer.ObserveDuration()
-	m.requestMetrics.Total.With(labels).Inc()
-	created, err = m.next.Create(ctx, env)
-	if err != nil {
-		m.requestMetrics.FailedTotal.With(labels).Inc()
-		return
-	}
-	return
-}
-
-// Delete implements environments.Environments
-func (m metricsMiddleware) Delete(ctx context.Context, spaceId string, envId string) (err error) {
-	labels := prometheus.Labels{"service": m.serviceName, "method": "Delete"}
-	timer := prometheus.NewTimer(m.requestMetrics.DurationSeconds.With(labels))
-	defer timer.ObserveDuration()
-	m.requestMetrics.Total.With(labels).Inc()
-	err = m.next.Delete(ctx, spaceId, envId)
-	if err != nil {
-		m.requestMetrics.FailedTotal.With(labels).Inc()
-		return
-	}
-	return
-}
-
-// Get implements environments.Environments
-func (m metricsMiddleware) Get(ctx context.Context, spaceId string, envId string) (env *environments.Environment, err error) {
-	labels := prometheus.Labels{"service": m.serviceName, "method": "Get"}
-	timer := prometheus.NewTimer(m.requestMetrics.DurationSeconds.With(labels))
-	defer timer.ObserveDuration()
-	m.requestMetrics.Total.With(labels).Inc()
-	env, err = m.next.Get(ctx, spaceId, envId)
-	if err != nil {
-		m.requestMetrics.FailedTotal.With(labels).Inc()
-		return
-	}
-	return
-}
-
-// List implements environments.Environments
-func (m metricsMiddleware) List(ctx context.Context, spaceId string) (envs []*environments.Environment, err error) {
-	labels := prometheus.Labels{"service": m.serviceName, "method": "List"}
-	timer := prometheus.NewTimer(m.requestMetrics.DurationSeconds.With(labels))
-	defer timer.ObserveDuration()
-	m.requestMetrics.Total.With(labels).Inc()
-	envs, err = m.next.List(ctx, spaceId)
-	if err != nil {
-		m.requestMetrics.FailedTotal.With(labels).Inc()
-		return
-	}
-	return
-}
-
-// Migrate implements environments.Environments
-func (m metricsMiddleware) Migrate(ctx context.Context, spaceId string, envId string, options ...*environments.MigrateOptions) (err error) {
-	labels := prometheus.Labels{"service": m.serviceName, "method": "Migrate"}
-	timer := prometheus.NewTimer(m.requestMetrics.DurationSeconds.With(labels))
-	defer timer.ObserveDuration()
-	m.requestMetrics.Total.With(labels).Inc()
-	err = m.next.Migrate(ctx, spaceId, envId, options...)
-	if err != nil {
-		m.requestMetrics.FailedTotal.With(labels).Inc()
-		return
-	}
-	return
-}
-
-// RemoveAlias implements environments.Environments
-func (m metricsMiddleware) RemoveAlias(ctx context.Context, spaceId string, envId string, alias string) (err error) {
-	labels := prometheus.Labels{"service": m.serviceName, "method": "RemoveAlias"}
-	timer := prometheus.NewTimer(m.requestMetrics.DurationSeconds.With(labels))
-	defer timer.ObserveDuration()
-	m.requestMetrics.Total.With(labels).Inc()
-	err = m.next.RemoveAlias(ctx, spaceId, envId, alias)
-	if err != nil {
-		m.requestMetrics.FailedTotal.With(labels).Inc()
-		return
-	}
-	return
-}
-
-// SetAlias implements environments.Environments
-func (m metricsMiddleware) SetAlias(ctx context.Context, spaceId string, envId string, alias string) (err error) {
-	labels := prometheus.Labels{"service": m.serviceName, "method": "SetAlias"}
-	timer := prometheus.NewTimer(m.requestMetrics.DurationSeconds.With(labels))
-	defer timer.ObserveDuration()
-	m.requestMetrics.Total.With(labels).Inc()
-	err = m.next.SetAlias(ctx, spaceId, envId, alias)
-	if err != nil {
-		m.requestMetrics.FailedTotal.With(labels).Inc()
-		return
-	}
-	return
-}
-
-// Update implements environments.Environments
-func (m metricsMiddleware) Update(ctx context.Context, env *environments.Environment) (err error) {
-	labels := prometheus.Labels{"service": m.serviceName, "method": "Update"}
-	timer := prometheus.NewTimer(m.requestMetrics.DurationSeconds.With(labels))
-	defer timer.ObserveDuration()
-	m.requestMetrics.Total.With(labels).Inc()
-	err = m.next.Update(ctx, env)
-	if err != nil {
-		m.requestMetrics.FailedTotal.With(labels).Inc()
-		return
-	}
-	return
-}
diff --git a/pkg/invitations/middleware/metrics_middleware.go b/pkg/invitations/middleware/metrics_middleware.go
deleted file mode 100644
index a13a17a0..00000000
--- a/pkg/invitations/middleware/metrics_middleware.go
+++ /dev/null
@@ -1,105 +0,0 @@
-// Code generated by gowrap. DO NOT EDIT.
-// template: ../../../assets/templates/middleware/metrics
-// gowrap: http://github.com/hexdigest/gowrap
-
-package middleware
-
-//go:generate gowrap gen -p git.perx.ru/perxis/perxis-go/pkg/invitations -i Invitations -t ../../../assets/templates/middleware/metrics -o metrics_middleware.go -l ""
-
-import (
-	"context"
-	"strings"
-
-	"git.perx.ru/perxis/perxis-go/pkg/invitations"
-	"git.perx.ru/perxis/perxis-go/pkg/metrics"
-	"git.perx.ru/perxis/perxis-go/pkg/options"
-	"github.com/prometheus/client_golang/prometheus"
-)
-
-// metricsMiddleware implements invitations.Invitations that is instrumented with metrics
-type metricsMiddleware struct {
-	serviceName    string
-	requestMetrics *metrics.RequestMetrics
-	next           invitations.Invitations
-}
-
-// MetricsMiddleware instruments an implementation of the metricsMiddleware with metrics
-func MetricsMiddleware(requestMetrics *metrics.RequestMetrics) Middleware {
-	return func(next invitations.Invitations) invitations.Invitations {
-		return &metricsMiddleware{
-			serviceName:    strings.ToLower("Invitations"),
-			requestMetrics: requestMetrics,
-			next:           next,
-		}
-	}
-}
-
-// Accept implements invitations.Invitations
-func (m metricsMiddleware) Accept(ctx context.Context, invitationId string, userId string) (err error) {
-	labels := prometheus.Labels{"service": m.serviceName, "method": "Accept"}
-	timer := prometheus.NewTimer(m.requestMetrics.DurationSeconds.With(labels))
-	defer timer.ObserveDuration()
-	m.requestMetrics.Total.With(labels).Inc()
-	err = m.next.Accept(ctx, invitationId, userId)
-	if err != nil {
-		m.requestMetrics.FailedTotal.With(labels).Inc()
-		return
-	}
-	return
-}
-
-// Create implements invitations.Invitations
-func (m metricsMiddleware) Create(ctx context.Context, invitation *invitations.Invitation) (created *invitations.Invitation, err error) {
-	labels := prometheus.Labels{"service": m.serviceName, "method": "Create"}
-	timer := prometheus.NewTimer(m.requestMetrics.DurationSeconds.With(labels))
-	defer timer.ObserveDuration()
-	m.requestMetrics.Total.With(labels).Inc()
-	created, err = m.next.Create(ctx, invitation)
-	if err != nil {
-		m.requestMetrics.FailedTotal.With(labels).Inc()
-		return
-	}
-	return
-}
-
-// Delete implements invitations.Invitations
-func (m metricsMiddleware) Delete(ctx context.Context, invitationId string) (err error) {
-	labels := prometheus.Labels{"service": m.serviceName, "method": "Delete"}
-	timer := prometheus.NewTimer(m.requestMetrics.DurationSeconds.With(labels))
-	defer timer.ObserveDuration()
-	m.requestMetrics.Total.With(labels).Inc()
-	err = m.next.Delete(ctx, invitationId)
-	if err != nil {
-		m.requestMetrics.FailedTotal.With(labels).Inc()
-		return
-	}
-	return
-}
-
-// Find implements invitations.Invitations
-func (m metricsMiddleware) Find(ctx context.Context, filter *invitations.Filter, opts *options.FindOptions) (invitations []*invitations.Invitation, total int, err error) {
-	labels := prometheus.Labels{"service": m.serviceName, "method": "Find"}
-	timer := prometheus.NewTimer(m.requestMetrics.DurationSeconds.With(labels))
-	defer timer.ObserveDuration()
-	m.requestMetrics.Total.With(labels).Inc()
-	invitations, total, err = m.next.Find(ctx, filter, opts)
-	if err != nil {
-		m.requestMetrics.FailedTotal.With(labels).Inc()
-		return
-	}
-	return
-}
-
-// Get implements invitations.Invitations
-func (m metricsMiddleware) Get(ctx context.Context, invitationId string) (invitation *invitations.Invitation, err error) {
-	labels := prometheus.Labels{"service": m.serviceName, "method": "Get"}
-	timer := prometheus.NewTimer(m.requestMetrics.DurationSeconds.With(labels))
-	defer timer.ObserveDuration()
-	m.requestMetrics.Total.With(labels).Inc()
-	invitation, err = m.next.Get(ctx, invitationId)
-	if err != nil {
-		m.requestMetrics.FailedTotal.With(labels).Inc()
-		return
-	}
-	return
-}
diff --git a/pkg/items/middleware/metrics_middleware.go b/pkg/items/middleware/metrics_middleware.go
deleted file mode 100644
index 05986434..00000000
--- a/pkg/items/middleware/metrics_middleware.go
+++ /dev/null
@@ -1,287 +0,0 @@
-// Code generated by gowrap. DO NOT EDIT.
-// template: ../../../assets/templates/middleware/metrics
-// gowrap: http://github.com/hexdigest/gowrap
-
-package middleware
-
-//go:generate gowrap gen -p git.perx.ru/perxis/perxis-go/pkg/items -i Items -t ../../../assets/templates/middleware/metrics -o metrics_middleware.go -l ""
-
-import (
-	"context"
-	"strings"
-
-	"git.perx.ru/perxis/perxis-go/pkg/items"
-	"git.perx.ru/perxis/perxis-go/pkg/metrics"
-	"git.perx.ru/perxis/perxis-go/pkg/schema"
-	"github.com/prometheus/client_golang/prometheus"
-)
-
-// metricsMiddleware implements items.Items that is instrumented with metrics
-type metricsMiddleware struct {
-	serviceName    string
-	requestMetrics *metrics.RequestMetrics
-	next           items.Items
-}
-
-// MetricsMiddleware instruments an implementation of the metricsMiddleware with metrics
-func MetricsMiddleware(requestMetrics *metrics.RequestMetrics) Middleware {
-	return func(next items.Items) items.Items {
-		return &metricsMiddleware{
-			serviceName:    strings.ToLower("Items"),
-			requestMetrics: requestMetrics,
-			next:           next,
-		}
-	}
-}
-
-// Aggregate implements items.Items
-func (m metricsMiddleware) Aggregate(ctx context.Context, spaceId string, envId string, collectionId string, filter *items.Filter, options ...*items.AggregateOptions) (result map[string]interface{}, err error) {
-	labels := prometheus.Labels{"service": m.serviceName, "method": "Aggregate"}
-	timer := prometheus.NewTimer(m.requestMetrics.DurationSeconds.With(labels))
-	defer timer.ObserveDuration()
-	m.requestMetrics.Total.With(labels).Inc()
-	result, err = m.next.Aggregate(ctx, spaceId, envId, collectionId, filter, options...)
-	if err != nil {
-		m.requestMetrics.FailedTotal.With(labels).Inc()
-		return
-	}
-	return
-}
-
-// AggregatePublished implements items.Items
-func (m metricsMiddleware) AggregatePublished(ctx context.Context, spaceId string, envId string, collectionId string, filter *items.Filter, options ...*items.AggregatePublishedOptions) (result map[string]interface{}, err error) {
-	labels := prometheus.Labels{"service": m.serviceName, "method": "AggregatePublished"}
-	timer := prometheus.NewTimer(m.requestMetrics.DurationSeconds.With(labels))
-	defer timer.ObserveDuration()
-	m.requestMetrics.Total.With(labels).Inc()
-	result, err = m.next.AggregatePublished(ctx, spaceId, envId, collectionId, filter, options...)
-	if err != nil {
-		m.requestMetrics.FailedTotal.With(labels).Inc()
-		return
-	}
-	return
-}
-
-// Archive implements items.Items
-func (m metricsMiddleware) Archive(ctx context.Context, item *items.Item, options ...*items.ArchiveOptions) (err error) {
-	labels := prometheus.Labels{"service": m.serviceName, "method": "Archive"}
-	timer := prometheus.NewTimer(m.requestMetrics.DurationSeconds.With(labels))
-	defer timer.ObserveDuration()
-	m.requestMetrics.Total.With(labels).Inc()
-	err = m.next.Archive(ctx, item, options...)
-	if err != nil {
-		m.requestMetrics.FailedTotal.With(labels).Inc()
-		return
-	}
-	return
-}
-
-// Create implements items.Items
-func (m metricsMiddleware) Create(ctx context.Context, item *items.Item, opts ...*items.CreateOptions) (created *items.Item, err error) {
-	labels := prometheus.Labels{"service": m.serviceName, "method": "Create"}
-	timer := prometheus.NewTimer(m.requestMetrics.DurationSeconds.With(labels))
-	defer timer.ObserveDuration()
-	m.requestMetrics.Total.With(labels).Inc()
-	created, err = m.next.Create(ctx, item, opts...)
-	if err != nil {
-		m.requestMetrics.FailedTotal.With(labels).Inc()
-		return
-	}
-	return
-}
-
-// Delete implements items.Items
-func (m metricsMiddleware) Delete(ctx context.Context, item *items.Item, options ...*items.DeleteOptions) (err error) {
-	labels := prometheus.Labels{"service": m.serviceName, "method": "Delete"}
-	timer := prometheus.NewTimer(m.requestMetrics.DurationSeconds.With(labels))
-	defer timer.ObserveDuration()
-	m.requestMetrics.Total.With(labels).Inc()
-	err = m.next.Delete(ctx, item, options...)
-	if err != nil {
-		m.requestMetrics.FailedTotal.With(labels).Inc()
-		return
-	}
-	return
-}
-
-// Find implements items.Items
-func (m metricsMiddleware) Find(ctx context.Context, spaceId string, envId string, collectionId string, filter *items.Filter, options ...*items.FindOptions) (items []*items.Item, total int, err error) {
-	labels := prometheus.Labels{"service": m.serviceName, "method": "Find"}
-	timer := prometheus.NewTimer(m.requestMetrics.DurationSeconds.With(labels))
-	defer timer.ObserveDuration()
-	m.requestMetrics.Total.With(labels).Inc()
-	items, total, err = m.next.Find(ctx, spaceId, envId, collectionId, filter, options...)
-	if err != nil {
-		m.requestMetrics.FailedTotal.With(labels).Inc()
-		return
-	}
-	return
-}
-
-// FindArchived implements items.Items
-func (m metricsMiddleware) FindArchived(ctx context.Context, spaceId string, envId string, collectionId string, filter *items.Filter, options ...*items.FindArchivedOptions) (items []*items.Item, total int, err error) {
-	labels := prometheus.Labels{"service": m.serviceName, "method": "FindArchived"}
-	timer := prometheus.NewTimer(m.requestMetrics.DurationSeconds.With(labels))
-	defer timer.ObserveDuration()
-	m.requestMetrics.Total.With(labels).Inc()
-	items, total, err = m.next.FindArchived(ctx, spaceId, envId, collectionId, filter, options...)
-	if err != nil {
-		m.requestMetrics.FailedTotal.With(labels).Inc()
-		return
-	}
-	return
-}
-
-// FindPublished implements items.Items
-func (m metricsMiddleware) FindPublished(ctx context.Context, spaceId string, envId string, collectionId string, filter *items.Filter, options ...*items.FindPublishedOptions) (items []*items.Item, total int, err error) {
-	labels := prometheus.Labels{"service": m.serviceName, "method": "FindPublished"}
-	timer := prometheus.NewTimer(m.requestMetrics.DurationSeconds.With(labels))
-	defer timer.ObserveDuration()
-	m.requestMetrics.Total.With(labels).Inc()
-	items, total, err = m.next.FindPublished(ctx, spaceId, envId, collectionId, filter, options...)
-	if err != nil {
-		m.requestMetrics.FailedTotal.With(labels).Inc()
-		return
-	}
-	return
-}
-
-// Get implements items.Items
-func (m metricsMiddleware) Get(ctx context.Context, spaceId string, envId string, collectionId string, itemId string, options ...*items.GetOptions) (item *items.Item, err error) {
-	labels := prometheus.Labels{"service": m.serviceName, "method": "Get"}
-	timer := prometheus.NewTimer(m.requestMetrics.DurationSeconds.With(labels))
-	defer timer.ObserveDuration()
-	m.requestMetrics.Total.With(labels).Inc()
-	item, err = m.next.Get(ctx, spaceId, envId, collectionId, itemId, options...)
-	if err != nil {
-		m.requestMetrics.FailedTotal.With(labels).Inc()
-		return
-	}
-	return
-}
-
-// GetPublished implements items.Items
-func (m metricsMiddleware) GetPublished(ctx context.Context, spaceId string, envId string, collectionId string, itemId string, options ...*items.GetPublishedOptions) (item *items.Item, err error) {
-	labels := prometheus.Labels{"service": m.serviceName, "method": "GetPublished"}
-	timer := prometheus.NewTimer(m.requestMetrics.DurationSeconds.With(labels))
-	defer timer.ObserveDuration()
-	m.requestMetrics.Total.With(labels).Inc()
-	item, err = m.next.GetPublished(ctx, spaceId, envId, collectionId, itemId, options...)
-	if err != nil {
-		m.requestMetrics.FailedTotal.With(labels).Inc()
-		return
-	}
-	return
-}
-
-// GetRevision implements items.Items
-func (m metricsMiddleware) GetRevision(ctx context.Context, spaceId string, envId string, collectionId string, itemId string, revisionId string, options ...*items.GetRevisionOptions) (item *items.Item, err error) {
-	labels := prometheus.Labels{"service": m.serviceName, "method": "GetRevision"}
-	timer := prometheus.NewTimer(m.requestMetrics.DurationSeconds.With(labels))
-	defer timer.ObserveDuration()
-	m.requestMetrics.Total.With(labels).Inc()
-	item, err = m.next.GetRevision(ctx, spaceId, envId, collectionId, itemId, revisionId, options...)
-	if err != nil {
-		m.requestMetrics.FailedTotal.With(labels).Inc()
-		return
-	}
-	return
-}
-
-// Introspect implements items.Items
-func (m metricsMiddleware) Introspect(ctx context.Context, item *items.Item, opts ...*items.IntrospectOptions) (itm *items.Item, sch *schema.Schema, err error) {
-	labels := prometheus.Labels{"service": m.serviceName, "method": "Introspect"}
-	timer := prometheus.NewTimer(m.requestMetrics.DurationSeconds.With(labels))
-	defer timer.ObserveDuration()
-	m.requestMetrics.Total.With(labels).Inc()
-	itm, sch, err = m.next.Introspect(ctx, item, opts...)
-	if err != nil {
-		m.requestMetrics.FailedTotal.With(labels).Inc()
-		return
-	}
-	return
-}
-
-// ListRevisions implements items.Items
-func (m metricsMiddleware) ListRevisions(ctx context.Context, spaceId string, envId string, collectionId string, itemId string, options ...*items.ListRevisionsOptions) (items []*items.Item, err error) {
-	labels := prometheus.Labels{"service": m.serviceName, "method": "ListRevisions"}
-	timer := prometheus.NewTimer(m.requestMetrics.DurationSeconds.With(labels))
-	defer timer.ObserveDuration()
-	m.requestMetrics.Total.With(labels).Inc()
-	items, err = m.next.ListRevisions(ctx, spaceId, envId, collectionId, itemId, options...)
-	if err != nil {
-		m.requestMetrics.FailedTotal.With(labels).Inc()
-		return
-	}
-	return
-}
-
-// Publish implements items.Items
-func (m metricsMiddleware) Publish(ctx context.Context, item *items.Item, options ...*items.PublishOptions) (err error) {
-	labels := prometheus.Labels{"service": m.serviceName, "method": "Publish"}
-	timer := prometheus.NewTimer(m.requestMetrics.DurationSeconds.With(labels))
-	defer timer.ObserveDuration()
-	m.requestMetrics.Total.With(labels).Inc()
-	err = m.next.Publish(ctx, item, options...)
-	if err != nil {
-		m.requestMetrics.FailedTotal.With(labels).Inc()
-		return
-	}
-	return
-}
-
-// Unarchive implements items.Items
-func (m metricsMiddleware) Unarchive(ctx context.Context, item *items.Item, options ...*items.UnarchiveOptions) (err error) {
-	labels := prometheus.Labels{"service": m.serviceName, "method": "Unarchive"}
-	timer := prometheus.NewTimer(m.requestMetrics.DurationSeconds.With(labels))
-	defer timer.ObserveDuration()
-	m.requestMetrics.Total.With(labels).Inc()
-	err = m.next.Unarchive(ctx, item, options...)
-	if err != nil {
-		m.requestMetrics.FailedTotal.With(labels).Inc()
-		return
-	}
-	return
-}
-
-// Undelete implements items.Items
-func (m metricsMiddleware) Undelete(ctx context.Context, item *items.Item, options ...*items.UndeleteOptions) (err error) {
-	labels := prometheus.Labels{"service": m.serviceName, "method": "Undelete"}
-	timer := prometheus.NewTimer(m.requestMetrics.DurationSeconds.With(labels))
-	defer timer.ObserveDuration()
-	m.requestMetrics.Total.With(labels).Inc()
-	err = m.next.Undelete(ctx, item, options...)
-	if err != nil {
-		m.requestMetrics.FailedTotal.With(labels).Inc()
-		return
-	}
-	return
-}
-
-// Unpublish implements items.Items
-func (m metricsMiddleware) Unpublish(ctx context.Context, item *items.Item, options ...*items.UnpublishOptions) (err error) {
-	labels := prometheus.Labels{"service": m.serviceName, "method": "Unpublish"}
-	timer := prometheus.NewTimer(m.requestMetrics.DurationSeconds.With(labels))
-	defer timer.ObserveDuration()
-	m.requestMetrics.Total.With(labels).Inc()
-	err = m.next.Unpublish(ctx, item, options...)
-	if err != nil {
-		m.requestMetrics.FailedTotal.With(labels).Inc()
-		return
-	}
-	return
-}
-
-// Update implements items.Items
-func (m metricsMiddleware) Update(ctx context.Context, item *items.Item, options ...*items.UpdateOptions) (err error) {
-	labels := prometheus.Labels{"service": m.serviceName, "method": "Update"}
-	timer := prometheus.NewTimer(m.requestMetrics.DurationSeconds.With(labels))
-	defer timer.ObserveDuration()
-	m.requestMetrics.Total.With(labels).Inc()
-	err = m.next.Update(ctx, item, options...)
-	if err != nil {
-		m.requestMetrics.FailedTotal.With(labels).Inc()
-		return
-	}
-	return
-}
diff --git a/pkg/locales/middleware/metrics_middleware.go b/pkg/locales/middleware/metrics_middleware.go
deleted file mode 100644
index 611b951b..00000000
--- a/pkg/locales/middleware/metrics_middleware.go
+++ /dev/null
@@ -1,76 +0,0 @@
-// Code generated by gowrap. DO NOT EDIT.
-// template: ../../../assets/templates/middleware/metrics
-// gowrap: http://github.com/hexdigest/gowrap
-
-package middleware
-
-//go:generate gowrap gen -p git.perx.ru/perxis/perxis-go/pkg/locales -i Locales -t ../../../assets/templates/middleware/metrics -o metrics_middleware.go -l ""
-
-import (
-	"context"
-	"strings"
-
-	"git.perx.ru/perxis/perxis-go/pkg/locales"
-	"git.perx.ru/perxis/perxis-go/pkg/metrics"
-	"github.com/prometheus/client_golang/prometheus"
-)
-
-// metricsMiddleware implements locales.Locales that is instrumented with metrics
-type metricsMiddleware struct {
-	serviceName    string
-	requestMetrics *metrics.RequestMetrics
-	next           locales.Locales
-}
-
-// MetricsMiddleware instruments an implementation of the metricsMiddleware with metrics
-func MetricsMiddleware(requestMetrics *metrics.RequestMetrics) Middleware {
-	return func(next locales.Locales) locales.Locales {
-		return &metricsMiddleware{
-			serviceName:    strings.ToLower("Locales"),
-			requestMetrics: requestMetrics,
-			next:           next,
-		}
-	}
-}
-
-// Create implements locales.Locales
-func (m metricsMiddleware) Create(ctx context.Context, locale *locales.Locale) (created *locales.Locale, err error) {
-	labels := prometheus.Labels{"service": m.serviceName, "method": "Create"}
-	timer := prometheus.NewTimer(m.requestMetrics.DurationSeconds.With(labels))
-	defer timer.ObserveDuration()
-	m.requestMetrics.Total.With(labels).Inc()
-	created, err = m.next.Create(ctx, locale)
-	if err != nil {
-		m.requestMetrics.FailedTotal.With(labels).Inc()
-		return
-	}
-	return
-}
-
-// Delete implements locales.Locales
-func (m metricsMiddleware) Delete(ctx context.Context, spaceId string, localeId string) (err error) {
-	labels := prometheus.Labels{"service": m.serviceName, "method": "Delete"}
-	timer := prometheus.NewTimer(m.requestMetrics.DurationSeconds.With(labels))
-	defer timer.ObserveDuration()
-	m.requestMetrics.Total.With(labels).Inc()
-	err = m.next.Delete(ctx, spaceId, localeId)
-	if err != nil {
-		m.requestMetrics.FailedTotal.With(labels).Inc()
-		return
-	}
-	return
-}
-
-// List implements locales.Locales
-func (m metricsMiddleware) List(ctx context.Context, spaceId string) (locales []*locales.Locale, err error) {
-	labels := prometheus.Labels{"service": m.serviceName, "method": "List"}
-	timer := prometheus.NewTimer(m.requestMetrics.DurationSeconds.With(labels))
-	defer timer.ObserveDuration()
-	m.requestMetrics.Total.With(labels).Inc()
-	locales, err = m.next.List(ctx, spaceId)
-	if err != nil {
-		m.requestMetrics.FailedTotal.With(labels).Inc()
-		return
-	}
-	return
-}
diff --git a/pkg/members/middleware/metrics_middleware.go b/pkg/members/middleware/metrics_middleware.go
deleted file mode 100644
index f15d5078..00000000
--- a/pkg/members/middleware/metrics_middleware.go
+++ /dev/null
@@ -1,118 +0,0 @@
-// Code generated by gowrap. DO NOT EDIT.
-// template: ../../../assets/templates/middleware/metrics
-// gowrap: http://github.com/hexdigest/gowrap
-
-package middleware
-
-//go:generate gowrap gen -p git.perx.ru/perxis/perxis-go/pkg/members -i Members -t ../../../assets/templates/middleware/metrics -o metrics_middleware.go -l ""
-
-import (
-	"context"
-	"strings"
-
-	"git.perx.ru/perxis/perxis-go/pkg/members"
-	"git.perx.ru/perxis/perxis-go/pkg/metrics"
-	"github.com/prometheus/client_golang/prometheus"
-)
-
-// metricsMiddleware implements members.Members that is instrumented with metrics
-type metricsMiddleware struct {
-	serviceName    string
-	requestMetrics *metrics.RequestMetrics
-	next           members.Members
-}
-
-// MetricsMiddleware instruments an implementation of the metricsMiddleware with metrics
-func MetricsMiddleware(requestMetrics *metrics.RequestMetrics) Middleware {
-	return func(next members.Members) members.Members {
-		return &metricsMiddleware{
-			serviceName:    strings.ToLower("Members"),
-			requestMetrics: requestMetrics,
-			next:           next,
-		}
-	}
-}
-
-// Get implements members.Members
-func (m metricsMiddleware) Get(ctx context.Context, orgId string, userId string) (role members.Role, err error) {
-	labels := prometheus.Labels{"service": m.serviceName, "method": "Get"}
-	timer := prometheus.NewTimer(m.requestMetrics.DurationSeconds.With(labels))
-	defer timer.ObserveDuration()
-	m.requestMetrics.Total.With(labels).Inc()
-	role, err = m.next.Get(ctx, orgId, userId)
-	if err != nil {
-		m.requestMetrics.FailedTotal.With(labels).Inc()
-		return
-	}
-	return
-}
-
-// ListMembers implements members.Members
-func (m metricsMiddleware) ListMembers(ctx context.Context, orgId string) (members []*members.Member, err error) {
-	labels := prometheus.Labels{"service": m.serviceName, "method": "ListMembers"}
-	timer := prometheus.NewTimer(m.requestMetrics.DurationSeconds.With(labels))
-	defer timer.ObserveDuration()
-	m.requestMetrics.Total.With(labels).Inc()
-	members, err = m.next.ListMembers(ctx, orgId)
-	if err != nil {
-		m.requestMetrics.FailedTotal.With(labels).Inc()
-		return
-	}
-	return
-}
-
-// ListOrganizations implements members.Members
-func (m metricsMiddleware) ListOrganizations(ctx context.Context, userId string) (organizations []*members.Member, err error) {
-	labels := prometheus.Labels{"service": m.serviceName, "method": "ListOrganizations"}
-	timer := prometheus.NewTimer(m.requestMetrics.DurationSeconds.With(labels))
-	defer timer.ObserveDuration()
-	m.requestMetrics.Total.With(labels).Inc()
-	organizations, err = m.next.ListOrganizations(ctx, userId)
-	if err != nil {
-		m.requestMetrics.FailedTotal.With(labels).Inc()
-		return
-	}
-	return
-}
-
-// Remove implements members.Members
-func (m metricsMiddleware) Remove(ctx context.Context, orgId string, userId string) (err error) {
-	labels := prometheus.Labels{"service": m.serviceName, "method": "Remove"}
-	timer := prometheus.NewTimer(m.requestMetrics.DurationSeconds.With(labels))
-	defer timer.ObserveDuration()
-	m.requestMetrics.Total.With(labels).Inc()
-	err = m.next.Remove(ctx, orgId, userId)
-	if err != nil {
-		m.requestMetrics.FailedTotal.With(labels).Inc()
-		return
-	}
-	return
-}
-
-// RemoveAll implements members.Members
-func (m metricsMiddleware) RemoveAll(ctx context.Context, orgId string) (err error) {
-	labels := prometheus.Labels{"service": m.serviceName, "method": "RemoveAll"}
-	timer := prometheus.NewTimer(m.requestMetrics.DurationSeconds.With(labels))
-	defer timer.ObserveDuration()
-	m.requestMetrics.Total.With(labels).Inc()
-	err = m.next.RemoveAll(ctx, orgId)
-	if err != nil {
-		m.requestMetrics.FailedTotal.With(labels).Inc()
-		return
-	}
-	return
-}
-
-// Set implements members.Members
-func (m metricsMiddleware) Set(ctx context.Context, orgId string, userId string, role members.Role) (err error) {
-	labels := prometheus.Labels{"service": m.serviceName, "method": "Set"}
-	timer := prometheus.NewTimer(m.requestMetrics.DurationSeconds.With(labels))
-	defer timer.ObserveDuration()
-	m.requestMetrics.Total.With(labels).Inc()
-	err = m.next.Set(ctx, orgId, userId, role)
-	if err != nil {
-		m.requestMetrics.FailedTotal.With(labels).Inc()
-		return
-	}
-	return
-}
diff --git a/pkg/organizations/middleware/metrics_middleware.go b/pkg/organizations/middleware/metrics_middleware.go
deleted file mode 100644
index 2d5dff8e..00000000
--- a/pkg/organizations/middleware/metrics_middleware.go
+++ /dev/null
@@ -1,105 +0,0 @@
-// Code generated by gowrap. DO NOT EDIT.
-// template: ../../../assets/templates/middleware/metrics
-// gowrap: http://github.com/hexdigest/gowrap
-
-package middleware
-
-//go:generate gowrap gen -p git.perx.ru/perxis/perxis-go/pkg/organizations -i Organizations -t ../../../assets/templates/middleware/metrics -o metrics_middleware.go -l ""
-
-import (
-	"context"
-	"strings"
-
-	"git.perx.ru/perxis/perxis-go/pkg/metrics"
-	"git.perx.ru/perxis/perxis-go/pkg/options"
-	"git.perx.ru/perxis/perxis-go/pkg/organizations"
-	"github.com/prometheus/client_golang/prometheus"
-)
-
-// metricsMiddleware implements organizations.Organizations that is instrumented with metrics
-type metricsMiddleware struct {
-	serviceName    string
-	requestMetrics *metrics.RequestMetrics
-	next           organizations.Organizations
-}
-
-// MetricsMiddleware instruments an implementation of the metricsMiddleware with metrics
-func MetricsMiddleware(requestMetrics *metrics.RequestMetrics) Middleware {
-	return func(next organizations.Organizations) organizations.Organizations {
-		return &metricsMiddleware{
-			serviceName:    strings.ToLower("Organizations"),
-			requestMetrics: requestMetrics,
-			next:           next,
-		}
-	}
-}
-
-// Create implements organizations.Organizations
-func (m metricsMiddleware) Create(ctx context.Context, org *organizations.Organization) (created *organizations.Organization, err error) {
-	labels := prometheus.Labels{"service": m.serviceName, "method": "Create"}
-	timer := prometheus.NewTimer(m.requestMetrics.DurationSeconds.With(labels))
-	defer timer.ObserveDuration()
-	m.requestMetrics.Total.With(labels).Inc()
-	created, err = m.next.Create(ctx, org)
-	if err != nil {
-		m.requestMetrics.FailedTotal.With(labels).Inc()
-		return
-	}
-	return
-}
-
-// Delete implements organizations.Organizations
-func (m metricsMiddleware) Delete(ctx context.Context, orgId string) (err error) {
-	labels := prometheus.Labels{"service": m.serviceName, "method": "Delete"}
-	timer := prometheus.NewTimer(m.requestMetrics.DurationSeconds.With(labels))
-	defer timer.ObserveDuration()
-	m.requestMetrics.Total.With(labels).Inc()
-	err = m.next.Delete(ctx, orgId)
-	if err != nil {
-		m.requestMetrics.FailedTotal.With(labels).Inc()
-		return
-	}
-	return
-}
-
-// Find implements organizations.Organizations
-func (m metricsMiddleware) Find(ctx context.Context, filter *organizations.Filter, opts *options.FindOptions) (orgs []*organizations.Organization, total int, err error) {
-	labels := prometheus.Labels{"service": m.serviceName, "method": "Find"}
-	timer := prometheus.NewTimer(m.requestMetrics.DurationSeconds.With(labels))
-	defer timer.ObserveDuration()
-	m.requestMetrics.Total.With(labels).Inc()
-	orgs, total, err = m.next.Find(ctx, filter, opts)
-	if err != nil {
-		m.requestMetrics.FailedTotal.With(labels).Inc()
-		return
-	}
-	return
-}
-
-// Get implements organizations.Organizations
-func (m metricsMiddleware) Get(ctx context.Context, orgId string) (org *organizations.Organization, err error) {
-	labels := prometheus.Labels{"service": m.serviceName, "method": "Get"}
-	timer := prometheus.NewTimer(m.requestMetrics.DurationSeconds.With(labels))
-	defer timer.ObserveDuration()
-	m.requestMetrics.Total.With(labels).Inc()
-	org, err = m.next.Get(ctx, orgId)
-	if err != nil {
-		m.requestMetrics.FailedTotal.With(labels).Inc()
-		return
-	}
-	return
-}
-
-// Update implements organizations.Organizations
-func (m metricsMiddleware) Update(ctx context.Context, org *organizations.Organization) (err error) {
-	labels := prometheus.Labels{"service": m.serviceName, "method": "Update"}
-	timer := prometheus.NewTimer(m.requestMetrics.DurationSeconds.With(labels))
-	defer timer.ObserveDuration()
-	m.requestMetrics.Total.With(labels).Inc()
-	err = m.next.Update(ctx, org)
-	if err != nil {
-		m.requestMetrics.FailedTotal.With(labels).Inc()
-		return
-	}
-	return
-}
diff --git a/pkg/references/middleware/metrics_middleware.go b/pkg/references/middleware/metrics_middleware.go
deleted file mode 100644
index 119a1b75..00000000
--- a/pkg/references/middleware/metrics_middleware.go
+++ /dev/null
@@ -1,63 +0,0 @@
-// Code generated by gowrap. DO NOT EDIT.
-// template: ../../../assets/templates/middleware/metrics
-// gowrap: http://github.com/hexdigest/gowrap
-
-package middleware
-
-//go:generate gowrap gen -p git.perx.ru/perxis/perxis-go/pkg/references -i References -t ../../../assets/templates/middleware/metrics -o metrics_middleware.go -l ""
-
-import (
-	"context"
-	"strings"
-
-	"git.perx.ru/perxis/perxis-go/pkg/items"
-	"git.perx.ru/perxis/perxis-go/pkg/metrics"
-	"git.perx.ru/perxis/perxis-go/pkg/references"
-	"github.com/prometheus/client_golang/prometheus"
-)
-
-// metricsMiddleware implements references.References that is instrumented with metrics
-type metricsMiddleware struct {
-	serviceName    string
-	requestMetrics *metrics.RequestMetrics
-	next           references.References
-}
-
-// MetricsMiddleware instruments an implementation of the metricsMiddleware with metrics
-func MetricsMiddleware(requestMetrics *metrics.RequestMetrics) Middleware {
-	return func(next references.References) references.References {
-		return &metricsMiddleware{
-			serviceName:    strings.ToLower("References"),
-			requestMetrics: requestMetrics,
-			next:           next,
-		}
-	}
-}
-
-// Get implements references.References
-func (m metricsMiddleware) Get(ctx context.Context, spaceId string, envId string, references []*references.Reference) (items []*items.Item, notfound []*references.Reference, err error) {
-	labels := prometheus.Labels{"service": m.serviceName, "method": "Get"}
-	timer := prometheus.NewTimer(m.requestMetrics.DurationSeconds.With(labels))
-	defer timer.ObserveDuration()
-	m.requestMetrics.Total.With(labels).Inc()
-	items, notfound, err = m.next.Get(ctx, spaceId, envId, references)
-	if err != nil {
-		m.requestMetrics.FailedTotal.With(labels).Inc()
-		return
-	}
-	return
-}
-
-// Publish implements references.References
-func (m metricsMiddleware) Publish(ctx context.Context, spaceId string, envId string, references []*references.Reference, recursive bool, force bool) (published []*references.Reference, notfound []*references.Reference, unpublished []*references.Reference, err error) {
-	labels := prometheus.Labels{"service": m.serviceName, "method": "Publish"}
-	timer := prometheus.NewTimer(m.requestMetrics.DurationSeconds.With(labels))
-	defer timer.ObserveDuration()
-	m.requestMetrics.Total.With(labels).Inc()
-	published, notfound, unpublished, err = m.next.Publish(ctx, spaceId, envId, references, recursive, force)
-	if err != nil {
-		m.requestMetrics.FailedTotal.With(labels).Inc()
-		return
-	}
-	return
-}
diff --git a/pkg/roles/middleware/metrics_middleware.go b/pkg/roles/middleware/metrics_middleware.go
deleted file mode 100644
index 0280d5cf..00000000
--- a/pkg/roles/middleware/metrics_middleware.go
+++ /dev/null
@@ -1,104 +0,0 @@
-// Code generated by gowrap. DO NOT EDIT.
-// template: ../../../assets/templates/middleware/metrics
-// gowrap: http://github.com/hexdigest/gowrap
-
-package middleware
-
-//go:generate gowrap gen -p git.perx.ru/perxis/perxis-go/pkg/roles -i Roles -t ../../../assets/templates/middleware/metrics -o metrics_middleware.go -l ""
-
-import (
-	"context"
-	"strings"
-
-	"git.perx.ru/perxis/perxis-go/pkg/metrics"
-	"git.perx.ru/perxis/perxis-go/pkg/roles"
-	"github.com/prometheus/client_golang/prometheus"
-)
-
-// metricsMiddleware implements roles.Roles that is instrumented with metrics
-type metricsMiddleware struct {
-	serviceName    string
-	requestMetrics *metrics.RequestMetrics
-	next           roles.Roles
-}
-
-// MetricsMiddleware instruments an implementation of the metricsMiddleware with metrics
-func MetricsMiddleware(requestMetrics *metrics.RequestMetrics) Middleware {
-	return func(next roles.Roles) roles.Roles {
-		return &metricsMiddleware{
-			serviceName:    strings.ToLower("Roles"),
-			requestMetrics: requestMetrics,
-			next:           next,
-		}
-	}
-}
-
-// Create implements roles.Roles
-func (m metricsMiddleware) Create(ctx context.Context, role *roles.Role) (created *roles.Role, err error) {
-	labels := prometheus.Labels{"service": m.serviceName, "method": "Create"}
-	timer := prometheus.NewTimer(m.requestMetrics.DurationSeconds.With(labels))
-	defer timer.ObserveDuration()
-	m.requestMetrics.Total.With(labels).Inc()
-	created, err = m.next.Create(ctx, role)
-	if err != nil {
-		m.requestMetrics.FailedTotal.With(labels).Inc()
-		return
-	}
-	return
-}
-
-// Delete implements roles.Roles
-func (m metricsMiddleware) Delete(ctx context.Context, spaceId string, roleId string) (err error) {
-	labels := prometheus.Labels{"service": m.serviceName, "method": "Delete"}
-	timer := prometheus.NewTimer(m.requestMetrics.DurationSeconds.With(labels))
-	defer timer.ObserveDuration()
-	m.requestMetrics.Total.With(labels).Inc()
-	err = m.next.Delete(ctx, spaceId, roleId)
-	if err != nil {
-		m.requestMetrics.FailedTotal.With(labels).Inc()
-		return
-	}
-	return
-}
-
-// Get implements roles.Roles
-func (m metricsMiddleware) Get(ctx context.Context, spaceId string, roleId string) (role *roles.Role, err error) {
-	labels := prometheus.Labels{"service": m.serviceName, "method": "Get"}
-	timer := prometheus.NewTimer(m.requestMetrics.DurationSeconds.With(labels))
-	defer timer.ObserveDuration()
-	m.requestMetrics.Total.With(labels).Inc()
-	role, err = m.next.Get(ctx, spaceId, roleId)
-	if err != nil {
-		m.requestMetrics.FailedTotal.With(labels).Inc()
-		return
-	}
-	return
-}
-
-// List implements roles.Roles
-func (m metricsMiddleware) List(ctx context.Context, spaceId string) (roles []*roles.Role, err error) {
-	labels := prometheus.Labels{"service": m.serviceName, "method": "List"}
-	timer := prometheus.NewTimer(m.requestMetrics.DurationSeconds.With(labels))
-	defer timer.ObserveDuration()
-	m.requestMetrics.Total.With(labels).Inc()
-	roles, err = m.next.List(ctx, spaceId)
-	if err != nil {
-		m.requestMetrics.FailedTotal.With(labels).Inc()
-		return
-	}
-	return
-}
-
-// Update implements roles.Roles
-func (m metricsMiddleware) Update(ctx context.Context, role *roles.Role) (err error) {
-	labels := prometheus.Labels{"service": m.serviceName, "method": "Update"}
-	timer := prometheus.NewTimer(m.requestMetrics.DurationSeconds.With(labels))
-	defer timer.ObserveDuration()
-	m.requestMetrics.Total.With(labels).Inc()
-	err = m.next.Update(ctx, role)
-	if err != nil {
-		m.requestMetrics.FailedTotal.With(labels).Inc()
-		return
-	}
-	return
-}
diff --git a/pkg/spaces/middleware/metrics_middleware.go b/pkg/spaces/middleware/metrics_middleware.go
deleted file mode 100644
index b9cecf1d..00000000
--- a/pkg/spaces/middleware/metrics_middleware.go
+++ /dev/null
@@ -1,174 +0,0 @@
-// Code generated by gowrap. DO NOT EDIT.
-// template: ../../../assets/templates/middleware/metrics
-// gowrap: http://github.com/hexdigest/gowrap
-
-package middleware
-
-//go:generate gowrap gen -p git.perx.ru/perxis/perxis-go/pkg/spaces -i Spaces -t ../../../assets/templates/middleware/metrics -o metrics_middleware.go -l ""
-
-import (
-	"context"
-	"strings"
-
-	"git.perx.ru/perxis/perxis-go/pkg/metrics"
-	"git.perx.ru/perxis/perxis-go/pkg/spaces"
-	"github.com/prometheus/client_golang/prometheus"
-)
-
-// metricsMiddleware implements spaces.Spaces that is instrumented with metrics
-type metricsMiddleware struct {
-	serviceName    string
-	requestMetrics *metrics.RequestMetrics
-	next           spaces.Spaces
-}
-
-// MetricsMiddleware instruments an implementation of the metricsMiddleware with metrics
-func MetricsMiddleware(requestMetrics *metrics.RequestMetrics) Middleware {
-	return func(next spaces.Spaces) spaces.Spaces {
-		return &metricsMiddleware{
-			serviceName:    strings.ToLower("Spaces"),
-			requestMetrics: requestMetrics,
-			next:           next,
-		}
-	}
-}
-
-// AbortTransfer implements spaces.Spaces
-func (m metricsMiddleware) AbortTransfer(ctx context.Context, spaceID string) (err error) {
-	labels := prometheus.Labels{"service": m.serviceName, "method": "AbortTransfer"}
-	timer := prometheus.NewTimer(m.requestMetrics.DurationSeconds.With(labels))
-	defer timer.ObserveDuration()
-	m.requestMetrics.Total.With(labels).Inc()
-	err = m.next.AbortTransfer(ctx, spaceID)
-	if err != nil {
-		m.requestMetrics.FailedTotal.With(labels).Inc()
-		return
-	}
-	return
-}
-
-// Create implements spaces.Spaces
-func (m metricsMiddleware) Create(ctx context.Context, space *spaces.Space) (created *spaces.Space, err error) {
-	labels := prometheus.Labels{"service": m.serviceName, "method": "Create"}
-	timer := prometheus.NewTimer(m.requestMetrics.DurationSeconds.With(labels))
-	defer timer.ObserveDuration()
-	m.requestMetrics.Total.With(labels).Inc()
-	created, err = m.next.Create(ctx, space)
-	if err != nil {
-		m.requestMetrics.FailedTotal.With(labels).Inc()
-		return
-	}
-	return
-}
-
-// Delete implements spaces.Spaces
-func (m metricsMiddleware) Delete(ctx context.Context, spaceId string) (err error) {
-	labels := prometheus.Labels{"service": m.serviceName, "method": "Delete"}
-	timer := prometheus.NewTimer(m.requestMetrics.DurationSeconds.With(labels))
-	defer timer.ObserveDuration()
-	m.requestMetrics.Total.With(labels).Inc()
-	err = m.next.Delete(ctx, spaceId)
-	if err != nil {
-		m.requestMetrics.FailedTotal.With(labels).Inc()
-		return
-	}
-	return
-}
-
-// Get implements spaces.Spaces
-func (m metricsMiddleware) Get(ctx context.Context, spaceId string) (space *spaces.Space, err error) {
-	labels := prometheus.Labels{"service": m.serviceName, "method": "Get"}
-	timer := prometheus.NewTimer(m.requestMetrics.DurationSeconds.With(labels))
-	defer timer.ObserveDuration()
-	m.requestMetrics.Total.With(labels).Inc()
-	space, err = m.next.Get(ctx, spaceId)
-	if err != nil {
-		m.requestMetrics.FailedTotal.With(labels).Inc()
-		return
-	}
-	return
-}
-
-// List implements spaces.Spaces
-func (m metricsMiddleware) List(ctx context.Context, orgId string) (spaces []*spaces.Space, err error) {
-	labels := prometheus.Labels{"service": m.serviceName, "method": "List"}
-	timer := prometheus.NewTimer(m.requestMetrics.DurationSeconds.With(labels))
-	defer timer.ObserveDuration()
-	m.requestMetrics.Total.With(labels).Inc()
-	spaces, err = m.next.List(ctx, orgId)
-	if err != nil {
-		m.requestMetrics.FailedTotal.With(labels).Inc()
-		return
-	}
-	return
-}
-
-// ListTransfers implements spaces.Spaces
-func (m metricsMiddleware) ListTransfers(ctx context.Context, orgID string) (spaces []*spaces.Space, err error) {
-	labels := prometheus.Labels{"service": m.serviceName, "method": "ListTransfers"}
-	timer := prometheus.NewTimer(m.requestMetrics.DurationSeconds.With(labels))
-	defer timer.ObserveDuration()
-	m.requestMetrics.Total.With(labels).Inc()
-	spaces, err = m.next.ListTransfers(ctx, orgID)
-	if err != nil {
-		m.requestMetrics.FailedTotal.With(labels).Inc()
-		return
-	}
-	return
-}
-
-// Move implements spaces.Spaces
-func (m metricsMiddleware) Move(ctx context.Context, spaceID string, orgID string) (err error) {
-	labels := prometheus.Labels{"service": m.serviceName, "method": "Move"}
-	timer := prometheus.NewTimer(m.requestMetrics.DurationSeconds.With(labels))
-	defer timer.ObserveDuration()
-	m.requestMetrics.Total.With(labels).Inc()
-	err = m.next.Move(ctx, spaceID, orgID)
-	if err != nil {
-		m.requestMetrics.FailedTotal.With(labels).Inc()
-		return
-	}
-	return
-}
-
-// Transfer implements spaces.Spaces
-func (m metricsMiddleware) Transfer(ctx context.Context, spaceID string, transferToOrg string) (err error) {
-	labels := prometheus.Labels{"service": m.serviceName, "method": "Transfer"}
-	timer := prometheus.NewTimer(m.requestMetrics.DurationSeconds.With(labels))
-	defer timer.ObserveDuration()
-	m.requestMetrics.Total.With(labels).Inc()
-	err = m.next.Transfer(ctx, spaceID, transferToOrg)
-	if err != nil {
-		m.requestMetrics.FailedTotal.With(labels).Inc()
-		return
-	}
-	return
-}
-
-// Update implements spaces.Spaces
-func (m metricsMiddleware) Update(ctx context.Context, space *spaces.Space) (err error) {
-	labels := prometheus.Labels{"service": m.serviceName, "method": "Update"}
-	timer := prometheus.NewTimer(m.requestMetrics.DurationSeconds.With(labels))
-	defer timer.ObserveDuration()
-	m.requestMetrics.Total.With(labels).Inc()
-	err = m.next.Update(ctx, space)
-	if err != nil {
-		m.requestMetrics.FailedTotal.With(labels).Inc()
-		return
-	}
-	return
-}
-
-// UpdateConfig implements spaces.Spaces
-func (m metricsMiddleware) UpdateConfig(ctx context.Context, spaceId string, config *spaces.Config) (err error) {
-	labels := prometheus.Labels{"service": m.serviceName, "method": "UpdateConfig"}
-	timer := prometheus.NewTimer(m.requestMetrics.DurationSeconds.With(labels))
-	defer timer.ObserveDuration()
-	m.requestMetrics.Total.With(labels).Inc()
-	err = m.next.UpdateConfig(ctx, spaceId, config)
-	if err != nil {
-		m.requestMetrics.FailedTotal.With(labels).Inc()
-		return
-	}
-	return
-}
diff --git a/pkg/users/middleware/metrics_middleware.go b/pkg/users/middleware/metrics_middleware.go
deleted file mode 100644
index fb55d90b..00000000
--- a/pkg/users/middleware/metrics_middleware.go
+++ /dev/null
@@ -1,119 +0,0 @@
-// Code generated by gowrap. DO NOT EDIT.
-// template: ../../../assets/templates/middleware/metrics
-// gowrap: http://github.com/hexdigest/gowrap
-
-package middleware
-
-//go:generate gowrap gen -p git.perx.ru/perxis/perxis-go/pkg/users -i Users -t ../../../assets/templates/middleware/metrics -o metrics_middleware.go -l ""
-
-import (
-	"context"
-	"strings"
-
-	"git.perx.ru/perxis/perxis-go/pkg/metrics"
-	"git.perx.ru/perxis/perxis-go/pkg/options"
-	"git.perx.ru/perxis/perxis-go/pkg/users"
-	"github.com/prometheus/client_golang/prometheus"
-)
-
-// metricsMiddleware implements users.Users that is instrumented with metrics
-type metricsMiddleware struct {
-	serviceName    string
-	requestMetrics *metrics.RequestMetrics
-	next           users.Users
-}
-
-// MetricsMiddleware instruments an implementation of the metricsMiddleware with metrics
-func MetricsMiddleware(requestMetrics *metrics.RequestMetrics) Middleware {
-	return func(next users.Users) users.Users {
-		return &metricsMiddleware{
-			serviceName:    strings.ToLower("Users"),
-			requestMetrics: requestMetrics,
-			next:           next,
-		}
-	}
-}
-
-// Create implements users.Users
-func (m metricsMiddleware) Create(ctx context.Context, create *users.User) (user *users.User, err error) {
-	labels := prometheus.Labels{"service": m.serviceName, "method": "Create"}
-	timer := prometheus.NewTimer(m.requestMetrics.DurationSeconds.With(labels))
-	defer timer.ObserveDuration()
-	m.requestMetrics.Total.With(labels).Inc()
-	user, err = m.next.Create(ctx, create)
-	if err != nil {
-		m.requestMetrics.FailedTotal.With(labels).Inc()
-		return
-	}
-	return
-}
-
-// Delete implements users.Users
-func (m metricsMiddleware) Delete(ctx context.Context, userId string) (err error) {
-	labels := prometheus.Labels{"service": m.serviceName, "method": "Delete"}
-	timer := prometheus.NewTimer(m.requestMetrics.DurationSeconds.With(labels))
-	defer timer.ObserveDuration()
-	m.requestMetrics.Total.With(labels).Inc()
-	err = m.next.Delete(ctx, userId)
-	if err != nil {
-		m.requestMetrics.FailedTotal.With(labels).Inc()
-		return
-	}
-	return
-}
-
-// Find implements users.Users
-func (m metricsMiddleware) Find(ctx context.Context, filter *users.Filter, options *options.FindOptions) (users []*users.User, total int, err error) {
-	labels := prometheus.Labels{"service": m.serviceName, "method": "Find"}
-	timer := prometheus.NewTimer(m.requestMetrics.DurationSeconds.With(labels))
-	defer timer.ObserveDuration()
-	m.requestMetrics.Total.With(labels).Inc()
-	users, total, err = m.next.Find(ctx, filter, options)
-	if err != nil {
-		m.requestMetrics.FailedTotal.With(labels).Inc()
-		return
-	}
-	return
-}
-
-// Get implements users.Users
-func (m metricsMiddleware) Get(ctx context.Context, userId string) (user *users.User, err error) {
-	labels := prometheus.Labels{"service": m.serviceName, "method": "Get"}
-	timer := prometheus.NewTimer(m.requestMetrics.DurationSeconds.With(labels))
-	defer timer.ObserveDuration()
-	m.requestMetrics.Total.With(labels).Inc()
-	user, err = m.next.Get(ctx, userId)
-	if err != nil {
-		m.requestMetrics.FailedTotal.With(labels).Inc()
-		return
-	}
-	return
-}
-
-// GetByIdentity implements users.Users
-func (m metricsMiddleware) GetByIdentity(ctx context.Context, identity string) (user *users.User, err error) {
-	labels := prometheus.Labels{"service": m.serviceName, "method": "GetByIdentity"}
-	timer := prometheus.NewTimer(m.requestMetrics.DurationSeconds.With(labels))
-	defer timer.ObserveDuration()
-	m.requestMetrics.Total.With(labels).Inc()
-	user, err = m.next.GetByIdentity(ctx, identity)
-	if err != nil {
-		m.requestMetrics.FailedTotal.With(labels).Inc()
-		return
-	}
-	return
-}
-
-// Update implements users.Users
-func (m metricsMiddleware) Update(ctx context.Context, update *users.User) (err error) {
-	labels := prometheus.Labels{"service": m.serviceName, "method": "Update"}
-	timer := prometheus.NewTimer(m.requestMetrics.DurationSeconds.With(labels))
-	defer timer.ObserveDuration()
-	m.requestMetrics.Total.With(labels).Inc()
-	err = m.next.Update(ctx, update)
-	if err != nil {
-		m.requestMetrics.FailedTotal.With(labels).Inc()
-		return
-	}
-	return
-}
-- 
GitLab