diff --git a/assets/templates/middleware/telemetry_content b/assets/templates/middleware/telemetry_content index 7adcd36c4aef3ea9f3077fcd0771d50c34d406fb..1b6bfb88db7b026a7ff26f4f43a3248ded793bfa 100644 --- a/assets/templates/middleware/telemetry_content +++ b/assets/templates/middleware/telemetry_content @@ -5,7 +5,7 @@ import ( "git.perx.ru/perxis/perxis-go/pkg/telemetry/metrics" "go.opentelemetry.io/otel" "go.opentelemetry.io/otel/attribute" - oid "git.perx.ru/perxis/perxis-go/id" + pkgId "git.perx.ru/perxis/perxis-go/id" otelmetric "go.opentelemetry.io/otel/metric" "go.opentelemetry.io/otel/trace" ) diff --git a/assets/templates/middleware/telemetry_default b/assets/templates/middleware/telemetry_default index 6616504f1f5db9bd0126eba40dd5b7f8f4d718a0..80be072acbf15562306a1b3514fb00e582b323f3 100644 --- a/assets/templates/middleware/telemetry_default +++ b/assets/templates/middleware/telemetry_default @@ -5,7 +5,7 @@ import ( "git.perx.ru/perxis/perxis-go/pkg/telemetry/metrics" "go.opentelemetry.io/otel" "go.opentelemetry.io/otel/attribute" - oid "git.perx.ru/perxis/perxis-go/id" + pkgId "git.perx.ru/perxis/perxis-go/id" otelmetric "go.opentelemetry.io/otel/metric" "go.opentelemetry.io/otel/trace" ) diff --git a/images/middleware/telemetry_middleware.go b/images/middleware/telemetry_middleware.go index 36d09a320a2bd7fa92ceaa341fad44c89989942b..8eafa0290bfea3ec536167b6ebc64013db7aa212 100644 --- a/images/middleware/telemetry_middleware.go +++ b/images/middleware/telemetry_middleware.go @@ -10,7 +10,7 @@ import ( "context" "time" - oid "git.perx.ru/perxis/perxis-go/id" + pkgId "git.perx.ru/perxis/perxis-go/id" "git.perx.ru/perxis/perxis-go/images" "git.perx.ru/perxis/perxis-go/pkg/auth" "git.perx.ru/perxis/perxis-go/pkg/files" @@ -69,7 +69,7 @@ func (_d telemetryMiddleware) Get(ctx context.Context, source *files.File, opts _d.requestMetrics.DurationMilliseconds.Record(ctx, time.Since(start).Milliseconds(), attributes) - caller, _ := oid.NewObjectId(auth.GetPrincipal(ctx)) + caller, _ := pkgId.NewObjectId(auth.GetPrincipal(ctx)) if caller != nil { att = append(att, attribute.String("caller", caller.String())) } diff --git a/logs/middleware/telemetry_middleware.go b/logs/middleware/telemetry_middleware.go index 3731386368aeb9cdd4678a1e3bd65d892798c610..c85083ee29f676321c8f6bcf445c6e5c0f8afe45 100644 --- a/logs/middleware/telemetry_middleware.go +++ b/logs/middleware/telemetry_middleware.go @@ -10,7 +10,7 @@ import ( "context" "time" - oid "git.perx.ru/perxis/perxis-go/id" + pkgId "git.perx.ru/perxis/perxis-go/id" "git.perx.ru/perxis/perxis-go/logs" "git.perx.ru/perxis/perxis-go/pkg/auth" "git.perx.ru/perxis/perxis-go/pkg/options" @@ -69,7 +69,7 @@ func (_d telemetryMiddleware) Delete(ctx context.Context, filter *logs.Filter) ( _d.requestMetrics.DurationMilliseconds.Record(ctx, time.Since(start).Milliseconds(), attributes) - caller, _ := oid.NewObjectId(auth.GetPrincipal(ctx)) + caller, _ := pkgId.NewObjectId(auth.GetPrincipal(ctx)) if caller != nil { att = append(att, attribute.String("caller", caller.String())) } @@ -108,7 +108,7 @@ func (_d telemetryMiddleware) Find(ctx context.Context, filter *logs.Filter, opt _d.requestMetrics.DurationMilliseconds.Record(ctx, time.Since(start).Milliseconds(), attributes) - caller, _ := oid.NewObjectId(auth.GetPrincipal(ctx)) + caller, _ := pkgId.NewObjectId(auth.GetPrincipal(ctx)) if caller != nil { att = append(att, attribute.String("caller", caller.String())) } @@ -149,7 +149,7 @@ func (_d telemetryMiddleware) Log(ctx context.Context, entries []*logs.Entry) (e _d.requestMetrics.DurationMilliseconds.Record(ctx, time.Since(start).Milliseconds(), attributes) - caller, _ := oid.NewObjectId(auth.GetPrincipal(ctx)) + caller, _ := pkgId.NewObjectId(auth.GetPrincipal(ctx)) if caller != nil { att = append(att, attribute.String("caller", caller.String())) } diff --git a/pkg/clients/middleware/logging_middleware.go b/pkg/clients/middleware/logging_middleware.go index 6e27e5c5e61106bfc09fd69e531875643aff6b7e..2a00b4cf12664213426f974ea2ae9c608822a28d 100644 --- a/pkg/clients/middleware/logging_middleware.go +++ b/pkg/clients/middleware/logging_middleware.go @@ -3,7 +3,7 @@ package middleware import ( "context" - oid "git.perx.ru/perxis/perxis-go/id" + pkgId "git.perx.ru/perxis/perxis-go/id" "git.perx.ru/perxis/perxis-go/pkg/clients" logzap "git.perx.ru/perxis/perxis-go/zap" "go.uber.org/zap" @@ -43,7 +43,7 @@ func (m *loggingMiddleware) Create(ctx context.Context, client *clients.Client) func (m *loggingMiddleware) Get(ctx context.Context, spaceId, id string) (client *clients.Client, err error) { logger := m.logger.With( logzap.Caller(ctx), - logzap.Object(oid.NewClientId(spaceId, id)), + logzap.Object(pkgId.NewClientId(spaceId, id)), ) client, err = m.next.Get(ctx, spaceId, id) @@ -105,7 +105,7 @@ func (m *loggingMiddleware) Delete(ctx context.Context, spaceId, id string) (err logger := m.logger.With( logzap.Caller(ctx), logzap.Event(clients.EventDelete), - logzap.Object(oid.NewClientId(spaceId, id)), + logzap.Object(pkgId.NewClientId(spaceId, id)), ) err = m.next.Delete(ctx, spaceId, id) @@ -131,7 +131,7 @@ func (m *loggingMiddleware) Enable(ctx context.Context, spaceId, id string, enab logger := m.logger.With( logzap.Caller(ctx), logzap.Event(event), - logzap.Object(oid.NewClientId(spaceId, id)), + logzap.Object(pkgId.NewClientId(spaceId, id)), ) err = m.next.Enable(ctx, spaceId, id, enable) diff --git a/pkg/clients/middleware/telemetry_middleware.go b/pkg/clients/middleware/telemetry_middleware.go index cbb217153db160631a1e71ebf9d48d68cd787ebc..8925db9dc750869035423c528289ef5381c52470 100644 --- a/pkg/clients/middleware/telemetry_middleware.go +++ b/pkg/clients/middleware/telemetry_middleware.go @@ -10,7 +10,7 @@ import ( "context" "time" - oid "git.perx.ru/perxis/perxis-go/id" + pkgId "git.perx.ru/perxis/perxis-go/id" "git.perx.ru/perxis/perxis-go/pkg/auth" "git.perx.ru/perxis/perxis-go/pkg/clients" "git.perx.ru/perxis/perxis-go/pkg/telemetry/metrics" @@ -84,7 +84,7 @@ func (_d telemetryMiddleware) Create(ctx context.Context, client *clients.Client if spID != "" { att = append(att, attribute.String("spaceID", spID)) } - caller, _ := oid.NewObjectId(auth.GetPrincipal(ctx)) + caller, _ := pkgId.NewObjectId(auth.GetPrincipal(ctx)) if caller != nil { att = append(att, attribute.String("caller", caller.String())) } @@ -129,7 +129,7 @@ func (_d telemetryMiddleware) Delete(ctx context.Context, spaceId string, id str if spID != "" { att = append(att, attribute.String("spaceID", spID)) } - caller, _ := oid.NewObjectId(auth.GetPrincipal(ctx)) + caller, _ := pkgId.NewObjectId(auth.GetPrincipal(ctx)) if caller != nil { att = append(att, attribute.String("caller", caller.String())) } @@ -174,7 +174,7 @@ func (_d telemetryMiddleware) Enable(ctx context.Context, spaceId string, id str if spID != "" { att = append(att, attribute.String("spaceID", spID)) } - caller, _ := oid.NewObjectId(auth.GetPrincipal(ctx)) + caller, _ := pkgId.NewObjectId(auth.GetPrincipal(ctx)) if caller != nil { att = append(att, attribute.String("caller", caller.String())) } @@ -220,7 +220,7 @@ func (_d telemetryMiddleware) Get(ctx context.Context, spaceId string, id string if spID != "" { att = append(att, attribute.String("spaceID", spID)) } - caller, _ := oid.NewObjectId(auth.GetPrincipal(ctx)) + caller, _ := pkgId.NewObjectId(auth.GetPrincipal(ctx)) if caller != nil { att = append(att, attribute.String("caller", caller.String())) } @@ -266,7 +266,7 @@ func (_d telemetryMiddleware) GetBy(ctx context.Context, spaceId string, params if spID != "" { att = append(att, attribute.String("spaceID", spID)) } - caller, _ := oid.NewObjectId(auth.GetPrincipal(ctx)) + caller, _ := pkgId.NewObjectId(auth.GetPrincipal(ctx)) if caller != nil { att = append(att, attribute.String("caller", caller.String())) } @@ -312,7 +312,7 @@ func (_d telemetryMiddleware) List(ctx context.Context, spaceId string) (clients if spID != "" { att = append(att, attribute.String("spaceID", spID)) } - caller, _ := oid.NewObjectId(auth.GetPrincipal(ctx)) + caller, _ := pkgId.NewObjectId(auth.GetPrincipal(ctx)) if caller != nil { att = append(att, attribute.String("caller", caller.String())) } @@ -368,7 +368,7 @@ func (_d telemetryMiddleware) Update(ctx context.Context, client *clients.Client if spID != "" { att = append(att, attribute.String("spaceID", spID)) } - caller, _ := oid.NewObjectId(auth.GetPrincipal(ctx)) + caller, _ := pkgId.NewObjectId(auth.GetPrincipal(ctx)) if caller != nil { att = append(att, attribute.String("caller", caller.String())) } diff --git a/pkg/collaborators/middleware/telemetry_middleware.go b/pkg/collaborators/middleware/telemetry_middleware.go index d4a6f56ccbc0d2b5334d596c8ca88932d677017b..1e53c7e1584c2d48be7642b6479bbea75bfb4615 100644 --- a/pkg/collaborators/middleware/telemetry_middleware.go +++ b/pkg/collaborators/middleware/telemetry_middleware.go @@ -10,7 +10,7 @@ import ( "context" "time" - oid "git.perx.ru/perxis/perxis-go/id" + pkgId "git.perx.ru/perxis/perxis-go/id" "git.perx.ru/perxis/perxis-go/pkg/auth" "git.perx.ru/perxis/perxis-go/pkg/collaborators" "git.perx.ru/perxis/perxis-go/pkg/telemetry/metrics" @@ -73,7 +73,7 @@ func (_d telemetryMiddleware) Get(ctx context.Context, spaceId string, subject s if spID != "" { att = append(att, attribute.String("spaceID", spID)) } - caller, _ := oid.NewObjectId(auth.GetPrincipal(ctx)) + caller, _ := pkgId.NewObjectId(auth.GetPrincipal(ctx)) if caller != nil { att = append(att, attribute.String("caller", caller.String())) } @@ -119,7 +119,7 @@ func (_d telemetryMiddleware) ListCollaborators(ctx context.Context, spaceId str if spID != "" { att = append(att, attribute.String("spaceID", spID)) } - caller, _ := oid.NewObjectId(auth.GetPrincipal(ctx)) + caller, _ := pkgId.NewObjectId(auth.GetPrincipal(ctx)) if caller != nil { att = append(att, attribute.String("caller", caller.String())) } @@ -175,7 +175,7 @@ func (_d telemetryMiddleware) ListSpaces(ctx context.Context, subject string) (s if spID != "" { att = append(att, attribute.String("spaceID", spID)) } - caller, _ := oid.NewObjectId(auth.GetPrincipal(ctx)) + caller, _ := pkgId.NewObjectId(auth.GetPrincipal(ctx)) if caller != nil { att = append(att, attribute.String("caller", caller.String())) } @@ -220,7 +220,7 @@ func (_d telemetryMiddleware) Remove(ctx context.Context, spaceId string, subjec if spID != "" { att = append(att, attribute.String("spaceID", spID)) } - caller, _ := oid.NewObjectId(auth.GetPrincipal(ctx)) + caller, _ := pkgId.NewObjectId(auth.GetPrincipal(ctx)) if caller != nil { att = append(att, attribute.String("caller", caller.String())) } @@ -265,7 +265,7 @@ func (_d telemetryMiddleware) Set(ctx context.Context, spaceId string, subject s if spID != "" { att = append(att, attribute.String("spaceID", spID)) } - caller, _ := oid.NewObjectId(auth.GetPrincipal(ctx)) + caller, _ := pkgId.NewObjectId(auth.GetPrincipal(ctx)) if caller != nil { att = append(att, attribute.String("caller", caller.String())) } diff --git a/pkg/collections/middleware/logging_middleware.go b/pkg/collections/middleware/logging_middleware.go index 5d8d104d9fccfa55ddf557a4a59e289f87da830c..459a662768bfabc9ccdb253f3ab3f174d54dbeee 100644 --- a/pkg/collections/middleware/logging_middleware.go +++ b/pkg/collections/middleware/logging_middleware.go @@ -3,7 +3,7 @@ package middleware import ( "context" - oid "git.perx.ru/perxis/perxis-go/id" + pkgId "git.perx.ru/perxis/perxis-go/id" "git.perx.ru/perxis/perxis-go/pkg/collections" "git.perx.ru/perxis/perxis-go/pkg/schema" logzap "git.perx.ru/perxis/perxis-go/zap" @@ -48,7 +48,7 @@ func (m *loggingMiddleware) Delete(ctx context.Context, spaceId string, envId st logger := m.logger.With( logzap.Caller(ctx, logzap.WithSpace(spaceId)), logzap.Event(collections.EventDelete), - logzap.Object(oid.NewCollectionId(spaceId, envId, id)), + logzap.Object(pkgId.NewCollectionId(spaceId, envId, id)), ) err = m.next.Delete(ctx, spaceId, envId, id) @@ -93,7 +93,7 @@ func (m *loggingMiddleware) SetSchema(ctx context.Context, spaceId string, envId logger := m.logger.With( logzap.Caller(ctx, logzap.WithSpace(spaceId)), logzap.Event(collections.EventSetSchema), - logzap.Object(oid.NewCollectionId(spaceId, envId, id)), + logzap.Object(pkgId.NewCollectionId(spaceId, envId, id)), ) err = m.next.SetSchema(ctx, spaceId, envId, id, schema) diff --git a/pkg/collections/middleware/telemetry_middleware.go b/pkg/collections/middleware/telemetry_middleware.go index 044720ff98d25cdb28c76b75aaba073739ece646..dba2f3436ac669c19a213153b049224de62854e0 100644 --- a/pkg/collections/middleware/telemetry_middleware.go +++ b/pkg/collections/middleware/telemetry_middleware.go @@ -10,7 +10,7 @@ import ( "context" "time" - oid "git.perx.ru/perxis/perxis-go/id" + pkgId "git.perx.ru/perxis/perxis-go/id" "git.perx.ru/perxis/perxis-go/pkg/auth" "git.perx.ru/perxis/perxis-go/pkg/collections" "git.perx.ru/perxis/perxis-go/pkg/schema" @@ -85,7 +85,7 @@ func (_d telemetryMiddleware) Create(ctx context.Context, coll *collections.Coll if spID != "" { att = append(att, attribute.String("spaceID", spID)) } - caller, _ := oid.NewObjectId(auth.GetPrincipal(ctx)) + caller, _ := pkgId.NewObjectId(auth.GetPrincipal(ctx)) if caller != nil { att = append(att, attribute.String("caller", caller.String())) } @@ -130,7 +130,7 @@ func (_d telemetryMiddleware) Delete(ctx context.Context, spaceId string, envId if spID != "" { att = append(att, attribute.String("spaceID", spID)) } - caller, _ := oid.NewObjectId(auth.GetPrincipal(ctx)) + caller, _ := pkgId.NewObjectId(auth.GetPrincipal(ctx)) if caller != nil { att = append(att, attribute.String("caller", caller.String())) } @@ -176,7 +176,7 @@ func (_d telemetryMiddleware) Get(ctx context.Context, spaceId string, envId str if spID != "" { att = append(att, attribute.String("spaceID", spID)) } - caller, _ := oid.NewObjectId(auth.GetPrincipal(ctx)) + caller, _ := pkgId.NewObjectId(auth.GetPrincipal(ctx)) if caller != nil { att = append(att, attribute.String("caller", caller.String())) } @@ -224,7 +224,7 @@ func (_d telemetryMiddleware) List(ctx context.Context, spaceId string, envId st if spID != "" { att = append(att, attribute.String("spaceID", spID)) } - caller, _ := oid.NewObjectId(auth.GetPrincipal(ctx)) + caller, _ := pkgId.NewObjectId(auth.GetPrincipal(ctx)) if caller != nil { att = append(att, attribute.String("caller", caller.String())) } @@ -271,7 +271,7 @@ func (_d telemetryMiddleware) SetSchema(ctx context.Context, spaceId string, env if spID != "" { att = append(att, attribute.String("spaceID", spID)) } - caller, _ := oid.NewObjectId(auth.GetPrincipal(ctx)) + caller, _ := pkgId.NewObjectId(auth.GetPrincipal(ctx)) if caller != nil { att = append(att, attribute.String("caller", caller.String())) } @@ -318,7 +318,7 @@ func (_d telemetryMiddleware) SetState(ctx context.Context, spaceId string, envI if spID != "" { att = append(att, attribute.String("spaceID", spID)) } - caller, _ := oid.NewObjectId(auth.GetPrincipal(ctx)) + caller, _ := pkgId.NewObjectId(auth.GetPrincipal(ctx)) if caller != nil { att = append(att, attribute.String("caller", caller.String())) } @@ -376,7 +376,7 @@ func (_d telemetryMiddleware) Update(ctx context.Context, coll *collections.Coll if spID != "" { att = append(att, attribute.String("spaceID", spID)) } - caller, _ := oid.NewObjectId(auth.GetPrincipal(ctx)) + caller, _ := pkgId.NewObjectId(auth.GetPrincipal(ctx)) if caller != nil { att = append(att, attribute.String("caller", caller.String())) } diff --git a/pkg/delivery/middleware/telemetry_middleware.go b/pkg/delivery/middleware/telemetry_middleware.go index 600b6a61caec8391507735e01d12d82ee822c8e3..276d3f62ff5d91c78d30aa07b79b4ee37c785a04 100644 --- a/pkg/delivery/middleware/telemetry_middleware.go +++ b/pkg/delivery/middleware/telemetry_middleware.go @@ -10,7 +10,7 @@ import ( "context" "time" - oid "git.perx.ru/perxis/perxis-go/id" + pkgId "git.perx.ru/perxis/perxis-go/id" "git.perx.ru/perxis/perxis-go/pkg/auth" "git.perx.ru/perxis/perxis-go/pkg/collections" "git.perx.ru/perxis/perxis-go/pkg/delivery" @@ -77,7 +77,7 @@ func (_d telemetryMiddleware) Aggregate(ctx context.Context, spaceId string, env if spID != "" { att = append(att, attribute.String("spaceID", spID)) } - caller, _ := oid.NewObjectId(auth.GetPrincipal(ctx)) + caller, _ := pkgId.NewObjectId(auth.GetPrincipal(ctx)) if caller != nil { att = append(att, attribute.String("caller", caller.String())) } @@ -126,7 +126,7 @@ func (_d telemetryMiddleware) FindItems(ctx context.Context, spaceId string, env if spID != "" { att = append(att, attribute.String("spaceID", spID)) } - caller, _ := oid.NewObjectId(auth.GetPrincipal(ctx)) + caller, _ := pkgId.NewObjectId(auth.GetPrincipal(ctx)) if caller != nil { att = append(att, attribute.String("caller", caller.String())) } @@ -176,7 +176,7 @@ func (_d telemetryMiddleware) GetCollection(ctx context.Context, spaceId string, if spID != "" { att = append(att, attribute.String("spaceID", spID)) } - caller, _ := oid.NewObjectId(auth.GetPrincipal(ctx)) + caller, _ := pkgId.NewObjectId(auth.GetPrincipal(ctx)) if caller != nil { att = append(att, attribute.String("caller", caller.String())) } @@ -223,7 +223,7 @@ func (_d telemetryMiddleware) GetEnvironment(ctx context.Context, spaceId string if spID != "" { att = append(att, attribute.String("spaceID", spID)) } - caller, _ := oid.NewObjectId(auth.GetPrincipal(ctx)) + caller, _ := pkgId.NewObjectId(auth.GetPrincipal(ctx)) if caller != nil { att = append(att, attribute.String("caller", caller.String())) } @@ -269,7 +269,7 @@ func (_d telemetryMiddleware) GetItem(ctx context.Context, spaceId string, envId if spID != "" { att = append(att, attribute.String("spaceID", spID)) } - caller, _ := oid.NewObjectId(auth.GetPrincipal(ctx)) + caller, _ := pkgId.NewObjectId(auth.GetPrincipal(ctx)) if caller != nil { att = append(att, attribute.String("caller", caller.String())) } @@ -318,7 +318,7 @@ func (_d telemetryMiddleware) ListCollections(ctx context.Context, spaceId strin if spID != "" { att = append(att, attribute.String("spaceID", spID)) } - caller, _ := oid.NewObjectId(auth.GetPrincipal(ctx)) + caller, _ := pkgId.NewObjectId(auth.GetPrincipal(ctx)) if caller != nil { att = append(att, attribute.String("caller", caller.String())) } @@ -364,7 +364,7 @@ func (_d telemetryMiddleware) ListEnvironments(ctx context.Context, spaceId stri if spID != "" { att = append(att, attribute.String("spaceID", spID)) } - caller, _ := oid.NewObjectId(auth.GetPrincipal(ctx)) + caller, _ := pkgId.NewObjectId(auth.GetPrincipal(ctx)) if caller != nil { att = append(att, attribute.String("caller", caller.String())) } @@ -409,7 +409,7 @@ func (_d telemetryMiddleware) ListLocales(ctx context.Context, spaceId string) ( if spID != "" { att = append(att, attribute.String("spaceID", spID)) } - caller, _ := oid.NewObjectId(auth.GetPrincipal(ctx)) + caller, _ := pkgId.NewObjectId(auth.GetPrincipal(ctx)) if caller != nil { att = append(att, attribute.String("caller", caller.String())) } diff --git a/pkg/environments/middleware/logging_middleware.go b/pkg/environments/middleware/logging_middleware.go index faac106d775c8a6736adb27db2a5d4f53334e5db..86a73c2af541dbb30b243e1cfbce5e1a46e5556a 100644 --- a/pkg/environments/middleware/logging_middleware.go +++ b/pkg/environments/middleware/logging_middleware.go @@ -4,7 +4,7 @@ import ( "context" "fmt" - oid "git.perx.ru/perxis/perxis-go/id" + pkgId "git.perx.ru/perxis/perxis-go/id" "git.perx.ru/perxis/perxis-go/pkg/environments" logzap "git.perx.ru/perxis/perxis-go/zap" @@ -46,7 +46,7 @@ func (m *loggingMiddleware) Delete(ctx context.Context, spaceId string, id strin logger := m.logger.With( logzap.Caller(ctx), logzap.Event(environments.EventDelete), - logzap.Object(oid.NewEnvironmentId(spaceId, id)), + logzap.Object(pkgId.NewEnvironmentId(spaceId, id)), ) err = m.next.Delete(ctx, spaceId, id) @@ -63,7 +63,7 @@ func (m *loggingMiddleware) Delete(ctx context.Context, spaceId string, id strin func (m *loggingMiddleware) Get(ctx context.Context, spaceId string, id string) (env *environments.Environment, err error) { logger := m.logger.With( logzap.Caller(ctx), - logzap.Object(oid.NewEnvironmentId(spaceId, id)), + logzap.Object(pkgId.NewEnvironmentId(spaceId, id)), ) env, err = m.next.Get(ctx, spaceId, id) @@ -93,7 +93,7 @@ func (m *loggingMiddleware) Migrate(ctx context.Context, spaceId string, id stri logger := m.logger.With( logzap.Caller(ctx), logzap.Event(environments.EventMigrate), - logzap.Object(oid.NewEnvironmentId(spaceId, id)), + logzap.Object(pkgId.NewEnvironmentId(spaceId, id)), ) err = m.next.Migrate(ctx, spaceId, id, options...) @@ -111,7 +111,7 @@ func (m *loggingMiddleware) RemoveAlias(ctx context.Context, spaceId string, id logger := m.logger.With( logzap.Caller(ctx), logzap.Event(environments.EventUpdate), - logzap.Object(oid.NewEnvironmentId(spaceId, id)), + logzap.Object(pkgId.NewEnvironmentId(spaceId, id)), ) err = m.next.RemoveAlias(ctx, spaceId, id, alias) @@ -128,7 +128,7 @@ func (m *loggingMiddleware) SetAlias(ctx context.Context, spaceId string, id str logger := m.logger.With( logzap.Caller(ctx), logzap.Event(environments.EventUpdate), - logzap.Object(oid.NewEnvironmentId(spaceId, id)), + logzap.Object(pkgId.NewEnvironmentId(spaceId, id)), ) err = m.next.SetAlias(ctx, spaceId, id, alias) diff --git a/pkg/environments/middleware/telemetry_middleware.go b/pkg/environments/middleware/telemetry_middleware.go index 279bbb8d5f07de2d0232ee352c0ae12ad3cc8c8f..94c90c2f7bf47b0519604375c3a7f8dd6dbdc144 100644 --- a/pkg/environments/middleware/telemetry_middleware.go +++ b/pkg/environments/middleware/telemetry_middleware.go @@ -10,7 +10,7 @@ import ( "context" "time" - oid "git.perx.ru/perxis/perxis-go/id" + pkgId "git.perx.ru/perxis/perxis-go/id" "git.perx.ru/perxis/perxis-go/pkg/auth" "git.perx.ru/perxis/perxis-go/pkg/environments" "git.perx.ru/perxis/perxis-go/pkg/telemetry/metrics" @@ -84,7 +84,7 @@ func (_d telemetryMiddleware) Create(ctx context.Context, env *environments.Envi if spID != "" { att = append(att, attribute.String("spaceID", spID)) } - caller, _ := oid.NewObjectId(auth.GetPrincipal(ctx)) + caller, _ := pkgId.NewObjectId(auth.GetPrincipal(ctx)) if caller != nil { att = append(att, attribute.String("caller", caller.String())) } @@ -129,7 +129,7 @@ func (_d telemetryMiddleware) Delete(ctx context.Context, spaceId string, id str if spID != "" { att = append(att, attribute.String("spaceID", spID)) } - caller, _ := oid.NewObjectId(auth.GetPrincipal(ctx)) + caller, _ := pkgId.NewObjectId(auth.GetPrincipal(ctx)) if caller != nil { att = append(att, attribute.String("caller", caller.String())) } @@ -174,7 +174,7 @@ func (_d telemetryMiddleware) Get(ctx context.Context, spaceId string, id string if spID != "" { att = append(att, attribute.String("spaceID", spID)) } - caller, _ := oid.NewObjectId(auth.GetPrincipal(ctx)) + caller, _ := pkgId.NewObjectId(auth.GetPrincipal(ctx)) if caller != nil { att = append(att, attribute.String("caller", caller.String())) } @@ -220,7 +220,7 @@ func (_d telemetryMiddleware) List(ctx context.Context, spaceId string) (envs [] if spID != "" { att = append(att, attribute.String("spaceID", spID)) } - caller, _ := oid.NewObjectId(auth.GetPrincipal(ctx)) + caller, _ := pkgId.NewObjectId(auth.GetPrincipal(ctx)) if caller != nil { att = append(att, attribute.String("caller", caller.String())) } @@ -265,7 +265,7 @@ func (_d telemetryMiddleware) Migrate(ctx context.Context, spaceId string, id st if spID != "" { att = append(att, attribute.String("spaceID", spID)) } - caller, _ := oid.NewObjectId(auth.GetPrincipal(ctx)) + caller, _ := pkgId.NewObjectId(auth.GetPrincipal(ctx)) if caller != nil { att = append(att, attribute.String("caller", caller.String())) } @@ -311,7 +311,7 @@ func (_d telemetryMiddleware) RemoveAlias(ctx context.Context, spaceId string, i if spID != "" { att = append(att, attribute.String("spaceID", spID)) } - caller, _ := oid.NewObjectId(auth.GetPrincipal(ctx)) + caller, _ := pkgId.NewObjectId(auth.GetPrincipal(ctx)) if caller != nil { att = append(att, attribute.String("caller", caller.String())) } @@ -357,7 +357,7 @@ func (_d telemetryMiddleware) SetAlias(ctx context.Context, spaceId string, id s if spID != "" { att = append(att, attribute.String("spaceID", spID)) } - caller, _ := oid.NewObjectId(auth.GetPrincipal(ctx)) + caller, _ := pkgId.NewObjectId(auth.GetPrincipal(ctx)) if caller != nil { att = append(att, attribute.String("caller", caller.String())) } @@ -414,7 +414,7 @@ func (_d telemetryMiddleware) Update(ctx context.Context, env *environments.Envi if spID != "" { att = append(att, attribute.String("spaceID", spID)) } - caller, _ := oid.NewObjectId(auth.GetPrincipal(ctx)) + caller, _ := pkgId.NewObjectId(auth.GetPrincipal(ctx)) if caller != nil { att = append(att, attribute.String("caller", caller.String())) } diff --git a/pkg/extension/middleware/telemetry_middleware.go b/pkg/extension/middleware/telemetry_middleware.go index 7302cab3b4ecf364f475b0dbe7d77a37c96cd784..10349b313f96f3f4770f9ea7d58adcfcd73dd0f7 100644 --- a/pkg/extension/middleware/telemetry_middleware.go +++ b/pkg/extension/middleware/telemetry_middleware.go @@ -10,7 +10,7 @@ import ( "context" "time" - oid "git.perx.ru/perxis/perxis-go/id" + pkgId "git.perx.ru/perxis/perxis-go/id" "git.perx.ru/perxis/perxis-go/pkg/auth" "git.perx.ru/perxis/perxis-go/pkg/extension" "git.perx.ru/perxis/perxis-go/pkg/telemetry/metrics" @@ -68,7 +68,7 @@ func (_d telemetryMiddleware) Action(ctx context.Context, in *extension.ActionRe _d.requestMetrics.DurationMilliseconds.Record(ctx, time.Since(start).Milliseconds(), attributes) - caller, _ := oid.NewObjectId(auth.GetPrincipal(ctx)) + caller, _ := pkgId.NewObjectId(auth.GetPrincipal(ctx)) if caller != nil { att = append(att, attribute.String("caller", caller.String())) } @@ -108,7 +108,7 @@ func (_d telemetryMiddleware) Check(ctx context.Context, in *extension.CheckRequ _d.requestMetrics.DurationMilliseconds.Record(ctx, time.Since(start).Milliseconds(), attributes) - caller, _ := oid.NewObjectId(auth.GetPrincipal(ctx)) + caller, _ := pkgId.NewObjectId(auth.GetPrincipal(ctx)) if caller != nil { att = append(att, attribute.String("caller", caller.String())) } @@ -147,7 +147,7 @@ func (_d telemetryMiddleware) Install(ctx context.Context, in *extension.Install _d.requestMetrics.DurationMilliseconds.Record(ctx, time.Since(start).Milliseconds(), attributes) - caller, _ := oid.NewObjectId(auth.GetPrincipal(ctx)) + caller, _ := pkgId.NewObjectId(auth.GetPrincipal(ctx)) if caller != nil { att = append(att, attribute.String("caller", caller.String())) } @@ -186,7 +186,7 @@ func (_d telemetryMiddleware) ListExtensions(ctx context.Context, space string, _d.requestMetrics.DurationMilliseconds.Record(ctx, time.Since(start).Milliseconds(), attributes) - caller, _ := oid.NewObjectId(auth.GetPrincipal(ctx)) + caller, _ := pkgId.NewObjectId(auth.GetPrincipal(ctx)) if caller != nil { att = append(att, attribute.String("caller", caller.String())) } @@ -228,7 +228,7 @@ func (_d telemetryMiddleware) ListRegisteredExtensions(ctx context.Context, exte _d.requestMetrics.DurationMilliseconds.Record(ctx, time.Since(start).Milliseconds(), attributes) - caller, _ := oid.NewObjectId(auth.GetPrincipal(ctx)) + caller, _ := pkgId.NewObjectId(auth.GetPrincipal(ctx)) if caller != nil { att = append(att, attribute.String("caller", caller.String())) } @@ -268,7 +268,7 @@ func (_d telemetryMiddleware) RegisterExtensions(ctx context.Context, ext ...*ex _d.requestMetrics.DurationMilliseconds.Record(ctx, time.Since(start).Milliseconds(), attributes) - caller, _ := oid.NewObjectId(auth.GetPrincipal(ctx)) + caller, _ := pkgId.NewObjectId(auth.GetPrincipal(ctx)) if caller != nil { att = append(att, attribute.String("caller", caller.String())) } @@ -307,7 +307,7 @@ func (_d telemetryMiddleware) Uninstall(ctx context.Context, in *extension.Unins _d.requestMetrics.DurationMilliseconds.Record(ctx, time.Since(start).Milliseconds(), attributes) - caller, _ := oid.NewObjectId(auth.GetPrincipal(ctx)) + caller, _ := pkgId.NewObjectId(auth.GetPrincipal(ctx)) if caller != nil { att = append(att, attribute.String("caller", caller.String())) } @@ -346,7 +346,7 @@ func (_d telemetryMiddleware) UnregisterExtensions(ctx context.Context, ext ...* _d.requestMetrics.DurationMilliseconds.Record(ctx, time.Since(start).Milliseconds(), attributes) - caller, _ := oid.NewObjectId(auth.GetPrincipal(ctx)) + caller, _ := pkgId.NewObjectId(auth.GetPrincipal(ctx)) if caller != nil { att = append(att, attribute.String("caller", caller.String())) } diff --git a/pkg/files/middleware/telemetry_middleware.go b/pkg/files/middleware/telemetry_middleware.go index e2e482a6af8f4ffde281120f35c17fae425202f6..156f9d8b1e340d4c27891c517b749b0e707995f8 100644 --- a/pkg/files/middleware/telemetry_middleware.go +++ b/pkg/files/middleware/telemetry_middleware.go @@ -10,7 +10,7 @@ import ( "context" "time" - oid "git.perx.ru/perxis/perxis-go/id" + pkgId "git.perx.ru/perxis/perxis-go/id" "git.perx.ru/perxis/perxis-go/pkg/auth" "git.perx.ru/perxis/perxis-go/pkg/files" "git.perx.ru/perxis/perxis-go/pkg/telemetry/metrics" @@ -68,7 +68,7 @@ func (_d telemetryMiddleware) AbortUpload(ctx context.Context, upload *files.Mul _d.requestMetrics.DurationMilliseconds.Record(ctx, time.Since(start).Milliseconds(), attributes) - caller, _ := oid.NewObjectId(auth.GetPrincipal(ctx)) + caller, _ := pkgId.NewObjectId(auth.GetPrincipal(ctx)) if caller != nil { att = append(att, attribute.String("caller", caller.String())) } @@ -107,7 +107,7 @@ func (_d telemetryMiddleware) CompleteUpload(ctx context.Context, upload *files. _d.requestMetrics.DurationMilliseconds.Record(ctx, time.Since(start).Milliseconds(), attributes) - caller, _ := oid.NewObjectId(auth.GetPrincipal(ctx)) + caller, _ := pkgId.NewObjectId(auth.GetPrincipal(ctx)) if caller != nil { att = append(att, attribute.String("caller", caller.String())) } @@ -147,7 +147,7 @@ func (_d telemetryMiddleware) DeleteFile(ctx context.Context, file *files.File) _d.requestMetrics.DurationMilliseconds.Record(ctx, time.Since(start).Milliseconds(), attributes) - caller, _ := oid.NewObjectId(auth.GetPrincipal(ctx)) + caller, _ := pkgId.NewObjectId(auth.GetPrincipal(ctx)) if caller != nil { att = append(att, attribute.String("caller", caller.String())) } @@ -186,7 +186,7 @@ func (_d telemetryMiddleware) GetFile(ctx context.Context, file *files.File) (f _d.requestMetrics.DurationMilliseconds.Record(ctx, time.Since(start).Milliseconds(), attributes) - caller, _ := oid.NewObjectId(auth.GetPrincipal(ctx)) + caller, _ := pkgId.NewObjectId(auth.GetPrincipal(ctx)) if caller != nil { att = append(att, attribute.String("caller", caller.String())) } @@ -226,7 +226,7 @@ func (_d telemetryMiddleware) MoveUpload(ctx context.Context, upload *files.Mult _d.requestMetrics.DurationMilliseconds.Record(ctx, time.Since(start).Milliseconds(), attributes) - caller, _ := oid.NewObjectId(auth.GetPrincipal(ctx)) + caller, _ := pkgId.NewObjectId(auth.GetPrincipal(ctx)) if caller != nil { att = append(att, attribute.String("caller", caller.String())) } @@ -266,7 +266,7 @@ func (_d telemetryMiddleware) StartUpload(ctx context.Context, upload *files.Mul _d.requestMetrics.DurationMilliseconds.Record(ctx, time.Since(start).Milliseconds(), attributes) - caller, _ := oid.NewObjectId(auth.GetPrincipal(ctx)) + caller, _ := pkgId.NewObjectId(auth.GetPrincipal(ctx)) if caller != nil { att = append(att, attribute.String("caller", caller.String())) } @@ -306,7 +306,7 @@ func (_d telemetryMiddleware) Upload(ctx context.Context, file *files.File) (u * _d.requestMetrics.DurationMilliseconds.Record(ctx, time.Since(start).Milliseconds(), attributes) - caller, _ := oid.NewObjectId(auth.GetPrincipal(ctx)) + caller, _ := pkgId.NewObjectId(auth.GetPrincipal(ctx)) if caller != nil { att = append(att, attribute.String("caller", caller.String())) } diff --git a/pkg/invitations/middleware/telemetry_middleware.go b/pkg/invitations/middleware/telemetry_middleware.go index 1696f81a9ada1457336e928ebb44c79aa6852bcd..a80140c1ca52dff6c5b8e0cd55cee26bdd600fbd 100644 --- a/pkg/invitations/middleware/telemetry_middleware.go +++ b/pkg/invitations/middleware/telemetry_middleware.go @@ -10,7 +10,7 @@ import ( "context" "time" - oid "git.perx.ru/perxis/perxis-go/id" + pkgId "git.perx.ru/perxis/perxis-go/id" "git.perx.ru/perxis/perxis-go/pkg/auth" "git.perx.ru/perxis/perxis-go/pkg/invitations" "git.perx.ru/perxis/perxis-go/pkg/options" @@ -85,7 +85,7 @@ func (_d telemetryMiddleware) Accept(ctx context.Context, invitationId string, u if spID != "" { att = append(att, attribute.String("spaceID", spID)) } - caller, _ := oid.NewObjectId(auth.GetPrincipal(ctx)) + caller, _ := pkgId.NewObjectId(auth.GetPrincipal(ctx)) if caller != nil { att = append(att, attribute.String("caller", caller.String())) } @@ -141,7 +141,7 @@ func (_d telemetryMiddleware) Create(ctx context.Context, invitation *invitation if spID != "" { att = append(att, attribute.String("spaceID", spID)) } - caller, _ := oid.NewObjectId(auth.GetPrincipal(ctx)) + caller, _ := pkgId.NewObjectId(auth.GetPrincipal(ctx)) if caller != nil { att = append(att, attribute.String("caller", caller.String())) } @@ -197,7 +197,7 @@ func (_d telemetryMiddleware) Delete(ctx context.Context, invitationId string) ( if spID != "" { att = append(att, attribute.String("spaceID", spID)) } - caller, _ := oid.NewObjectId(auth.GetPrincipal(ctx)) + caller, _ := pkgId.NewObjectId(auth.GetPrincipal(ctx)) if caller != nil { att = append(att, attribute.String("caller", caller.String())) } @@ -252,7 +252,7 @@ func (_d telemetryMiddleware) Find(ctx context.Context, filter *invitations.Filt if spID != "" { att = append(att, attribute.String("spaceID", spID)) } - caller, _ := oid.NewObjectId(auth.GetPrincipal(ctx)) + caller, _ := pkgId.NewObjectId(auth.GetPrincipal(ctx)) if caller != nil { att = append(att, attribute.String("caller", caller.String())) } @@ -310,7 +310,7 @@ func (_d telemetryMiddleware) Get(ctx context.Context, invitationId string) (inv if spID != "" { att = append(att, attribute.String("spaceID", spID)) } - caller, _ := oid.NewObjectId(auth.GetPrincipal(ctx)) + caller, _ := pkgId.NewObjectId(auth.GetPrincipal(ctx)) if caller != nil { att = append(att, attribute.String("caller", caller.String())) } diff --git a/pkg/items/middleware/telemetry_middleware.go b/pkg/items/middleware/telemetry_middleware.go index da626aa53ea846ce5747bd0deded09d300d48d95..16a415bd3a31c0e7cacda3dac3ea5ca3f74361b8 100644 --- a/pkg/items/middleware/telemetry_middleware.go +++ b/pkg/items/middleware/telemetry_middleware.go @@ -10,7 +10,7 @@ import ( "context" "time" - oid "git.perx.ru/perxis/perxis-go/id" + pkgId "git.perx.ru/perxis/perxis-go/id" "git.perx.ru/perxis/perxis-go/pkg/auth" "git.perx.ru/perxis/perxis-go/pkg/items" "git.perx.ru/perxis/perxis-go/pkg/schema" @@ -74,7 +74,7 @@ func (_d telemetryMiddleware) Aggregate(ctx context.Context, spaceId string, env if spID != "" { att = append(att, attribute.String("spaceID", spID)) } - caller, _ := oid.NewObjectId(auth.GetPrincipal(ctx)) + caller, _ := pkgId.NewObjectId(auth.GetPrincipal(ctx)) if caller != nil { att = append(att, attribute.String("caller", caller.String())) } @@ -123,7 +123,7 @@ func (_d telemetryMiddleware) AggregatePublished(ctx context.Context, spaceId st if spID != "" { att = append(att, attribute.String("spaceID", spID)) } - caller, _ := oid.NewObjectId(auth.GetPrincipal(ctx)) + caller, _ := pkgId.NewObjectId(auth.GetPrincipal(ctx)) if caller != nil { att = append(att, attribute.String("caller", caller.String())) } @@ -183,7 +183,7 @@ func (_d telemetryMiddleware) Archive(ctx context.Context, item *items.Item, opt if spID != "" { att = append(att, attribute.String("spaceID", spID)) } - caller, _ := oid.NewObjectId(auth.GetPrincipal(ctx)) + caller, _ := pkgId.NewObjectId(auth.GetPrincipal(ctx)) if caller != nil { att = append(att, attribute.String("caller", caller.String())) } @@ -239,7 +239,7 @@ func (_d telemetryMiddleware) Create(ctx context.Context, item *items.Item, opts if spID != "" { att = append(att, attribute.String("spaceID", spID)) } - caller, _ := oid.NewObjectId(auth.GetPrincipal(ctx)) + caller, _ := pkgId.NewObjectId(auth.GetPrincipal(ctx)) if caller != nil { att = append(att, attribute.String("caller", caller.String())) } @@ -296,7 +296,7 @@ func (_d telemetryMiddleware) Delete(ctx context.Context, item *items.Item, opti if spID != "" { att = append(att, attribute.String("spaceID", spID)) } - caller, _ := oid.NewObjectId(auth.GetPrincipal(ctx)) + caller, _ := pkgId.NewObjectId(auth.GetPrincipal(ctx)) if caller != nil { att = append(att, attribute.String("caller", caller.String())) } @@ -341,7 +341,7 @@ func (_d telemetryMiddleware) Find(ctx context.Context, spaceId string, envId st if spID != "" { att = append(att, attribute.String("spaceID", spID)) } - caller, _ := oid.NewObjectId(auth.GetPrincipal(ctx)) + caller, _ := pkgId.NewObjectId(auth.GetPrincipal(ctx)) if caller != nil { att = append(att, attribute.String("caller", caller.String())) } @@ -391,7 +391,7 @@ func (_d telemetryMiddleware) FindArchived(ctx context.Context, spaceId string, if spID != "" { att = append(att, attribute.String("spaceID", spID)) } - caller, _ := oid.NewObjectId(auth.GetPrincipal(ctx)) + caller, _ := pkgId.NewObjectId(auth.GetPrincipal(ctx)) if caller != nil { att = append(att, attribute.String("caller", caller.String())) } @@ -441,7 +441,7 @@ func (_d telemetryMiddleware) FindPublished(ctx context.Context, spaceId string, if spID != "" { att = append(att, attribute.String("spaceID", spID)) } - caller, _ := oid.NewObjectId(auth.GetPrincipal(ctx)) + caller, _ := pkgId.NewObjectId(auth.GetPrincipal(ctx)) if caller != nil { att = append(att, attribute.String("caller", caller.String())) } @@ -491,7 +491,7 @@ func (_d telemetryMiddleware) Get(ctx context.Context, spaceId string, envId str if spID != "" { att = append(att, attribute.String("spaceID", spID)) } - caller, _ := oid.NewObjectId(auth.GetPrincipal(ctx)) + caller, _ := pkgId.NewObjectId(auth.GetPrincipal(ctx)) if caller != nil { att = append(att, attribute.String("caller", caller.String())) } @@ -540,7 +540,7 @@ func (_d telemetryMiddleware) GetPublished(ctx context.Context, spaceId string, if spID != "" { att = append(att, attribute.String("spaceID", spID)) } - caller, _ := oid.NewObjectId(auth.GetPrincipal(ctx)) + caller, _ := pkgId.NewObjectId(auth.GetPrincipal(ctx)) if caller != nil { att = append(att, attribute.String("caller", caller.String())) } @@ -589,7 +589,7 @@ func (_d telemetryMiddleware) GetRevision(ctx context.Context, spaceId string, e if spID != "" { att = append(att, attribute.String("spaceID", spID)) } - caller, _ := oid.NewObjectId(auth.GetPrincipal(ctx)) + caller, _ := pkgId.NewObjectId(auth.GetPrincipal(ctx)) if caller != nil { att = append(att, attribute.String("caller", caller.String())) } @@ -650,7 +650,7 @@ func (_d telemetryMiddleware) Introspect(ctx context.Context, item *items.Item, if spID != "" { att = append(att, attribute.String("spaceID", spID)) } - caller, _ := oid.NewObjectId(auth.GetPrincipal(ctx)) + caller, _ := pkgId.NewObjectId(auth.GetPrincipal(ctx)) if caller != nil { att = append(att, attribute.String("caller", caller.String())) } @@ -697,7 +697,7 @@ func (_d telemetryMiddleware) ListRevisions(ctx context.Context, spaceId string, if spID != "" { att = append(att, attribute.String("spaceID", spID)) } - caller, _ := oid.NewObjectId(auth.GetPrincipal(ctx)) + caller, _ := pkgId.NewObjectId(auth.GetPrincipal(ctx)) if caller != nil { att = append(att, attribute.String("caller", caller.String())) } @@ -757,7 +757,7 @@ func (_d telemetryMiddleware) Publish(ctx context.Context, item *items.Item, opt if spID != "" { att = append(att, attribute.String("spaceID", spID)) } - caller, _ := oid.NewObjectId(auth.GetPrincipal(ctx)) + caller, _ := pkgId.NewObjectId(auth.GetPrincipal(ctx)) if caller != nil { att = append(att, attribute.String("caller", caller.String())) } @@ -813,7 +813,7 @@ func (_d telemetryMiddleware) Unarchive(ctx context.Context, item *items.Item, o if spID != "" { att = append(att, attribute.String("spaceID", spID)) } - caller, _ := oid.NewObjectId(auth.GetPrincipal(ctx)) + caller, _ := pkgId.NewObjectId(auth.GetPrincipal(ctx)) if caller != nil { att = append(att, attribute.String("caller", caller.String())) } @@ -869,7 +869,7 @@ func (_d telemetryMiddleware) Undelete(ctx context.Context, item *items.Item, op if spID != "" { att = append(att, attribute.String("spaceID", spID)) } - caller, _ := oid.NewObjectId(auth.GetPrincipal(ctx)) + caller, _ := pkgId.NewObjectId(auth.GetPrincipal(ctx)) if caller != nil { att = append(att, attribute.String("caller", caller.String())) } @@ -925,7 +925,7 @@ func (_d telemetryMiddleware) Unpublish(ctx context.Context, item *items.Item, o if spID != "" { att = append(att, attribute.String("spaceID", spID)) } - caller, _ := oid.NewObjectId(auth.GetPrincipal(ctx)) + caller, _ := pkgId.NewObjectId(auth.GetPrincipal(ctx)) if caller != nil { att = append(att, attribute.String("caller", caller.String())) } @@ -981,7 +981,7 @@ func (_d telemetryMiddleware) Update(ctx context.Context, item *items.Item, opti if spID != "" { att = append(att, attribute.String("spaceID", spID)) } - caller, _ := oid.NewObjectId(auth.GetPrincipal(ctx)) + caller, _ := pkgId.NewObjectId(auth.GetPrincipal(ctx)) if caller != nil { att = append(att, attribute.String("caller", caller.String())) } diff --git a/pkg/locales/middleware/logging_middleware.go b/pkg/locales/middleware/logging_middleware.go index 47c69744753d33fc2998d8f195af36937bda799b..22ea6a822d1517b3c0272e9d0eb6070446cdeaf5 100644 --- a/pkg/locales/middleware/logging_middleware.go +++ b/pkg/locales/middleware/logging_middleware.go @@ -3,7 +3,7 @@ package middleware import ( "context" - oid "git.perx.ru/perxis/perxis-go/id" + pkgId "git.perx.ru/perxis/perxis-go/id" "git.perx.ru/perxis/perxis-go/pkg/locales" logzap "git.perx.ru/perxis/perxis-go/zap" "go.uber.org/zap" @@ -74,7 +74,7 @@ func (m *loggingMiddleware) Delete(ctx context.Context, spaceId, id string) (err logger := m.logger.With( logzap.Caller(ctx), logzap.Event(locales.EventDelete), - logzap.Object(oid.NewLocaleId(spaceId, id)), + logzap.Object(pkgId.NewLocaleId(spaceId, id)), ) err = m.next.Delete(ctx, spaceId, id) diff --git a/pkg/locales/middleware/telemetry_middleware.go b/pkg/locales/middleware/telemetry_middleware.go index 971f2c295ad38c994b46bad688c939945ba4c854..8016481d9aa52df48913535ad2498757eebc6e7d 100644 --- a/pkg/locales/middleware/telemetry_middleware.go +++ b/pkg/locales/middleware/telemetry_middleware.go @@ -10,7 +10,7 @@ import ( "context" "time" - oid "git.perx.ru/perxis/perxis-go/id" + pkgId "git.perx.ru/perxis/perxis-go/id" "git.perx.ru/perxis/perxis-go/pkg/auth" "git.perx.ru/perxis/perxis-go/pkg/locales" "git.perx.ru/perxis/perxis-go/pkg/telemetry/metrics" @@ -84,7 +84,7 @@ func (_d telemetryMiddleware) Create(ctx context.Context, locale *locales.Locale if spID != "" { att = append(att, attribute.String("spaceID", spID)) } - caller, _ := oid.NewObjectId(auth.GetPrincipal(ctx)) + caller, _ := pkgId.NewObjectId(auth.GetPrincipal(ctx)) if caller != nil { att = append(att, attribute.String("caller", caller.String())) } @@ -129,7 +129,7 @@ func (_d telemetryMiddleware) Delete(ctx context.Context, spaceId string, id str if spID != "" { att = append(att, attribute.String("spaceID", spID)) } - caller, _ := oid.NewObjectId(auth.GetPrincipal(ctx)) + caller, _ := pkgId.NewObjectId(auth.GetPrincipal(ctx)) if caller != nil { att = append(att, attribute.String("caller", caller.String())) } @@ -174,7 +174,7 @@ func (_d telemetryMiddleware) List(ctx context.Context, spaceId string) (locales if spID != "" { att = append(att, attribute.String("spaceID", spID)) } - caller, _ := oid.NewObjectId(auth.GetPrincipal(ctx)) + caller, _ := pkgId.NewObjectId(auth.GetPrincipal(ctx)) if caller != nil { att = append(att, attribute.String("caller", caller.String())) } @@ -230,7 +230,7 @@ func (_d telemetryMiddleware) Update(ctx context.Context, locale *locales.Locale if spID != "" { att = append(att, attribute.String("spaceID", spID)) } - caller, _ := oid.NewObjectId(auth.GetPrincipal(ctx)) + caller, _ := pkgId.NewObjectId(auth.GetPrincipal(ctx)) if caller != nil { att = append(att, attribute.String("caller", caller.String())) } diff --git a/pkg/members/middleware/telemetry_middleware.go b/pkg/members/middleware/telemetry_middleware.go index bf339f3fd998e3e49d842a6b99612759743aced5..04dc47d3f407b91ea60bf9f1b78e70aabec4ce1d 100644 --- a/pkg/members/middleware/telemetry_middleware.go +++ b/pkg/members/middleware/telemetry_middleware.go @@ -10,7 +10,7 @@ import ( "context" "time" - oid "git.perx.ru/perxis/perxis-go/id" + pkgId "git.perx.ru/perxis/perxis-go/id" "git.perx.ru/perxis/perxis-go/pkg/auth" "git.perx.ru/perxis/perxis-go/pkg/members" "git.perx.ru/perxis/perxis-go/pkg/telemetry/metrics" @@ -68,7 +68,7 @@ func (_d telemetryMiddleware) Get(ctx context.Context, orgId string, userId stri _d.requestMetrics.DurationMilliseconds.Record(ctx, time.Since(start).Milliseconds(), attributes) - caller, _ := oid.NewObjectId(auth.GetPrincipal(ctx)) + caller, _ := pkgId.NewObjectId(auth.GetPrincipal(ctx)) if caller != nil { att = append(att, attribute.String("caller", caller.String())) } @@ -109,7 +109,7 @@ func (_d telemetryMiddleware) ListMembers(ctx context.Context, orgId string) (me _d.requestMetrics.DurationMilliseconds.Record(ctx, time.Since(start).Milliseconds(), attributes) - caller, _ := oid.NewObjectId(auth.GetPrincipal(ctx)) + caller, _ := pkgId.NewObjectId(auth.GetPrincipal(ctx)) if caller != nil { att = append(att, attribute.String("caller", caller.String())) } @@ -149,7 +149,7 @@ func (_d telemetryMiddleware) ListOrganizations(ctx context.Context, userId stri _d.requestMetrics.DurationMilliseconds.Record(ctx, time.Since(start).Milliseconds(), attributes) - caller, _ := oid.NewObjectId(auth.GetPrincipal(ctx)) + caller, _ := pkgId.NewObjectId(auth.GetPrincipal(ctx)) if caller != nil { att = append(att, attribute.String("caller", caller.String())) } @@ -189,7 +189,7 @@ func (_d telemetryMiddleware) Remove(ctx context.Context, orgId string, userId s _d.requestMetrics.DurationMilliseconds.Record(ctx, time.Since(start).Milliseconds(), attributes) - caller, _ := oid.NewObjectId(auth.GetPrincipal(ctx)) + caller, _ := pkgId.NewObjectId(auth.GetPrincipal(ctx)) if caller != nil { att = append(att, attribute.String("caller", caller.String())) } @@ -229,7 +229,7 @@ func (_d telemetryMiddleware) RemoveAll(ctx context.Context, orgId string) (err _d.requestMetrics.DurationMilliseconds.Record(ctx, time.Since(start).Milliseconds(), attributes) - caller, _ := oid.NewObjectId(auth.GetPrincipal(ctx)) + caller, _ := pkgId.NewObjectId(auth.GetPrincipal(ctx)) if caller != nil { att = append(att, attribute.String("caller", caller.String())) } @@ -268,7 +268,7 @@ func (_d telemetryMiddleware) Set(ctx context.Context, orgId string, userId stri _d.requestMetrics.DurationMilliseconds.Record(ctx, time.Since(start).Milliseconds(), attributes) - caller, _ := oid.NewObjectId(auth.GetPrincipal(ctx)) + caller, _ := pkgId.NewObjectId(auth.GetPrincipal(ctx)) if caller != nil { att = append(att, attribute.String("caller", caller.String())) } diff --git a/pkg/organizations/middleware/logging_middleware.go b/pkg/organizations/middleware/logging_middleware.go index a3550ab1963fbad761c7dc39c18b38e0e6740f20..ae3481aecde295102d6e9483c22c87e65b423592 100644 --- a/pkg/organizations/middleware/logging_middleware.go +++ b/pkg/organizations/middleware/logging_middleware.go @@ -3,7 +3,7 @@ package middleware import ( "context" - oid "git.perx.ru/perxis/perxis-go/id" + pkgId "git.perx.ru/perxis/perxis-go/id" "git.perx.ru/perxis/perxis-go/pkg/organizations" "git.perx.ru/perxis/perxis-go/pkg/options" @@ -46,7 +46,7 @@ func (m *loggingMiddleware) Delete(ctx context.Context, id string) (err error) { logger := m.logger.With( logzap.Caller(ctx), logzap.Event(organizations.EventDelete), - logzap.Object(oid.NewOrganizationId(id)), + logzap.Object(pkgId.NewOrganizationId(id)), ) err = m.next.Delete(ctx, id) @@ -77,7 +77,7 @@ func (m *loggingMiddleware) Find(ctx context.Context, filter *organizations.Filt func (m *loggingMiddleware) Get(ctx context.Context, id string) (org *organizations.Organization, err error) { logger := m.logger.With( logzap.Caller(ctx), - logzap.Object(oid.NewOrganizationId(id)), + logzap.Object(pkgId.NewOrganizationId(id)), ) org, err = m.next.Get(ctx, id) diff --git a/pkg/organizations/middleware/telemetry_middleware.go b/pkg/organizations/middleware/telemetry_middleware.go index 27c920d48ab6f587c657f68cc8b54d8b35cc56d0..ae945b477f841e611f20b945d4ac387cd6b96a6b 100644 --- a/pkg/organizations/middleware/telemetry_middleware.go +++ b/pkg/organizations/middleware/telemetry_middleware.go @@ -10,7 +10,7 @@ import ( "context" "time" - oid "git.perx.ru/perxis/perxis-go/id" + pkgId "git.perx.ru/perxis/perxis-go/id" "git.perx.ru/perxis/perxis-go/pkg/auth" "git.perx.ru/perxis/perxis-go/pkg/options" "git.perx.ru/perxis/perxis-go/pkg/organizations" @@ -69,7 +69,7 @@ func (_d telemetryMiddleware) Create(ctx context.Context, org *organizations.Org _d.requestMetrics.DurationMilliseconds.Record(ctx, time.Since(start).Milliseconds(), attributes) - caller, _ := oid.NewObjectId(auth.GetPrincipal(ctx)) + caller, _ := pkgId.NewObjectId(auth.GetPrincipal(ctx)) if caller != nil { att = append(att, attribute.String("caller", caller.String())) } @@ -109,7 +109,7 @@ func (_d telemetryMiddleware) Delete(ctx context.Context, id string) (err error) _d.requestMetrics.DurationMilliseconds.Record(ctx, time.Since(start).Milliseconds(), attributes) - caller, _ := oid.NewObjectId(auth.GetPrincipal(ctx)) + caller, _ := pkgId.NewObjectId(auth.GetPrincipal(ctx)) if caller != nil { att = append(att, attribute.String("caller", caller.String())) } @@ -148,7 +148,7 @@ func (_d telemetryMiddleware) Find(ctx context.Context, filter *organizations.Fi _d.requestMetrics.DurationMilliseconds.Record(ctx, time.Since(start).Milliseconds(), attributes) - caller, _ := oid.NewObjectId(auth.GetPrincipal(ctx)) + caller, _ := pkgId.NewObjectId(auth.GetPrincipal(ctx)) if caller != nil { att = append(att, attribute.String("caller", caller.String())) } @@ -190,7 +190,7 @@ func (_d telemetryMiddleware) Get(ctx context.Context, id string) (org *organiza _d.requestMetrics.DurationMilliseconds.Record(ctx, time.Since(start).Milliseconds(), attributes) - caller, _ := oid.NewObjectId(auth.GetPrincipal(ctx)) + caller, _ := pkgId.NewObjectId(auth.GetPrincipal(ctx)) if caller != nil { att = append(att, attribute.String("caller", caller.String())) } @@ -230,7 +230,7 @@ func (_d telemetryMiddleware) Update(ctx context.Context, org *organizations.Org _d.requestMetrics.DurationMilliseconds.Record(ctx, time.Since(start).Milliseconds(), attributes) - caller, _ := oid.NewObjectId(auth.GetPrincipal(ctx)) + caller, _ := pkgId.NewObjectId(auth.GetPrincipal(ctx)) if caller != nil { att = append(att, attribute.String("caller", caller.String())) } diff --git a/pkg/references/middleware/telemetry_middleware.go b/pkg/references/middleware/telemetry_middleware.go index 3e8fbb773fd9bc548eed3f34f78a4f5adcbe1128..76eab9b32b7ab10252c7af38e3fdfa6dfa0e9058 100644 --- a/pkg/references/middleware/telemetry_middleware.go +++ b/pkg/references/middleware/telemetry_middleware.go @@ -10,7 +10,7 @@ import ( "context" "time" - oid "git.perx.ru/perxis/perxis-go/id" + pkgId "git.perx.ru/perxis/perxis-go/id" "git.perx.ru/perxis/perxis-go/pkg/auth" "git.perx.ru/perxis/perxis-go/pkg/items" "git.perx.ru/perxis/perxis-go/pkg/references" @@ -74,7 +74,7 @@ func (_d telemetryMiddleware) Get(ctx context.Context, spaceId string, envId str if spID != "" { att = append(att, attribute.String("spaceID", spID)) } - caller, _ := oid.NewObjectId(auth.GetPrincipal(ctx)) + caller, _ := pkgId.NewObjectId(auth.GetPrincipal(ctx)) if caller != nil { att = append(att, attribute.String("caller", caller.String())) } @@ -123,7 +123,7 @@ func (_d telemetryMiddleware) Publish(ctx context.Context, spaceId string, envId if spID != "" { att = append(att, attribute.String("spaceID", spID)) } - caller, _ := oid.NewObjectId(auth.GetPrincipal(ctx)) + caller, _ := pkgId.NewObjectId(auth.GetPrincipal(ctx)) if caller != nil { att = append(att, attribute.String("caller", caller.String())) } diff --git a/pkg/roles/middleware/logging_middleware.go b/pkg/roles/middleware/logging_middleware.go index 8c1d4916bb09f14ef295670970abf53557e0c695..ed480ab756cbadaa8e2447698abc3f255e968618 100644 --- a/pkg/roles/middleware/logging_middleware.go +++ b/pkg/roles/middleware/logging_middleware.go @@ -3,7 +3,7 @@ package middleware import ( "context" - oid "git.perx.ru/perxis/perxis-go/id" + pkgId "git.perx.ru/perxis/perxis-go/id" "git.perx.ru/perxis/perxis-go/pkg/roles" logzap "git.perx.ru/perxis/perxis-go/zap" "go.uber.org/zap" @@ -43,7 +43,7 @@ func (m *loggingMiddleware) Create(ctx context.Context, role *roles.Role) (creat func (m *loggingMiddleware) Get(ctx context.Context, spaceId, id string) (role *roles.Role, err error) { logger := m.logger.With( logzap.Caller(ctx), - logzap.Object(oid.NewRoleId(spaceId, id)), + logzap.Object(pkgId.NewRoleId(spaceId, id)), ) role, err = m.next.Get(ctx, spaceId, id) @@ -91,7 +91,7 @@ func (m *loggingMiddleware) Delete(ctx context.Context, spaceId, id string) (err logger := m.logger.With( logzap.Caller(ctx), logzap.Event(roles.EventDelete), - logzap.Object(oid.NewRoleId(spaceId, id)), + logzap.Object(pkgId.NewRoleId(spaceId, id)), ) err = m.next.Delete(ctx, spaceId, id) diff --git a/pkg/roles/middleware/telemetry_middleware.go b/pkg/roles/middleware/telemetry_middleware.go index cdb71b1ff2152cbe604df898d8b883832183a592..cf5fe9516111e46ee07dd27c5dc1ae25b19e1829 100644 --- a/pkg/roles/middleware/telemetry_middleware.go +++ b/pkg/roles/middleware/telemetry_middleware.go @@ -10,7 +10,7 @@ import ( "context" "time" - oid "git.perx.ru/perxis/perxis-go/id" + pkgId "git.perx.ru/perxis/perxis-go/id" "git.perx.ru/perxis/perxis-go/pkg/auth" "git.perx.ru/perxis/perxis-go/pkg/roles" "git.perx.ru/perxis/perxis-go/pkg/telemetry/metrics" @@ -84,7 +84,7 @@ func (_d telemetryMiddleware) Create(ctx context.Context, role *roles.Role) (cre if spID != "" { att = append(att, attribute.String("spaceID", spID)) } - caller, _ := oid.NewObjectId(auth.GetPrincipal(ctx)) + caller, _ := pkgId.NewObjectId(auth.GetPrincipal(ctx)) if caller != nil { att = append(att, attribute.String("caller", caller.String())) } @@ -129,7 +129,7 @@ func (_d telemetryMiddleware) Delete(ctx context.Context, spaceId string, id str if spID != "" { att = append(att, attribute.String("spaceID", spID)) } - caller, _ := oid.NewObjectId(auth.GetPrincipal(ctx)) + caller, _ := pkgId.NewObjectId(auth.GetPrincipal(ctx)) if caller != nil { att = append(att, attribute.String("caller", caller.String())) } @@ -174,7 +174,7 @@ func (_d telemetryMiddleware) Get(ctx context.Context, spaceId string, id string if spID != "" { att = append(att, attribute.String("spaceID", spID)) } - caller, _ := oid.NewObjectId(auth.GetPrincipal(ctx)) + caller, _ := pkgId.NewObjectId(auth.GetPrincipal(ctx)) if caller != nil { att = append(att, attribute.String("caller", caller.String())) } @@ -220,7 +220,7 @@ func (_d telemetryMiddleware) List(ctx context.Context, spaceId string) (roles [ if spID != "" { att = append(att, attribute.String("spaceID", spID)) } - caller, _ := oid.NewObjectId(auth.GetPrincipal(ctx)) + caller, _ := pkgId.NewObjectId(auth.GetPrincipal(ctx)) if caller != nil { att = append(att, attribute.String("caller", caller.String())) } @@ -276,7 +276,7 @@ func (_d telemetryMiddleware) Update(ctx context.Context, role *roles.Role) (err if spID != "" { att = append(att, attribute.String("spaceID", spID)) } - caller, _ := oid.NewObjectId(auth.GetPrincipal(ctx)) + caller, _ := pkgId.NewObjectId(auth.GetPrincipal(ctx)) if caller != nil { att = append(att, attribute.String("caller", caller.String())) } diff --git a/pkg/spaces/middleware/logging_middleware.go b/pkg/spaces/middleware/logging_middleware.go index 9ff01f30fb6d275cb2d4aae5dcc73724ffdd12ae..9ef74b519fde30e2b3816fceb719bdf69a0e2e0b 100644 --- a/pkg/spaces/middleware/logging_middleware.go +++ b/pkg/spaces/middleware/logging_middleware.go @@ -4,7 +4,7 @@ import ( "context" "fmt" - oid "git.perx.ru/perxis/perxis-go/id" + pkgId "git.perx.ru/perxis/perxis-go/id" "git.perx.ru/perxis/perxis-go/pkg/options" "git.perx.ru/perxis/perxis-go/pkg/spaces" @@ -30,7 +30,7 @@ func (m *loggingMiddleware) AbortTransfer(ctx context.Context, id string) (err e logger := m.logger.With( logzap.Caller(ctx), logzap.Event(spaces.EventAbortTransfer), - logzap.Object(oid.NewSpaceId(id)), + logzap.Object(pkgId.NewSpaceId(id)), ) err = m.next.AbortTransfer(ctx, id) @@ -70,7 +70,7 @@ func (m *loggingMiddleware) Delete(ctx context.Context, id string) (err error) { logger := m.logger.With( logzap.Caller(ctx), logzap.Event(spaces.EventDelete), - logzap.Object(oid.NewOrganizationId(space.OrgID)), + logzap.Object(pkgId.NewOrganizationId(space.OrgID)), ) err = m.next.Delete(ctx, id) @@ -87,7 +87,7 @@ func (m *loggingMiddleware) Delete(ctx context.Context, id string) (err error) { func (m *loggingMiddleware) Get(ctx context.Context, spaceId string) (space *spaces.Space, err error) { logger := m.logger.With( logzap.Caller(ctx), - logzap.Object(oid.NewSpaceId(spaceId)), + logzap.Object(pkgId.NewSpaceId(spaceId)), ) space, err = m.next.Get(ctx, spaceId) @@ -145,7 +145,7 @@ func (m *loggingMiddleware) Move(ctx context.Context, id string, orgID string) ( logger := m.logger.With( logzap.Caller(ctx), logzap.Event(spaces.EventMove), - logzap.Object(oid.NewSpaceId(id)), + logzap.Object(pkgId.NewSpaceId(id)), ) err = m.next.Move(ctx, id, orgID) @@ -163,7 +163,7 @@ func (m *loggingMiddleware) Transfer(ctx context.Context, id string, transferToO logger := m.logger.With( logzap.Caller(ctx), logzap.Event(spaces.EventTransfer), - logzap.Object(oid.NewSpaceId(id)), + logzap.Object(pkgId.NewSpaceId(id)), ) err = m.next.Transfer(ctx, id, transferToOrg) @@ -199,7 +199,7 @@ func (m *loggingMiddleware) SetState(ctx context.Context, id string, state *spac logger := m.logger.With( logzap.Caller(ctx), logzap.Event(spaces.EventUpdate), - logzap.Object(oid.NewSpaceId(id)), + logzap.Object(pkgId.NewSpaceId(id)), ) var st spaces.State @@ -221,7 +221,7 @@ func (m *loggingMiddleware) UpdateConfig(ctx context.Context, id string, config logger := m.logger.With( logzap.Caller(ctx), logzap.Event(spaces.EventUpdateConfig), - logzap.Object(oid.NewSpaceId(id)), + logzap.Object(pkgId.NewSpaceId(id)), ) err = m.next.UpdateConfig(ctx, id, config) diff --git a/pkg/spaces/middleware/telemetry_middleware.go b/pkg/spaces/middleware/telemetry_middleware.go index 66f5251960c575a022d87db5516940d0d90775ba..acad14fee931e44affef04533464aabf68929c11 100644 --- a/pkg/spaces/middleware/telemetry_middleware.go +++ b/pkg/spaces/middleware/telemetry_middleware.go @@ -10,7 +10,7 @@ import ( "context" "time" - oid "git.perx.ru/perxis/perxis-go/id" + pkgId "git.perx.ru/perxis/perxis-go/id" "git.perx.ru/perxis/perxis-go/pkg/auth" "git.perx.ru/perxis/perxis-go/pkg/options" "git.perx.ru/perxis/perxis-go/pkg/spaces" @@ -85,7 +85,7 @@ func (_d telemetryMiddleware) AbortTransfer(ctx context.Context, id string) (err if spID != "" { att = append(att, attribute.String("spaceID", spID)) } - caller, _ := oid.NewObjectId(auth.GetPrincipal(ctx)) + caller, _ := pkgId.NewObjectId(auth.GetPrincipal(ctx)) if caller != nil { att = append(att, attribute.String("caller", caller.String())) } @@ -140,7 +140,7 @@ func (_d telemetryMiddleware) Create(ctx context.Context, space *spaces.Space) ( if spID != "" { att = append(att, attribute.String("spaceID", spID)) } - caller, _ := oid.NewObjectId(auth.GetPrincipal(ctx)) + caller, _ := pkgId.NewObjectId(auth.GetPrincipal(ctx)) if caller != nil { att = append(att, attribute.String("caller", caller.String())) } @@ -196,7 +196,7 @@ func (_d telemetryMiddleware) Delete(ctx context.Context, id string) (err error) if spID != "" { att = append(att, attribute.String("spaceID", spID)) } - caller, _ := oid.NewObjectId(auth.GetPrincipal(ctx)) + caller, _ := pkgId.NewObjectId(auth.GetPrincipal(ctx)) if caller != nil { att = append(att, attribute.String("caller", caller.String())) } @@ -251,7 +251,7 @@ func (_d telemetryMiddleware) Find(ctx context.Context, filter *spaces.Filter, f if spID != "" { att = append(att, attribute.String("spaceID", spID)) } - caller, _ := oid.NewObjectId(auth.GetPrincipal(ctx)) + caller, _ := pkgId.NewObjectId(auth.GetPrincipal(ctx)) if caller != nil { att = append(att, attribute.String("caller", caller.String())) } @@ -309,7 +309,7 @@ func (_d telemetryMiddleware) Get(ctx context.Context, id string) (space *spaces if spID != "" { att = append(att, attribute.String("spaceID", spID)) } - caller, _ := oid.NewObjectId(auth.GetPrincipal(ctx)) + caller, _ := pkgId.NewObjectId(auth.GetPrincipal(ctx)) if caller != nil { att = append(att, attribute.String("caller", caller.String())) } @@ -365,7 +365,7 @@ func (_d telemetryMiddleware) List(ctx context.Context, orgId string) (spaces [] if spID != "" { att = append(att, attribute.String("spaceID", spID)) } - caller, _ := oid.NewObjectId(auth.GetPrincipal(ctx)) + caller, _ := pkgId.NewObjectId(auth.GetPrincipal(ctx)) if caller != nil { att = append(att, attribute.String("caller", caller.String())) } @@ -421,7 +421,7 @@ func (_d telemetryMiddleware) ListTransfers(ctx context.Context, orgId string) ( if spID != "" { att = append(att, attribute.String("spaceID", spID)) } - caller, _ := oid.NewObjectId(auth.GetPrincipal(ctx)) + caller, _ := pkgId.NewObjectId(auth.GetPrincipal(ctx)) if caller != nil { att = append(att, attribute.String("caller", caller.String())) } @@ -477,7 +477,7 @@ func (_d telemetryMiddleware) Move(ctx context.Context, id string, orgId string) if spID != "" { att = append(att, attribute.String("spaceID", spID)) } - caller, _ := oid.NewObjectId(auth.GetPrincipal(ctx)) + caller, _ := pkgId.NewObjectId(auth.GetPrincipal(ctx)) if caller != nil { att = append(att, attribute.String("caller", caller.String())) } @@ -533,7 +533,7 @@ func (_d telemetryMiddleware) SetState(ctx context.Context, id string, state *sp if spID != "" { att = append(att, attribute.String("spaceID", spID)) } - caller, _ := oid.NewObjectId(auth.GetPrincipal(ctx)) + caller, _ := pkgId.NewObjectId(auth.GetPrincipal(ctx)) if caller != nil { att = append(att, attribute.String("caller", caller.String())) } @@ -589,7 +589,7 @@ func (_d telemetryMiddleware) Transfer(ctx context.Context, id string, transferT if spID != "" { att = append(att, attribute.String("spaceID", spID)) } - caller, _ := oid.NewObjectId(auth.GetPrincipal(ctx)) + caller, _ := pkgId.NewObjectId(auth.GetPrincipal(ctx)) if caller != nil { att = append(att, attribute.String("caller", caller.String())) } @@ -645,7 +645,7 @@ func (_d telemetryMiddleware) Update(ctx context.Context, space *spaces.Space) ( if spID != "" { att = append(att, attribute.String("spaceID", spID)) } - caller, _ := oid.NewObjectId(auth.GetPrincipal(ctx)) + caller, _ := pkgId.NewObjectId(auth.GetPrincipal(ctx)) if caller != nil { att = append(att, attribute.String("caller", caller.String())) } @@ -700,7 +700,7 @@ func (_d telemetryMiddleware) UpdateConfig(ctx context.Context, id string, confi if spID != "" { att = append(att, attribute.String("spaceID", spID)) } - caller, _ := oid.NewObjectId(auth.GetPrincipal(ctx)) + caller, _ := pkgId.NewObjectId(auth.GetPrincipal(ctx)) if caller != nil { att = append(att, attribute.String("caller", caller.String())) } diff --git a/pkg/users/middleware/logging_middleware.go b/pkg/users/middleware/logging_middleware.go index 46c322a3bc1ca1a68130f5c8c346e2d1a90701b0..8c609a740148a3a214bb989900a4812ba96ca6fd 100644 --- a/pkg/users/middleware/logging_middleware.go +++ b/pkg/users/middleware/logging_middleware.go @@ -3,7 +3,7 @@ package middleware import ( "context" - oid "git.perx.ru/perxis/perxis-go/id" + pkgId "git.perx.ru/perxis/perxis-go/id" "git.perx.ru/perxis/perxis-go/pkg/options" "git.perx.ru/perxis/perxis-go/pkg/users" logzap "git.perx.ru/perxis/perxis-go/zap" @@ -44,7 +44,7 @@ func (m *loggingMiddleware) Create(ctx context.Context, user *users.User) (creat func (m *loggingMiddleware) Get(ctx context.Context, id string) (user *users.User, err error) { logger := m.logger.With( logzap.Caller(ctx), - logzap.Object(oid.NewUserId(id)), + logzap.Object(pkgId.NewUserId(id)), ) user, err = m.next.Get(ctx, id) @@ -92,7 +92,7 @@ func (m *loggingMiddleware) Delete(ctx context.Context, id string) (err error) { logger := m.logger.With( logzap.Caller(ctx), logzap.Event(users.EventDelete), - logzap.Object(oid.NewUserId(id)), + logzap.Object(pkgId.NewUserId(id)), ) err = m.next.Delete(ctx, id) @@ -109,7 +109,7 @@ func (m *loggingMiddleware) Delete(ctx context.Context, id string) (err error) { func (m *loggingMiddleware) GetByIdentity(ctx context.Context, identity string) (user *users.User, err error) { logger := m.logger.With( logzap.Caller(ctx), - logzap.Object(oid.NewUserId(identity)), + logzap.Object(pkgId.NewUserId(identity)), ) user, err = m.next.GetByIdentity(ctx, identity) diff --git a/pkg/users/middleware/telemetry_middleware.go b/pkg/users/middleware/telemetry_middleware.go index 0553ad2ba1549d3969defbb38c3ae2acc20ef4ba..25088bfd631d5b2dd23c58d861c6051098d01907 100644 --- a/pkg/users/middleware/telemetry_middleware.go +++ b/pkg/users/middleware/telemetry_middleware.go @@ -10,7 +10,7 @@ import ( "context" "time" - oid "git.perx.ru/perxis/perxis-go/id" + pkgId "git.perx.ru/perxis/perxis-go/id" "git.perx.ru/perxis/perxis-go/pkg/auth" "git.perx.ru/perxis/perxis-go/pkg/options" "git.perx.ru/perxis/perxis-go/pkg/telemetry/metrics" @@ -69,7 +69,7 @@ func (_d telemetryMiddleware) Create(ctx context.Context, user *users.User) (cre _d.requestMetrics.DurationMilliseconds.Record(ctx, time.Since(start).Milliseconds(), attributes) - caller, _ := oid.NewObjectId(auth.GetPrincipal(ctx)) + caller, _ := pkgId.NewObjectId(auth.GetPrincipal(ctx)) if caller != nil { att = append(att, attribute.String("caller", caller.String())) } @@ -109,7 +109,7 @@ func (_d telemetryMiddleware) Delete(ctx context.Context, id string) (err error) _d.requestMetrics.DurationMilliseconds.Record(ctx, time.Since(start).Milliseconds(), attributes) - caller, _ := oid.NewObjectId(auth.GetPrincipal(ctx)) + caller, _ := pkgId.NewObjectId(auth.GetPrincipal(ctx)) if caller != nil { att = append(att, attribute.String("caller", caller.String())) } @@ -148,7 +148,7 @@ func (_d telemetryMiddleware) Find(ctx context.Context, filter *users.Filter, op _d.requestMetrics.DurationMilliseconds.Record(ctx, time.Since(start).Milliseconds(), attributes) - caller, _ := oid.NewObjectId(auth.GetPrincipal(ctx)) + caller, _ := pkgId.NewObjectId(auth.GetPrincipal(ctx)) if caller != nil { att = append(att, attribute.String("caller", caller.String())) } @@ -190,7 +190,7 @@ func (_d telemetryMiddleware) Get(ctx context.Context, id string) (user *users.U _d.requestMetrics.DurationMilliseconds.Record(ctx, time.Since(start).Milliseconds(), attributes) - caller, _ := oid.NewObjectId(auth.GetPrincipal(ctx)) + caller, _ := pkgId.NewObjectId(auth.GetPrincipal(ctx)) if caller != nil { att = append(att, attribute.String("caller", caller.String())) } @@ -230,7 +230,7 @@ func (_d telemetryMiddleware) GetByIdentity(ctx context.Context, identity string _d.requestMetrics.DurationMilliseconds.Record(ctx, time.Since(start).Milliseconds(), attributes) - caller, _ := oid.NewObjectId(auth.GetPrincipal(ctx)) + caller, _ := pkgId.NewObjectId(auth.GetPrincipal(ctx)) if caller != nil { att = append(att, attribute.String("caller", caller.String())) } @@ -270,7 +270,7 @@ func (_d telemetryMiddleware) Update(ctx context.Context, user *users.User) (err _d.requestMetrics.DurationMilliseconds.Record(ctx, time.Since(start).Milliseconds(), attributes) - caller, _ := oid.NewObjectId(auth.GetPrincipal(ctx)) + caller, _ := pkgId.NewObjectId(auth.GetPrincipal(ctx)) if caller != nil { att = append(att, attribute.String("caller", caller.String())) }