diff --git a/.github/workflows/go-combined-analysis.yml b/.github/workflows/go-combined-analysis.yml index 62dfef960..1d439422a 100644 --- a/.github/workflows/go-combined-analysis.yml +++ b/.github/workflows/go-combined-analysis.yml @@ -31,7 +31,7 @@ jobs: filter_paths: '["components/crm", "components/ledger"]' path_level: 2 app_name_prefix: "midaz" - go_version: "1.25.9" + go_version: "1.26.3" golangci_lint_version: "v2.4.0" golangci_lint_args: "--timeout=5m" coverage_threshold: 85 diff --git a/components/crm/.env.example b/components/crm/.env.example index 74dcfd63c..cc35fbf1e 100644 --- a/components/crm/.env.example +++ b/components/crm/.env.example @@ -46,7 +46,7 @@ OTEL_LIBRARY_NAME=github.com/LerianStudio/midaz/v3/components/crm OTEL_RESOURCE_SERVICE_VERSION=${VERSION} OTEL_RESOURCE_DEPLOYMENT_ENVIRONMENT=${ENV_NAME} OTEL_EXPORTER_OTLP_ENDPOINT_PORT=4317 -OTEL_EXPORTER_OTLP_ENDPOINT=otlp://midaz-otel-lgtm:${OTEL_EXPORTER_OTLP_ENDPOINT_PORT} +OTEL_EXPORTER_OTLP_ENDPOINT=http://midaz-otel-lgtm:${OTEL_EXPORTER_OTLP_ENDPOINT_PORT} ENABLE_TELEMETRY=false # DATA SECURITY diff --git a/components/crm/cmd/app/main.go b/components/crm/cmd/app/main.go index f7dacb7e5..29f0b104b 100644 --- a/components/crm/cmd/app/main.go +++ b/components/crm/cmd/app/main.go @@ -11,8 +11,8 @@ import ( "strings" libCommons "github.com/LerianStudio/lib-commons/v5/commons" - libLog "github.com/LerianStudio/lib-commons/v5/commons/log" - libZap "github.com/LerianStudio/lib-commons/v5/commons/zap" + libLog "github.com/LerianStudio/lib-observability/log" + libZap "github.com/LerianStudio/lib-observability/zap" "github.com/LerianStudio/midaz/v3/components/crm/internal/bootstrap" ) diff --git a/components/crm/internal/adapters/http/in/alias.go b/components/crm/internal/adapters/http/in/alias.go index f063f71d2..e56e3ee18 100644 --- a/components/crm/internal/adapters/http/in/alias.go +++ b/components/crm/internal/adapters/http/in/alias.go @@ -13,8 +13,9 @@ import ( "github.com/LerianStudio/midaz/v3/pkg/net/http" libCommons "github.com/LerianStudio/lib-commons/v5/commons" - libLog "github.com/LerianStudio/lib-commons/v5/commons/log" - libOpenTelemetry "github.com/LerianStudio/lib-commons/v5/commons/opentelemetry" + libObservability "github.com/LerianStudio/lib-observability" + libLog "github.com/LerianStudio/lib-observability/log" + libOpenTelemetry "github.com/LerianStudio/lib-observability/tracing" "github.com/gofiber/fiber/v2" "github.com/google/uuid" "go.opentelemetry.io/otel/attribute" @@ -43,7 +44,7 @@ type AliasHandler struct { func (handler *AliasHandler) CreateAlias(p any, c *fiber.Ctx) error { ctx := c.UserContext() - logger, tracer, reqId, _ := libCommons.NewTrackingFromContext(ctx) + logger, tracer, reqId, _ := libObservability.NewTrackingFromContext(ctx) ctx, span := tracer.Start(ctx, "handler.create_alias") defer span.End() @@ -97,7 +98,7 @@ func (handler *AliasHandler) CreateAlias(p any, c *fiber.Ctx) error { func (handler *AliasHandler) GetAliasByID(c *fiber.Ctx) error { ctx := c.UserContext() - logger, tracer, reqId, _ := libCommons.NewTrackingFromContext(ctx) + logger, tracer, reqId, _ := libObservability.NewTrackingFromContext(ctx) ctx, span := tracer.Start(ctx, "handler.get_alias_by_id") defer span.End() @@ -157,7 +158,7 @@ func (handler *AliasHandler) GetAliasByID(c *fiber.Ctx) error { func (handler *AliasHandler) UpdateAlias(p any, c *fiber.Ctx) error { ctx := c.UserContext() - logger, tracer, reqId, _ := libCommons.NewTrackingFromContext(ctx) + logger, tracer, reqId, _ := libObservability.NewTrackingFromContext(ctx) ctx, span := tracer.Start(ctx, "handler.update_alias") defer span.End() @@ -232,7 +233,7 @@ func (handler *AliasHandler) UpdateAlias(p any, c *fiber.Ctx) error { func (handler *AliasHandler) DeleteAliasByID(c *fiber.Ctx) error { ctx := c.UserContext() - logger, tracer, reqId, _ := libCommons.NewTrackingFromContext(ctx) + logger, tracer, reqId, _ := libObservability.NewTrackingFromContext(ctx) ctx, span := tracer.Start(ctx, "handler.remove_alias_by_id") defer span.End() @@ -303,7 +304,7 @@ func (handler *AliasHandler) DeleteAliasByID(c *fiber.Ctx) error { func (handler *AliasHandler) GetAllAliases(c *fiber.Ctx) error { ctx := c.UserContext() - logger, tracer, reqId, _ := libCommons.NewTrackingFromContext(ctx) + logger, tracer, reqId, _ := libObservability.NewTrackingFromContext(ctx) ctx, span := tracer.Start(ctx, "handler.get_all_aliases") defer span.End() @@ -384,7 +385,7 @@ func (handler *AliasHandler) GetAllAliases(c *fiber.Ctx) error { func (handler *AliasHandler) DeleteRelatedParty(c *fiber.Ctx) error { ctx := c.UserContext() - logger, tracer, reqId, _ := libCommons.NewTrackingFromContext(ctx) + logger, tracer, reqId, _ := libObservability.NewTrackingFromContext(ctx) ctx, span := tracer.Start(ctx, "handler.delete_related_party") defer span.End() diff --git a/components/crm/internal/adapters/http/in/holder.go b/components/crm/internal/adapters/http/in/holder.go index c8190339e..66c0d1600 100644 --- a/components/crm/internal/adapters/http/in/holder.go +++ b/components/crm/internal/adapters/http/in/holder.go @@ -12,9 +12,9 @@ import ( "github.com/LerianStudio/midaz/v3/pkg/mmodel" "github.com/LerianStudio/midaz/v3/pkg/net/http" - libCommons "github.com/LerianStudio/lib-commons/v5/commons" - libLog "github.com/LerianStudio/lib-commons/v5/commons/log" - libOpenTelemetry "github.com/LerianStudio/lib-commons/v5/commons/opentelemetry" + libCommons "github.com/LerianStudio/lib-observability" + libLog "github.com/LerianStudio/lib-observability/log" + libOpenTelemetry "github.com/LerianStudio/lib-observability/tracing" "github.com/gofiber/fiber/v2" "go.opentelemetry.io/otel/attribute" ) diff --git a/components/crm/internal/adapters/http/in/routes.go b/components/crm/internal/adapters/http/in/routes.go index 095a6cae3..bfe26c5c1 100644 --- a/components/crm/internal/adapters/http/in/routes.go +++ b/components/crm/internal/adapters/http/in/routes.go @@ -9,9 +9,10 @@ import ( "github.com/LerianStudio/midaz/v3/pkg/net/http" "github.com/LerianStudio/lib-auth/v2/auth/middleware" - libLog "github.com/LerianStudio/lib-commons/v5/commons/log" + libLog "github.com/LerianStudio/lib-observability/log" libHTTP "github.com/LerianStudio/lib-commons/v5/commons/net/http" - libOpenTelemetry "github.com/LerianStudio/lib-commons/v5/commons/opentelemetry" + libObsMiddleware "github.com/LerianStudio/lib-observability/middleware" + libOpenTelemetry "github.com/LerianStudio/lib-observability/tracing" "github.com/gofiber/fiber/v2" "github.com/gofiber/fiber/v2/middleware/cors" fiberSwagger "github.com/swaggo/fiber-swagger" @@ -32,13 +33,13 @@ func NewRouter(lg libLog.Logger, tl *libOpenTelemetry.Telemetry, auth *middlewar return libHTTP.FiberErrorHandler(ctx, err) }, }) - tlMid := libHTTP.NewTelemetryMiddleware(tl) + tlMid := libObsMiddleware.NewTelemetryMiddleware(tl) f.Use(ErrorCodeTransformer()) // Transform generic error codes to CRM-specific codes f.Use(http.WithRecover(http.WithRecoverLogger(lg))) f.Use(tlMid.WithTelemetry(tl)) f.Use(cors.New()) - f.Use(libHTTP.WithHTTPLogging(libHTTP.WithCustomLogger(lg))) + f.Use(libObsMiddleware.WithHTTPLogging(libObsMiddleware.WithCustomLogger(lg))) // Public endpoints: registered BEFORE tenant middleware so they remain // accessible to Kubernetes probes, load balancer health checks, and // Swagger documentation without requiring a JWT or tenant context. diff --git a/components/crm/internal/adapters/http/in/routes_test.go b/components/crm/internal/adapters/http/in/routes_test.go index 5b7d9701a..e267bcb25 100644 --- a/components/crm/internal/adapters/http/in/routes_test.go +++ b/components/crm/internal/adapters/http/in/routes_test.go @@ -12,8 +12,8 @@ import ( "testing" "github.com/LerianStudio/lib-auth/v2/auth/middleware" - libLog "github.com/LerianStudio/lib-commons/v5/commons/log" - libOpentelemetry "github.com/LerianStudio/lib-commons/v5/commons/opentelemetry" + libLog "github.com/LerianStudio/lib-observability/log" + libOpentelemetry "github.com/LerianStudio/lib-observability/tracing" "github.com/gofiber/fiber/v2" "github.com/stretchr/testify/assert" "github.com/stretchr/testify/require" diff --git a/components/crm/internal/adapters/mongodb/alias/alias.mongodb.go b/components/crm/internal/adapters/mongodb/alias/alias.mongodb.go index c9f30df60..703af3f8f 100644 --- a/components/crm/internal/adapters/mongodb/alias/alias.mongodb.go +++ b/components/crm/internal/adapters/mongodb/alias/alias.mongodb.go @@ -17,11 +17,11 @@ import ( "github.com/LerianStudio/midaz/v3/pkg/mmodel" "github.com/LerianStudio/midaz/v3/pkg/net/http" - libCommons "github.com/LerianStudio/lib-commons/v5/commons" + libCommons "github.com/LerianStudio/lib-observability" libCrypto "github.com/LerianStudio/lib-commons/v5/commons/crypto" - libLog "github.com/LerianStudio/lib-commons/v5/commons/log" + libLog "github.com/LerianStudio/lib-observability/log" libMongo "github.com/LerianStudio/lib-commons/v5/commons/mongo" - libOpenTelemetry "github.com/LerianStudio/lib-commons/v5/commons/opentelemetry" + libOpenTelemetry "github.com/LerianStudio/lib-observability/tracing" tmcore "github.com/LerianStudio/lib-commons/v5/commons/tenant-manager/core" mongoUtils "github.com/LerianStudio/midaz/v3/pkg/mongo" "github.com/google/uuid" diff --git a/components/crm/internal/adapters/mongodb/alias/alias_maintenance.mongodb.go b/components/crm/internal/adapters/mongodb/alias/alias_maintenance.mongodb.go index 6be6b9558..3dce33e7c 100644 --- a/components/crm/internal/adapters/mongodb/alias/alias_maintenance.mongodb.go +++ b/components/crm/internal/adapters/mongodb/alias/alias_maintenance.mongodb.go @@ -11,9 +11,9 @@ import ( "strings" "time" - libCommons "github.com/LerianStudio/lib-commons/v5/commons" - libLog "github.com/LerianStudio/lib-commons/v5/commons/log" - libOpenTelemetry "github.com/LerianStudio/lib-commons/v5/commons/opentelemetry" + libCommons "github.com/LerianStudio/lib-observability" + libLog "github.com/LerianStudio/lib-observability/log" + libOpenTelemetry "github.com/LerianStudio/lib-observability/tracing" "github.com/LerianStudio/midaz/v3/pkg" cn "github.com/LerianStudio/midaz/v3/pkg/constant" "github.com/LerianStudio/midaz/v3/pkg/mmodel" diff --git a/components/crm/internal/adapters/mongodb/alias/alias_query.mongodb.go b/components/crm/internal/adapters/mongodb/alias/alias_query.mongodb.go index 06717265f..2c023349b 100644 --- a/components/crm/internal/adapters/mongodb/alias/alias_query.mongodb.go +++ b/components/crm/internal/adapters/mongodb/alias/alias_query.mongodb.go @@ -9,7 +9,8 @@ import ( "strings" libCommons "github.com/LerianStudio/lib-commons/v5/commons" - libOpenTelemetry "github.com/LerianStudio/lib-commons/v5/commons/opentelemetry" + libObservability "github.com/LerianStudio/lib-observability" + libOpenTelemetry "github.com/LerianStudio/lib-observability/tracing" "github.com/LerianStudio/midaz/v3/pkg/mmodel" "github.com/LerianStudio/midaz/v3/pkg/net/http" "github.com/google/uuid" @@ -20,7 +21,7 @@ import ( // FindAll accounts by holder id and filter func (am *MongoDBRepository) FindAll(ctx context.Context, organizationID string, holderID uuid.UUID, query http.QueryHeader, includeDeleted bool) ([]*mmodel.Alias, error) { - _, tracer, reqId, _ := libCommons.NewTrackingFromContext(ctx) + _, tracer, reqId, _ := libObservability.NewTrackingFromContext(ctx) ctx, span := tracer.Start(ctx, "mongodb.find_all_aliases") defer span.End() @@ -187,7 +188,7 @@ func (am *MongoDBRepository) buildAliasFilter(query http.QueryHeader, holderID u } func (am *MongoDBRepository) Count(ctx context.Context, organizationID string, holderID uuid.UUID) (int64, error) { - _, tracer, reqId, _ := libCommons.NewTrackingFromContext(ctx) + _, tracer, reqId, _ := libObservability.NewTrackingFromContext(ctx) ctx, span := tracer.Start(ctx, "mongodb.find_all_alias") defer span.End() diff --git a/components/crm/internal/adapters/mongodb/holder/holder.mongodb.go b/components/crm/internal/adapters/mongodb/holder/holder.mongodb.go index 8339f6529..307461d31 100644 --- a/components/crm/internal/adapters/mongodb/holder/holder.mongodb.go +++ b/components/crm/internal/adapters/mongodb/holder/holder.mongodb.go @@ -17,11 +17,11 @@ import ( "github.com/LerianStudio/midaz/v3/pkg/mmodel" "github.com/LerianStudio/midaz/v3/pkg/net/http" - libCommons "github.com/LerianStudio/lib-commons/v5/commons" + libCommons "github.com/LerianStudio/lib-observability" libCrypto "github.com/LerianStudio/lib-commons/v5/commons/crypto" - libLog "github.com/LerianStudio/lib-commons/v5/commons/log" + libLog "github.com/LerianStudio/lib-observability/log" libMongo "github.com/LerianStudio/lib-commons/v5/commons/mongo" - libOpenTelemetry "github.com/LerianStudio/lib-commons/v5/commons/opentelemetry" + libOpenTelemetry "github.com/LerianStudio/lib-observability/tracing" tmcore "github.com/LerianStudio/lib-commons/v5/commons/tenant-manager/core" mongoUtils "github.com/LerianStudio/midaz/v3/pkg/mongo" "github.com/google/uuid" diff --git a/components/crm/internal/adapters/mongodb/holder/holder_query.mongodb.go b/components/crm/internal/adapters/mongodb/holder/holder_query.mongodb.go index 7f552ec7a..82487e880 100644 --- a/components/crm/internal/adapters/mongodb/holder/holder_query.mongodb.go +++ b/components/crm/internal/adapters/mongodb/holder/holder_query.mongodb.go @@ -8,8 +8,8 @@ import ( "context" "strings" - libCommons "github.com/LerianStudio/lib-commons/v5/commons" - libOpenTelemetry "github.com/LerianStudio/lib-commons/v5/commons/opentelemetry" + libCommons "github.com/LerianStudio/lib-observability" + libOpenTelemetry "github.com/LerianStudio/lib-observability/tracing" "github.com/LerianStudio/midaz/v3/pkg/mmodel" "github.com/LerianStudio/midaz/v3/pkg/net/http" "go.mongodb.org/mongo-driver/bson" diff --git a/components/crm/internal/bootstrap/config.go b/components/crm/internal/bootstrap/config.go index 58e87aab4..4e001956e 100644 --- a/components/crm/internal/bootstrap/config.go +++ b/components/crm/internal/bootstrap/config.go @@ -13,11 +13,11 @@ import ( "github.com/LerianStudio/lib-auth/v2/auth/middleware" libCommons "github.com/LerianStudio/lib-commons/v5/commons" libCrypto "github.com/LerianStudio/lib-commons/v5/commons/crypto" - libLog "github.com/LerianStudio/lib-commons/v5/commons/log" + libLog "github.com/LerianStudio/lib-observability/log" libMongo "github.com/LerianStudio/lib-commons/v5/commons/mongo" - libOpentelemetry "github.com/LerianStudio/lib-commons/v5/commons/opentelemetry" - "github.com/LerianStudio/lib-commons/v5/commons/opentelemetry/metrics" - libZap "github.com/LerianStudio/lib-commons/v5/commons/zap" + libOpentelemetry "github.com/LerianStudio/lib-observability/tracing" + "github.com/LerianStudio/lib-observability/metrics" + libZap "github.com/LerianStudio/lib-observability/zap" "github.com/LerianStudio/midaz/v3/components/crm/internal/adapters/http/in" "github.com/LerianStudio/midaz/v3/components/crm/internal/adapters/mongodb/alias" "github.com/LerianStudio/midaz/v3/components/crm/internal/adapters/mongodb/holder" diff --git a/components/crm/internal/bootstrap/config.tenant.go b/components/crm/internal/bootstrap/config.tenant.go index 359f6a3a4..b47a5c6fc 100644 --- a/components/crm/internal/bootstrap/config.tenant.go +++ b/components/crm/internal/bootstrap/config.tenant.go @@ -11,9 +11,9 @@ import ( "strings" "time" - libLog "github.com/LerianStudio/lib-commons/v5/commons/log" - libOpentelemetry "github.com/LerianStudio/lib-commons/v5/commons/opentelemetry" - "github.com/LerianStudio/lib-commons/v5/commons/opentelemetry/metrics" + libLog "github.com/LerianStudio/lib-observability/log" + libOpentelemetry "github.com/LerianStudio/lib-observability/tracing" + "github.com/LerianStudio/lib-observability/metrics" tmclient "github.com/LerianStudio/lib-commons/v5/commons/tenant-manager/client" tmevent "github.com/LerianStudio/lib-commons/v5/commons/tenant-manager/event" tmmiddleware "github.com/LerianStudio/lib-commons/v5/commons/tenant-manager/middleware" diff --git a/components/crm/internal/bootstrap/config_test.go b/components/crm/internal/bootstrap/config_test.go index 79b8e157d..38c9a2be6 100644 --- a/components/crm/internal/bootstrap/config_test.go +++ b/components/crm/internal/bootstrap/config_test.go @@ -10,8 +10,8 @@ import ( "reflect" "testing" - libLog "github.com/LerianStudio/lib-commons/v5/commons/log" - libOpentelemetry "github.com/LerianStudio/lib-commons/v5/commons/opentelemetry" + libLog "github.com/LerianStudio/lib-observability/log" + libOpentelemetry "github.com/LerianStudio/lib-observability/tracing" "github.com/gofiber/fiber/v2" "github.com/stretchr/testify/assert" "github.com/stretchr/testify/require" diff --git a/components/crm/internal/bootstrap/readyz.go b/components/crm/internal/bootstrap/readyz.go index 9546a713c..4dbc4fd7c 100644 --- a/components/crm/internal/bootstrap/readyz.go +++ b/components/crm/internal/bootstrap/readyz.go @@ -11,8 +11,8 @@ import ( "sync/atomic" "time" - libLog "github.com/LerianStudio/lib-commons/v5/commons/log" - "github.com/LerianStudio/lib-commons/v5/commons/opentelemetry/metrics" + libLog "github.com/LerianStudio/lib-observability/log" + "github.com/LerianStudio/lib-observability/metrics" "github.com/LerianStudio/midaz/v3/pkg/utils" "github.com/gofiber/fiber/v2" "go.opentelemetry.io/otel/attribute" diff --git a/components/crm/internal/bootstrap/readyz_checkers.go b/components/crm/internal/bootstrap/readyz_checkers.go index aabdba6cd..6f2a26d0f 100644 --- a/components/crm/internal/bootstrap/readyz_checkers.go +++ b/components/crm/internal/bootstrap/readyz_checkers.go @@ -9,7 +9,7 @@ import ( "fmt" "time" - libLog "github.com/LerianStudio/lib-commons/v5/commons/log" + libLog "github.com/LerianStudio/lib-observability/log" libMongo "github.com/LerianStudio/lib-commons/v5/commons/mongo" ) diff --git a/components/crm/internal/bootstrap/readyz_integration_test.go b/components/crm/internal/bootstrap/readyz_integration_test.go index 6dfaa10fd..4745b654b 100644 --- a/components/crm/internal/bootstrap/readyz_integration_test.go +++ b/components/crm/internal/bootstrap/readyz_integration_test.go @@ -13,7 +13,7 @@ import ( "net/http/httptest" "testing" - libLog "github.com/LerianStudio/lib-commons/v5/commons/log" + libLog "github.com/LerianStudio/lib-observability/log" "github.com/gofiber/fiber/v2" "github.com/stretchr/testify/assert" "github.com/stretchr/testify/require" diff --git a/components/crm/internal/bootstrap/readyz_test.go b/components/crm/internal/bootstrap/readyz_test.go index 41e4e376f..4d528e8e1 100644 --- a/components/crm/internal/bootstrap/readyz_test.go +++ b/components/crm/internal/bootstrap/readyz_test.go @@ -13,7 +13,7 @@ import ( "testing" "time" - libLog "github.com/LerianStudio/lib-commons/v5/commons/log" + libLog "github.com/LerianStudio/lib-observability/log" "github.com/gofiber/fiber/v2" "github.com/stretchr/testify/assert" "github.com/stretchr/testify/require" diff --git a/components/crm/internal/bootstrap/server.go b/components/crm/internal/bootstrap/server.go index be36d9d5b..8d375edd7 100644 --- a/components/crm/internal/bootstrap/server.go +++ b/components/crm/internal/bootstrap/server.go @@ -9,8 +9,8 @@ import ( "time" libCommons "github.com/LerianStudio/lib-commons/v5/commons" - libCommonsLog "github.com/LerianStudio/lib-commons/v5/commons/log" - libCommonsOtel "github.com/LerianStudio/lib-commons/v5/commons/opentelemetry" + libCommonsLog "github.com/LerianStudio/lib-observability/log" + libCommonsOtel "github.com/LerianStudio/lib-observability/tracing" libCommonsServer "github.com/LerianStudio/lib-commons/v5/commons/server" "github.com/gofiber/fiber/v2" ) diff --git a/components/crm/internal/bootstrap/service.go b/components/crm/internal/bootstrap/service.go index b2fc05847..bd9b0c76a 100644 --- a/components/crm/internal/bootstrap/service.go +++ b/components/crm/internal/bootstrap/service.go @@ -11,7 +11,7 @@ import ( "syscall" libCommons "github.com/LerianStudio/lib-commons/v5/commons" - libLog "github.com/LerianStudio/lib-commons/v5/commons/log" + libLog "github.com/LerianStudio/lib-observability/log" tmevent "github.com/LerianStudio/lib-commons/v5/commons/tenant-manager/event" ) diff --git a/components/crm/internal/services/create-alias.go b/components/crm/internal/services/create-alias.go index 03a59f923..e0eb55dbb 100644 --- a/components/crm/internal/services/create-alias.go +++ b/components/crm/internal/services/create-alias.go @@ -10,15 +10,16 @@ import ( "time" libCommons "github.com/LerianStudio/lib-commons/v5/commons" - libLog "github.com/LerianStudio/lib-commons/v5/commons/log" - libOpenTelemetry "github.com/LerianStudio/lib-commons/v5/commons/opentelemetry" + libObservability "github.com/LerianStudio/lib-observability" + libLog "github.com/LerianStudio/lib-observability/log" + libOpenTelemetry "github.com/LerianStudio/lib-observability/tracing" "github.com/LerianStudio/midaz/v3/pkg/mmodel" "github.com/google/uuid" "go.opentelemetry.io/otel/attribute" ) func (uc *UseCase) CreateAlias(ctx context.Context, organizationID string, holderID uuid.UUID, cai *mmodel.CreateAliasInput) (*mmodel.Alias, error) { - logger, tracer, reqId, _ := libCommons.NewTrackingFromContext(ctx) + logger, tracer, reqId, _ := libObservability.NewTrackingFromContext(ctx) ctx, span := tracer.Start(ctx, "service.create_alias") defer span.End() diff --git a/components/crm/internal/services/create-holder.go b/components/crm/internal/services/create-holder.go index cc286641f..3b75d3eb2 100644 --- a/components/crm/internal/services/create-holder.go +++ b/components/crm/internal/services/create-holder.go @@ -10,16 +10,17 @@ import ( "time" libCommons "github.com/LerianStudio/lib-commons/v5/commons" - libOpenTelemetry "github.com/LerianStudio/lib-commons/v5/commons/opentelemetry" + libObservability "github.com/LerianStudio/lib-observability" + libOpenTelemetry "github.com/LerianStudio/lib-observability/tracing" "github.com/LerianStudio/midaz/v3/pkg/mmodel" "go.opentelemetry.io/otel/attribute" // CreateHolder inserts a holder data in the repository - libLog "github.com/LerianStudio/lib-commons/v5/commons/log" + libLog "github.com/LerianStudio/lib-observability/log" ) func (uc *UseCase) CreateHolder(ctx context.Context, organizationID string, chi *mmodel.CreateHolderInput) (*mmodel.Holder, error) { - logger, tracer, reqId, _ := libCommons.NewTrackingFromContext(ctx) + logger, tracer, reqId, _ := libObservability.NewTrackingFromContext(ctx) ctx, span := tracer.Start(ctx, "service.create_holder") defer span.End() diff --git a/components/crm/internal/services/delete-alias.go b/components/crm/internal/services/delete-alias.go index 49c056bfc..2be3557d5 100644 --- a/components/crm/internal/services/delete-alias.go +++ b/components/crm/internal/services/delete-alias.go @@ -8,9 +8,9 @@ import ( "context" "fmt" - libCommons "github.com/LerianStudio/lib-commons/v5/commons" - libLog "github.com/LerianStudio/lib-commons/v5/commons/log" - libOpenTelemetry "github.com/LerianStudio/lib-commons/v5/commons/opentelemetry" + libCommons "github.com/LerianStudio/lib-observability" + libLog "github.com/LerianStudio/lib-observability/log" + libOpenTelemetry "github.com/LerianStudio/lib-observability/tracing" "github.com/google/uuid" "go.opentelemetry.io/otel/attribute" ) diff --git a/components/crm/internal/services/delete-holder.go b/components/crm/internal/services/delete-holder.go index 2d23c38f6..caf41d19e 100644 --- a/components/crm/internal/services/delete-holder.go +++ b/components/crm/internal/services/delete-holder.go @@ -9,8 +9,8 @@ import ( "fmt" "reflect" - libCommons "github.com/LerianStudio/lib-commons/v5/commons" - libOpenTelemetry "github.com/LerianStudio/lib-commons/v5/commons/opentelemetry" + libCommons "github.com/LerianStudio/lib-observability" + libOpenTelemetry "github.com/LerianStudio/lib-observability/tracing" "github.com/LerianStudio/midaz/v3/pkg" cn "github.com/LerianStudio/midaz/v3/pkg/constant" "github.com/LerianStudio/midaz/v3/pkg/mmodel" @@ -18,7 +18,7 @@ import ( "go.opentelemetry.io/otel/attribute" // DeleteHolderByID delete a holder by its ID - libLog "github.com/LerianStudio/lib-commons/v5/commons/log" + libLog "github.com/LerianStudio/lib-observability/log" ) func (uc *UseCase) DeleteHolderByID(ctx context.Context, organizationID string, id uuid.UUID, hardDelete bool) error { diff --git a/components/crm/internal/services/delete-related-party.go b/components/crm/internal/services/delete-related-party.go index a57666078..82081ec69 100644 --- a/components/crm/internal/services/delete-related-party.go +++ b/components/crm/internal/services/delete-related-party.go @@ -8,9 +8,9 @@ import ( "context" "fmt" - libCommons "github.com/LerianStudio/lib-commons/v5/commons" - libLog "github.com/LerianStudio/lib-commons/v5/commons/log" - libOpenTelemetry "github.com/LerianStudio/lib-commons/v5/commons/opentelemetry" + libCommons "github.com/LerianStudio/lib-observability" + libLog "github.com/LerianStudio/lib-observability/log" + libOpenTelemetry "github.com/LerianStudio/lib-observability/tracing" "github.com/google/uuid" "go.opentelemetry.io/otel/attribute" ) diff --git a/components/crm/internal/services/get-all-aliases.go b/components/crm/internal/services/get-all-aliases.go index 983571732..29da79b17 100644 --- a/components/crm/internal/services/get-all-aliases.go +++ b/components/crm/internal/services/get-all-aliases.go @@ -11,9 +11,9 @@ import ( "github.com/LerianStudio/midaz/v3/pkg/mmodel" "github.com/LerianStudio/midaz/v3/pkg/net/http" - libCommons "github.com/LerianStudio/lib-commons/v5/commons" - libLog "github.com/LerianStudio/lib-commons/v5/commons/log" - libOpenTelemetry "github.com/LerianStudio/lib-commons/v5/commons/opentelemetry" + libCommons "github.com/LerianStudio/lib-observability" + libLog "github.com/LerianStudio/lib-observability/log" + libOpenTelemetry "github.com/LerianStudio/lib-observability/tracing" "github.com/google/uuid" "go.opentelemetry.io/otel/attribute" ) diff --git a/components/crm/internal/services/get-all-holders.go b/components/crm/internal/services/get-all-holders.go index 66b66cc51..d9a9b36a9 100644 --- a/components/crm/internal/services/get-all-holders.go +++ b/components/crm/internal/services/get-all-holders.go @@ -7,9 +7,9 @@ package services import ( "context" - libCommons "github.com/LerianStudio/lib-commons/v5/commons" - libLog "github.com/LerianStudio/lib-commons/v5/commons/log" - libOpenTelemetry "github.com/LerianStudio/lib-commons/v5/commons/opentelemetry" + libCommons "github.com/LerianStudio/lib-observability" + libLog "github.com/LerianStudio/lib-observability/log" + libOpenTelemetry "github.com/LerianStudio/lib-observability/tracing" "github.com/LerianStudio/midaz/v3/pkg/mmodel" "github.com/LerianStudio/midaz/v3/pkg/net/http" "go.opentelemetry.io/otel/attribute" diff --git a/components/crm/internal/services/get-id-alias.go b/components/crm/internal/services/get-id-alias.go index 01ba8c472..614f3dff1 100644 --- a/components/crm/internal/services/get-id-alias.go +++ b/components/crm/internal/services/get-id-alias.go @@ -8,9 +8,9 @@ import ( "context" "fmt" - libCommons "github.com/LerianStudio/lib-commons/v5/commons" - libLog "github.com/LerianStudio/lib-commons/v5/commons/log" - libOpenTelemetry "github.com/LerianStudio/lib-commons/v5/commons/opentelemetry" + libCommons "github.com/LerianStudio/lib-observability" + libLog "github.com/LerianStudio/lib-observability/log" + libOpenTelemetry "github.com/LerianStudio/lib-observability/tracing" "github.com/LerianStudio/midaz/v3/pkg/mmodel" "github.com/google/uuid" "go.opentelemetry.io/otel/attribute" diff --git a/components/crm/internal/services/get-id-holder.go b/components/crm/internal/services/get-id-holder.go index 3faa58b49..7592c4e3c 100644 --- a/components/crm/internal/services/get-id-holder.go +++ b/components/crm/internal/services/get-id-holder.go @@ -8,9 +8,9 @@ import ( "context" "fmt" - libCommons "github.com/LerianStudio/lib-commons/v5/commons" - libLog "github.com/LerianStudio/lib-commons/v5/commons/log" - libOpenTelemetry "github.com/LerianStudio/lib-commons/v5/commons/opentelemetry" + libCommons "github.com/LerianStudio/lib-observability" + libLog "github.com/LerianStudio/lib-observability/log" + libOpenTelemetry "github.com/LerianStudio/lib-observability/tracing" "github.com/LerianStudio/midaz/v3/pkg/mmodel" "github.com/google/uuid" "go.opentelemetry.io/otel/attribute" diff --git a/components/crm/internal/services/update-alias.go b/components/crm/internal/services/update-alias.go index 78830f8eb..784841a75 100644 --- a/components/crm/internal/services/update-alias.go +++ b/components/crm/internal/services/update-alias.go @@ -10,15 +10,16 @@ import ( "time" libCommons "github.com/LerianStudio/lib-commons/v5/commons" - libLog "github.com/LerianStudio/lib-commons/v5/commons/log" - libOpenTelemetry "github.com/LerianStudio/lib-commons/v5/commons/opentelemetry" + libObservability "github.com/LerianStudio/lib-observability" + libLog "github.com/LerianStudio/lib-observability/log" + libOpenTelemetry "github.com/LerianStudio/lib-observability/tracing" "github.com/LerianStudio/midaz/v3/pkg/mmodel" "github.com/google/uuid" "go.opentelemetry.io/otel/attribute" ) func (uc *UseCase) UpdateAliasByID(ctx context.Context, organizationID string, holderID, id uuid.UUID, uai *mmodel.UpdateAliasInput, fieldsToRemove []string) (*mmodel.Alias, error) { - logger, tracer, reqId, _ := libCommons.NewTrackingFromContext(ctx) + logger, tracer, reqId, _ := libObservability.NewTrackingFromContext(ctx) ctx, span := tracer.Start(ctx, "service.update_alias") defer span.End() diff --git a/components/crm/internal/services/update-holder.go b/components/crm/internal/services/update-holder.go index 564bc649f..bc5cff307 100644 --- a/components/crm/internal/services/update-holder.go +++ b/components/crm/internal/services/update-holder.go @@ -9,9 +9,9 @@ import ( "fmt" "time" - libCommons "github.com/LerianStudio/lib-commons/v5/commons" - libLog "github.com/LerianStudio/lib-commons/v5/commons/log" - libOpenTelemetry "github.com/LerianStudio/lib-commons/v5/commons/opentelemetry" + libCommons "github.com/LerianStudio/lib-observability" + libLog "github.com/LerianStudio/lib-observability/log" + libOpenTelemetry "github.com/LerianStudio/lib-observability/tracing" "github.com/LerianStudio/midaz/v3/pkg/mmodel" "github.com/google/uuid" "go.opentelemetry.io/otel/attribute" diff --git a/components/crm/internal/services/validate-alias-closing-date.go b/components/crm/internal/services/validate-alias-closing-date.go index a68b37cd9..aeef4da3e 100644 --- a/components/crm/internal/services/validate-alias-closing-date.go +++ b/components/crm/internal/services/validate-alias-closing-date.go @@ -9,8 +9,8 @@ import ( "fmt" "reflect" - libCommons "github.com/LerianStudio/lib-commons/v5/commons" - libOpenTelemetry "github.com/LerianStudio/lib-commons/v5/commons/opentelemetry" + libCommons "github.com/LerianStudio/lib-observability" + libOpenTelemetry "github.com/LerianStudio/lib-observability/tracing" "github.com/LerianStudio/midaz/v3/pkg" "github.com/LerianStudio/midaz/v3/pkg/constant" "github.com/LerianStudio/midaz/v3/pkg/mmodel" @@ -18,7 +18,7 @@ import ( // validateAliasClosingDate validates the closing date of an alias // It checks if the closing date is before the creation date - libLog "github.com/LerianStudio/lib-commons/v5/commons/log" + libLog "github.com/LerianStudio/lib-observability/log" ) func (uc *UseCase) validateAliasClosingDate(ctx context.Context, organizationID string, holderID, aliasId uuid.UUID, closingDate *mmodel.Date) error { diff --git a/components/crm/internal/services/validate-related-party.go b/components/crm/internal/services/validate-related-party.go index 41bf21213..1310f583e 100644 --- a/components/crm/internal/services/validate-related-party.go +++ b/components/crm/internal/services/validate-related-party.go @@ -10,9 +10,9 @@ import ( "reflect" "strings" - libCommons "github.com/LerianStudio/lib-commons/v5/commons" - libLog "github.com/LerianStudio/lib-commons/v5/commons/log" - libOpenTelemetry "github.com/LerianStudio/lib-commons/v5/commons/opentelemetry" + libCommons "github.com/LerianStudio/lib-observability" + libLog "github.com/LerianStudio/lib-observability/log" + libOpenTelemetry "github.com/LerianStudio/lib-observability/tracing" "github.com/LerianStudio/midaz/v3/pkg" cn "github.com/LerianStudio/midaz/v3/pkg/constant" "github.com/LerianStudio/midaz/v3/pkg/mmodel" diff --git a/components/ledger/.env.example b/components/ledger/.env.example index 7bec03831..e88473ac4 100644 --- a/components/ledger/.env.example +++ b/components/ledger/.env.example @@ -155,7 +155,7 @@ OTEL_LIBRARY_NAME=github.com/LerianStudio/midaz/v3/components/ledger OTEL_RESOURCE_SERVICE_VERSION=${VERSION} OTEL_RESOURCE_DEPLOYMENT_ENVIRONMENT=${ENV_NAME} OTEL_EXPORTER_OTLP_ENDPOINT_PORT=4317 -OTEL_EXPORTER_OTLP_ENDPOINT=midaz-otel-lgtm:${OTEL_EXPORTER_OTLP_ENDPOINT_PORT} +OTEL_EXPORTER_OTLP_ENDPOINT=http://midaz-otel-lgtm:${OTEL_EXPORTER_OTLP_ENDPOINT_PORT} ENABLE_TELEMETRY=false # RABBITMQ (used by transaction module) diff --git a/components/ledger/cmd/app/main.go b/components/ledger/cmd/app/main.go index cf774bc39..00e8e254a 100644 --- a/components/ledger/cmd/app/main.go +++ b/components/ledger/cmd/app/main.go @@ -11,8 +11,8 @@ import ( "strings" libCommons "github.com/LerianStudio/lib-commons/v5/commons" - libLog "github.com/LerianStudio/lib-commons/v5/commons/log" - libZap "github.com/LerianStudio/lib-commons/v5/commons/zap" + libLog "github.com/LerianStudio/lib-observability/log" + libZap "github.com/LerianStudio/lib-observability/zap" "github.com/LerianStudio/midaz/v3/components/ledger/internal/bootstrap" ) diff --git a/components/ledger/internal/adapters/http/in/account.go b/components/ledger/internal/adapters/http/in/account.go index dcfd7a14c..bff84f172 100644 --- a/components/ledger/internal/adapters/http/in/account.go +++ b/components/ledger/internal/adapters/http/in/account.go @@ -8,8 +8,9 @@ import ( "fmt" libCommons "github.com/LerianStudio/lib-commons/v5/commons" - libLog "github.com/LerianStudio/lib-commons/v5/commons/log" - libOpentelemetry "github.com/LerianStudio/lib-commons/v5/commons/opentelemetry" + libObservability "github.com/LerianStudio/lib-observability" + libLog "github.com/LerianStudio/lib-observability/log" + libOpentelemetry "github.com/LerianStudio/lib-observability/tracing" "github.com/LerianStudio/midaz/v3/components/ledger/internal/services/command" "github.com/LerianStudio/midaz/v3/components/ledger/internal/services/query" "github.com/LerianStudio/midaz/v3/pkg" @@ -51,7 +52,7 @@ type AccountHandler struct { func (handler *AccountHandler) CreateAccount(i any, c *fiber.Ctx) error { ctx := c.UserContext() - logger, tracer, _, metricFactory := libCommons.NewTrackingFromContext(ctx) + logger, tracer, _, metricFactory := libObservability.NewTrackingFromContext(ctx) organizationID, err := http.GetUUIDFromLocals(c, "organization_id") if err != nil { @@ -134,7 +135,7 @@ func (handler *AccountHandler) CreateAccount(i any, c *fiber.Ctx) error { func (handler *AccountHandler) GetAllAccounts(c *fiber.Ctx) error { ctx := c.UserContext() - logger, tracer, _, _ := libCommons.NewTrackingFromContext(ctx) + logger, tracer, _, _ := libObservability.NewTrackingFromContext(ctx) ctx, span := tracer.Start(ctx, "handler.get_all_accounts") defer span.End() @@ -255,7 +256,7 @@ func (handler *AccountHandler) GetAllAccounts(c *fiber.Ctx) error { func (handler *AccountHandler) GetAccountByID(c *fiber.Ctx) error { ctx := c.UserContext() - logger, tracer, _, _ := libCommons.NewTrackingFromContext(ctx) + logger, tracer, _, _ := libObservability.NewTrackingFromContext(ctx) ctx, span := tracer.Start(ctx, "handler.get_account_by_id") defer span.End() @@ -311,7 +312,7 @@ func (handler *AccountHandler) GetAccountByID(c *fiber.Ctx) error { func (handler *AccountHandler) GetAccountExternalByCode(c *fiber.Ctx) error { ctx := c.UserContext() - logger, tracer, _, _ := libCommons.NewTrackingFromContext(ctx) + logger, tracer, _, _ := libObservability.NewTrackingFromContext(ctx) ctx, span := tracer.Start(ctx, "handler.get_account_external_by_code") defer span.End() @@ -366,7 +367,7 @@ func (handler *AccountHandler) GetAccountExternalByCode(c *fiber.Ctx) error { func (handler *AccountHandler) GetAccountByAlias(c *fiber.Ctx) error { ctx := c.UserContext() - logger, tracer, _, _ := libCommons.NewTrackingFromContext(ctx) + logger, tracer, _, _ := libObservability.NewTrackingFromContext(ctx) ctx, span := tracer.Start(ctx, "handler.get_account_by_alias") defer span.End() @@ -423,7 +424,7 @@ func (handler *AccountHandler) GetAccountByAlias(c *fiber.Ctx) error { func (handler *AccountHandler) UpdateAccount(i any, c *fiber.Ctx) error { ctx := c.UserContext() - logger, tracer, _, _ := libCommons.NewTrackingFromContext(ctx) + logger, tracer, _, _ := libObservability.NewTrackingFromContext(ctx) ctx, span := tracer.Start(ctx, "handler.update_account") defer span.End() @@ -492,7 +493,7 @@ func (handler *AccountHandler) UpdateAccount(i any, c *fiber.Ctx) error { func (handler *AccountHandler) DeleteAccountByID(c *fiber.Ctx) error { ctx := c.UserContext() - logger, tracer, _, _ := libCommons.NewTrackingFromContext(ctx) + logger, tracer, _, _ := libObservability.NewTrackingFromContext(ctx) ctx, span := tracer.Start(ctx, "handler.delete_account_by_id") defer span.End() @@ -547,7 +548,7 @@ func (handler *AccountHandler) DeleteAccountByID(c *fiber.Ctx) error { func (handler *AccountHandler) CountAccounts(c *fiber.Ctx) error { ctx := c.UserContext() - logger, tracer, _, _ := libCommons.NewTrackingFromContext(ctx) + logger, tracer, _, _ := libObservability.NewTrackingFromContext(ctx) ctx, span := tracer.Start(ctx, "handler.count_accounts") defer span.End() diff --git a/components/ledger/internal/adapters/http/in/accounttype.go b/components/ledger/internal/adapters/http/in/accounttype.go index 4c092a1d6..f636d3ba8 100644 --- a/components/ledger/internal/adapters/http/in/accounttype.go +++ b/components/ledger/internal/adapters/http/in/accounttype.go @@ -7,9 +7,9 @@ package in import ( "fmt" - libCommons "github.com/LerianStudio/lib-commons/v5/commons" - libLog "github.com/LerianStudio/lib-commons/v5/commons/log" - libOpentelemetry "github.com/LerianStudio/lib-commons/v5/commons/opentelemetry" + libCommons "github.com/LerianStudio/lib-observability" + libLog "github.com/LerianStudio/lib-observability/log" + libOpentelemetry "github.com/LerianStudio/lib-observability/tracing" "github.com/LerianStudio/midaz/v3/components/ledger/internal/services/command" "github.com/LerianStudio/midaz/v3/components/ledger/internal/services/query" "github.com/LerianStudio/midaz/v3/pkg/mmodel" diff --git a/components/ledger/internal/adapters/http/in/asset.go b/components/ledger/internal/adapters/http/in/asset.go index 49e6f28ee..905123556 100644 --- a/components/ledger/internal/adapters/http/in/asset.go +++ b/components/ledger/internal/adapters/http/in/asset.go @@ -7,9 +7,9 @@ package in import ( "fmt" - libCommons "github.com/LerianStudio/lib-commons/v5/commons" - libLog "github.com/LerianStudio/lib-commons/v5/commons/log" - libOpentelemetry "github.com/LerianStudio/lib-commons/v5/commons/opentelemetry" + libCommons "github.com/LerianStudio/lib-observability" + libLog "github.com/LerianStudio/lib-observability/log" + libOpentelemetry "github.com/LerianStudio/lib-observability/tracing" "github.com/LerianStudio/midaz/v3/components/ledger/internal/services/command" "github.com/LerianStudio/midaz/v3/components/ledger/internal/services/query" "github.com/LerianStudio/midaz/v3/pkg/constant" diff --git a/components/ledger/internal/adapters/http/in/assetrate.go b/components/ledger/internal/adapters/http/in/assetrate.go index 1121e7b59..c9de17c43 100644 --- a/components/ledger/internal/adapters/http/in/assetrate.go +++ b/components/ledger/internal/adapters/http/in/assetrate.go @@ -7,8 +7,8 @@ package in import ( "fmt" - libCommons "github.com/LerianStudio/lib-commons/v5/commons" - libOpentelemetry "github.com/LerianStudio/lib-commons/v5/commons/opentelemetry" + libCommons "github.com/LerianStudio/lib-observability" + libOpentelemetry "github.com/LerianStudio/lib-observability/tracing" "github.com/LerianStudio/midaz/v3/components/ledger/internal/adapters/postgres/assetrate" "github.com/LerianStudio/midaz/v3/components/ledger/internal/services/command" "github.com/LerianStudio/midaz/v3/components/ledger/internal/services/query" @@ -17,7 +17,7 @@ import ( "go.mongodb.org/mongo-driver/bson" // AssetRateHandler struct contains a cqrs use case for managing asset rate. - libLog "github.com/LerianStudio/lib-commons/v5/commons/log" + libLog "github.com/LerianStudio/lib-observability/log" ) type AssetRateHandler struct { diff --git a/components/ledger/internal/adapters/http/in/balance.go b/components/ledger/internal/adapters/http/in/balance.go index 286050edc..5eac5a876 100644 --- a/components/ledger/internal/adapters/http/in/balance.go +++ b/components/ledger/internal/adapters/http/in/balance.go @@ -8,7 +8,8 @@ import ( "fmt" libCommons "github.com/LerianStudio/lib-commons/v5/commons" - libOpentelemetry "github.com/LerianStudio/lib-commons/v5/commons/opentelemetry" + libObservability "github.com/LerianStudio/lib-observability" + libOpentelemetry "github.com/LerianStudio/lib-observability/tracing" "github.com/LerianStudio/midaz/v3/components/ledger/internal/services/command" "github.com/LerianStudio/midaz/v3/components/ledger/internal/services/query" "github.com/LerianStudio/midaz/v3/pkg" @@ -19,7 +20,7 @@ import ( "go.mongodb.org/mongo-driver/bson" // BalanceHandler struct contains a cqrs use case for managing balances. - libLog "github.com/LerianStudio/lib-commons/v5/commons/log" + libLog "github.com/LerianStudio/lib-observability/log" ) type BalanceHandler struct { @@ -51,7 +52,7 @@ type BalanceHandler struct { func (handler *BalanceHandler) GetAllBalances(c *fiber.Ctx) error { ctx := c.UserContext() - logger, tracer, _, _ := libCommons.NewTrackingFromContext(ctx) + logger, tracer, _, _ := libObservability.NewTrackingFromContext(ctx) ctx, span := tracer.Start(ctx, "handler.get_all_balances") defer span.End() @@ -131,7 +132,7 @@ func (handler *BalanceHandler) GetAllBalances(c *fiber.Ctx) error { func (handler *BalanceHandler) GetAllBalancesByAccountID(c *fiber.Ctx) error { ctx := c.UserContext() - logger, tracer, _, _ := libCommons.NewTrackingFromContext(ctx) + logger, tracer, _, _ := libObservability.NewTrackingFromContext(ctx) ctx, span := tracer.Start(ctx, "handler.get_all_balances_by_account_id") defer span.End() @@ -210,7 +211,7 @@ func (handler *BalanceHandler) GetAllBalancesByAccountID(c *fiber.Ctx) error { func (handler *BalanceHandler) GetBalanceByID(c *fiber.Ctx) error { ctx := c.UserContext() - logger, tracer, _, _ := libCommons.NewTrackingFromContext(ctx) + logger, tracer, _, _ := libObservability.NewTrackingFromContext(ctx) ctx, span := tracer.Start(ctx, "handler.get_balance_by_id") defer span.End() @@ -267,7 +268,7 @@ func (handler *BalanceHandler) GetBalanceByID(c *fiber.Ctx) error { func (handler *BalanceHandler) DeleteBalanceByID(c *fiber.Ctx) error { ctx := c.UserContext() - logger, tracer, _, _ := libCommons.NewTrackingFromContext(ctx) + logger, tracer, _, _ := libObservability.NewTrackingFromContext(ctx) ctx, span := tracer.Start(ctx, "handler.delete_balance_by_id") defer span.End() @@ -326,7 +327,7 @@ func (handler *BalanceHandler) DeleteBalanceByID(c *fiber.Ctx) error { func (handler *BalanceHandler) UpdateBalance(p any, c *fiber.Ctx) error { ctx := c.UserContext() - logger, tracer, _, _ := libCommons.NewTrackingFromContext(ctx) + logger, tracer, _, _ := libObservability.NewTrackingFromContext(ctx) ctx, span := tracer.Start(ctx, "handler.update_balance") defer span.End() @@ -387,7 +388,7 @@ func (handler *BalanceHandler) UpdateBalance(p any, c *fiber.Ctx) error { func (handler *BalanceHandler) GetBalancesByAlias(c *fiber.Ctx) error { ctx := c.UserContext() - logger, tracer, _, _ := libCommons.NewTrackingFromContext(ctx) + logger, tracer, _, _ := libObservability.NewTrackingFromContext(ctx) ctx, span := tracer.Start(ctx, "handler.get_balances_by_alias") defer span.End() @@ -447,7 +448,7 @@ func (handler *BalanceHandler) GetBalancesByAlias(c *fiber.Ctx) error { func (handler *BalanceHandler) GetBalancesExternalByCode(c *fiber.Ctx) error { ctx := c.UserContext() - logger, tracer, _, _ := libCommons.NewTrackingFromContext(ctx) + logger, tracer, _, _ := libObservability.NewTrackingFromContext(ctx) ctx, span := tracer.Start(ctx, "handler.get_balances_external_by_code") defer span.End() @@ -511,7 +512,7 @@ func (handler *BalanceHandler) GetBalancesExternalByCode(c *fiber.Ctx) error { func (handler *BalanceHandler) CreateAdditionalBalance(p any, c *fiber.Ctx) error { ctx := c.UserContext() - logger, tracer, _, _ := libCommons.NewTrackingFromContext(ctx) + logger, tracer, _, _ := libObservability.NewTrackingFromContext(ctx) organizationID, err := http.GetUUIDFromLocals(c, "organization_id") if err != nil { @@ -572,7 +573,7 @@ func (handler *BalanceHandler) CreateAdditionalBalance(p any, c *fiber.Ctx) erro func (handler *BalanceHandler) GetBalanceAtTimestamp(c *fiber.Ctx) error { ctx := c.UserContext() - logger, tracer, _, _ := libCommons.NewTrackingFromContext(ctx) + logger, tracer, _, _ := libObservability.NewTrackingFromContext(ctx) ctx, span := tracer.Start(ctx, "handler.get_balance_at_timestamp") defer span.End() @@ -667,7 +668,7 @@ func (handler *BalanceHandler) GetBalanceAtTimestamp(c *fiber.Ctx) error { func (handler *BalanceHandler) GetAccountBalancesAtTimestamp(c *fiber.Ctx) error { ctx := c.UserContext() - logger, tracer, _, _ := libCommons.NewTrackingFromContext(ctx) + logger, tracer, _, _ := libObservability.NewTrackingFromContext(ctx) ctx, span := tracer.Start(ctx, "handler.get_account_balances_at_timestamp") defer span.End() diff --git a/components/ledger/internal/adapters/http/in/count_transactions_by_filters.go b/components/ledger/internal/adapters/http/in/count_transactions_by_filters.go index 4eee39c98..44e84d514 100644 --- a/components/ledger/internal/adapters/http/in/count_transactions_by_filters.go +++ b/components/ledger/internal/adapters/http/in/count_transactions_by_filters.go @@ -9,9 +9,9 @@ import ( "strings" "time" - libCommons "github.com/LerianStudio/lib-commons/v5/commons" - libLog "github.com/LerianStudio/lib-commons/v5/commons/log" - libOpentelemetry "github.com/LerianStudio/lib-commons/v5/commons/opentelemetry" + libCommons "github.com/LerianStudio/lib-observability" + libLog "github.com/LerianStudio/lib-observability/log" + libOpentelemetry "github.com/LerianStudio/lib-observability/tracing" "github.com/LerianStudio/midaz/v3/components/ledger/internal/adapters/postgres/transaction" "github.com/LerianStudio/midaz/v3/pkg" "github.com/LerianStudio/midaz/v3/pkg/constant" diff --git a/components/ledger/internal/adapters/http/in/errors.go b/components/ledger/internal/adapters/http/in/errors.go index 4c575a3c4..d6252d723 100644 --- a/components/ledger/internal/adapters/http/in/errors.go +++ b/components/ledger/internal/adapters/http/in/errors.go @@ -9,9 +9,9 @@ import ( "errors" stdhttp "net/http" - libCommons "github.com/LerianStudio/lib-commons/v5/commons" - libLog "github.com/LerianStudio/lib-commons/v5/commons/log" - libOpentelemetry "github.com/LerianStudio/lib-commons/v5/commons/opentelemetry" + libCommons "github.com/LerianStudio/lib-observability" + libLog "github.com/LerianStudio/lib-observability/log" + libOpentelemetry "github.com/LerianStudio/lib-observability/tracing" "github.com/gofiber/fiber/v2" "go.opentelemetry.io/otel/trace" ) diff --git a/components/ledger/internal/adapters/http/in/ledger.go b/components/ledger/internal/adapters/http/in/ledger.go index 0f9c82776..aa3b71a29 100644 --- a/components/ledger/internal/adapters/http/in/ledger.go +++ b/components/ledger/internal/adapters/http/in/ledger.go @@ -8,9 +8,9 @@ import ( "fmt" "os" - libCommons "github.com/LerianStudio/lib-commons/v5/commons" - libLog "github.com/LerianStudio/lib-commons/v5/commons/log" - libOpentelemetry "github.com/LerianStudio/lib-commons/v5/commons/opentelemetry" + libCommons "github.com/LerianStudio/lib-observability" + libLog "github.com/LerianStudio/lib-observability/log" + libOpentelemetry "github.com/LerianStudio/lib-observability/tracing" "github.com/LerianStudio/midaz/v3/components/ledger/internal/services/command" "github.com/LerianStudio/midaz/v3/components/ledger/internal/services/query" "github.com/LerianStudio/midaz/v3/pkg" diff --git a/components/ledger/internal/adapters/http/in/metadata.go b/components/ledger/internal/adapters/http/in/metadata.go index da85165f1..ddb7a490d 100644 --- a/components/ledger/internal/adapters/http/in/metadata.go +++ b/components/ledger/internal/adapters/http/in/metadata.go @@ -10,9 +10,9 @@ import ( "fmt" "reflect" - libCommons "github.com/LerianStudio/lib-commons/v5/commons" - libLog "github.com/LerianStudio/lib-commons/v5/commons/log" - libOpentelemetry "github.com/LerianStudio/lib-commons/v5/commons/opentelemetry" + libCommons "github.com/LerianStudio/lib-observability" + libLog "github.com/LerianStudio/lib-observability/log" + libOpentelemetry "github.com/LerianStudio/lib-observability/tracing" tmcore "github.com/LerianStudio/lib-commons/v5/commons/tenant-manager/core" tmmongo "github.com/LerianStudio/lib-commons/v5/commons/tenant-manager/mongo" "github.com/LerianStudio/midaz/v3/pkg" diff --git a/components/ledger/internal/adapters/http/in/observability.go b/components/ledger/internal/adapters/http/in/observability.go index 551e10c3a..aac5fa835 100644 --- a/components/ledger/internal/adapters/http/in/observability.go +++ b/components/ledger/internal/adapters/http/in/observability.go @@ -9,7 +9,7 @@ import ( "reflect" "strings" - libLog "github.com/LerianStudio/lib-commons/v5/commons/log" + libLog "github.com/LerianStudio/lib-observability/log" midazhttp "github.com/LerianStudio/midaz/v3/pkg/net/http" "go.opentelemetry.io/otel/attribute" "go.opentelemetry.io/otel/trace" diff --git a/components/ledger/internal/adapters/http/in/operation.go b/components/ledger/internal/adapters/http/in/operation.go index c9ab5de57..fd4d43768 100644 --- a/components/ledger/internal/adapters/http/in/operation.go +++ b/components/ledger/internal/adapters/http/in/operation.go @@ -7,8 +7,8 @@ package in import ( "fmt" - libCommons "github.com/LerianStudio/lib-commons/v5/commons" - libOpentelemetry "github.com/LerianStudio/lib-commons/v5/commons/opentelemetry" + libCommons "github.com/LerianStudio/lib-observability" + libOpentelemetry "github.com/LerianStudio/lib-observability/tracing" "github.com/LerianStudio/midaz/v3/components/ledger/internal/adapters/postgres/operation" "github.com/LerianStudio/midaz/v3/components/ledger/internal/services/command" "github.com/LerianStudio/midaz/v3/components/ledger/internal/services/query" @@ -17,7 +17,7 @@ import ( "go.mongodb.org/mongo-driver/bson" // OperationHandler struct contains a cqrs use case for managing operations. - libLog "github.com/LerianStudio/lib-commons/v5/commons/log" + libLog "github.com/LerianStudio/lib-observability/log" ) type OperationHandler struct { diff --git a/components/ledger/internal/adapters/http/in/operation_route.go b/components/ledger/internal/adapters/http/in/operation_route.go index d5f2ae47f..46ae7f095 100644 --- a/components/ledger/internal/adapters/http/in/operation_route.go +++ b/components/ledger/internal/adapters/http/in/operation_route.go @@ -10,9 +10,9 @@ import ( "fmt" "strings" - libCommons "github.com/LerianStudio/lib-commons/v5/commons" - libLog "github.com/LerianStudio/lib-commons/v5/commons/log" - libOpentelemetry "github.com/LerianStudio/lib-commons/v5/commons/opentelemetry" + libCommons "github.com/LerianStudio/lib-observability" + libLog "github.com/LerianStudio/lib-observability/log" + libOpentelemetry "github.com/LerianStudio/lib-observability/tracing" "github.com/LerianStudio/midaz/v3/components/ledger/internal/services/command" "github.com/LerianStudio/midaz/v3/components/ledger/internal/services/query" "github.com/LerianStudio/midaz/v3/pkg" diff --git a/components/ledger/internal/adapters/http/in/organization.go b/components/ledger/internal/adapters/http/in/organization.go index f623ffac1..7f0235803 100644 --- a/components/ledger/internal/adapters/http/in/organization.go +++ b/components/ledger/internal/adapters/http/in/organization.go @@ -8,9 +8,9 @@ import ( "fmt" "os" - libCommons "github.com/LerianStudio/lib-commons/v5/commons" - libLog "github.com/LerianStudio/lib-commons/v5/commons/log" - libOpentelemetry "github.com/LerianStudio/lib-commons/v5/commons/opentelemetry" + libCommons "github.com/LerianStudio/lib-observability" + libLog "github.com/LerianStudio/lib-observability/log" + libOpentelemetry "github.com/LerianStudio/lib-observability/tracing" "github.com/LerianStudio/midaz/v3/components/ledger/internal/services/command" "github.com/LerianStudio/midaz/v3/components/ledger/internal/services/query" "github.com/LerianStudio/midaz/v3/pkg" diff --git a/components/ledger/internal/adapters/http/in/portfolio.go b/components/ledger/internal/adapters/http/in/portfolio.go index ad0ad2511..c4278ec6f 100644 --- a/components/ledger/internal/adapters/http/in/portfolio.go +++ b/components/ledger/internal/adapters/http/in/portfolio.go @@ -7,9 +7,9 @@ package in import ( "fmt" - libCommons "github.com/LerianStudio/lib-commons/v5/commons" - libLog "github.com/LerianStudio/lib-commons/v5/commons/log" - libOpentelemetry "github.com/LerianStudio/lib-commons/v5/commons/opentelemetry" + libCommons "github.com/LerianStudio/lib-observability" + libLog "github.com/LerianStudio/lib-observability/log" + libOpentelemetry "github.com/LerianStudio/lib-observability/tracing" "github.com/LerianStudio/midaz/v3/components/ledger/internal/services/command" "github.com/LerianStudio/midaz/v3/components/ledger/internal/services/query" "github.com/LerianStudio/midaz/v3/pkg/constant" diff --git a/components/ledger/internal/adapters/http/in/routes.go b/components/ledger/internal/adapters/http/in/routes.go index 603a598ee..c269ec7fb 100644 --- a/components/ledger/internal/adapters/http/in/routes.go +++ b/components/ledger/internal/adapters/http/in/routes.go @@ -6,9 +6,10 @@ package in import ( "github.com/LerianStudio/lib-auth/v2/auth/middleware" - libLog "github.com/LerianStudio/lib-commons/v5/commons/log" + libLog "github.com/LerianStudio/lib-observability/log" libHTTP "github.com/LerianStudio/lib-commons/v5/commons/net/http" - libOpentelemetry "github.com/LerianStudio/lib-commons/v5/commons/opentelemetry" + libObsMiddleware "github.com/LerianStudio/lib-observability/middleware" + libOpentelemetry "github.com/LerianStudio/lib-observability/tracing" _ "github.com/LerianStudio/midaz/v3/components/ledger/api" "github.com/LerianStudio/midaz/v3/components/ledger/internal/adapters/postgres/assetrate" "github.com/LerianStudio/midaz/v3/components/ledger/internal/adapters/postgres/operation" @@ -38,11 +39,11 @@ func NewRouter(lg libLog.Logger, tl *libOpentelemetry.Telemetry, auth *middlewar }, }) - tlMid := libHTTP.NewTelemetryMiddleware(tl) + tlMid := libObsMiddleware.NewTelemetryMiddleware(tl) f.Use(tlMid.WithTelemetry(tl)) f.Use(cors.New()) - f.Use(libHTTP.WithHTTPLogging(libHTTP.WithCustomLogger(lg))) + f.Use(libObsMiddleware.WithHTTPLogging(libObsMiddleware.WithCustomLogger(lg))) // Register metadata index routes RegisterMetadataRoutesToApp(f, auth, mdi, nil) diff --git a/components/ledger/internal/adapters/http/in/routes_test.go b/components/ledger/internal/adapters/http/in/routes_test.go index d8df425df..b03787c17 100644 --- a/components/ledger/internal/adapters/http/in/routes_test.go +++ b/components/ledger/internal/adapters/http/in/routes_test.go @@ -9,8 +9,8 @@ import ( "testing" "github.com/LerianStudio/lib-auth/v2/auth/middleware" - libLog "github.com/LerianStudio/lib-commons/v5/commons/log" - libOpentelemetry "github.com/LerianStudio/lib-commons/v5/commons/opentelemetry" + libLog "github.com/LerianStudio/lib-observability/log" + libOpentelemetry "github.com/LerianStudio/lib-observability/tracing" pkgHTTP "github.com/LerianStudio/midaz/v3/pkg/net/http" "github.com/gofiber/fiber/v2" "github.com/stretchr/testify/assert" diff --git a/components/ledger/internal/adapters/http/in/segment.go b/components/ledger/internal/adapters/http/in/segment.go index 29bc07900..0d6f8d52f 100644 --- a/components/ledger/internal/adapters/http/in/segment.go +++ b/components/ledger/internal/adapters/http/in/segment.go @@ -7,9 +7,9 @@ package in import ( "fmt" - libCommons "github.com/LerianStudio/lib-commons/v5/commons" - libLog "github.com/LerianStudio/lib-commons/v5/commons/log" - libOpentelemetry "github.com/LerianStudio/lib-commons/v5/commons/opentelemetry" + libCommons "github.com/LerianStudio/lib-observability" + libLog "github.com/LerianStudio/lib-observability/log" + libOpentelemetry "github.com/LerianStudio/lib-observability/tracing" "github.com/LerianStudio/midaz/v3/components/ledger/internal/services/command" "github.com/LerianStudio/midaz/v3/components/ledger/internal/services/query" "github.com/LerianStudio/midaz/v3/pkg/constant" diff --git a/components/ledger/internal/adapters/http/in/transaction.go b/components/ledger/internal/adapters/http/in/transaction.go index c0b0a512b..41ca3d479 100644 --- a/components/ledger/internal/adapters/http/in/transaction.go +++ b/components/ledger/internal/adapters/http/in/transaction.go @@ -5,9 +5,9 @@ package in import ( - libCommons "github.com/LerianStudio/lib-commons/v5/commons" - libLog "github.com/LerianStudio/lib-commons/v5/commons/log" - libOpentelemetry "github.com/LerianStudio/lib-commons/v5/commons/opentelemetry" + libCommons "github.com/LerianStudio/lib-observability" + libLog "github.com/LerianStudio/lib-observability/log" + libOpentelemetry "github.com/LerianStudio/lib-observability/tracing" "github.com/gofiber/fiber/v2" "go.mongodb.org/mongo-driver/bson" diff --git a/components/ledger/internal/adapters/http/in/transaction_create.go b/components/ledger/internal/adapters/http/in/transaction_create.go index 3c233f3a6..5c10d6b38 100644 --- a/components/ledger/internal/adapters/http/in/transaction_create.go +++ b/components/ledger/internal/adapters/http/in/transaction_create.go @@ -13,9 +13,10 @@ import ( "github.com/shopspring/decimal" libCommons "github.com/LerianStudio/lib-commons/v5/commons" + libObservability "github.com/LerianStudio/lib-observability" libConstants "github.com/LerianStudio/lib-commons/v5/commons/constants" - libLog "github.com/LerianStudio/lib-commons/v5/commons/log" - libOpentelemetry "github.com/LerianStudio/lib-commons/v5/commons/opentelemetry" + libLog "github.com/LerianStudio/lib-observability/log" + libOpentelemetry "github.com/LerianStudio/lib-observability/tracing" tmcore "github.com/LerianStudio/lib-commons/v5/commons/tenant-manager/core" "github.com/LerianStudio/midaz/v3/components/ledger/internal/adapters/postgres/operation" "github.com/LerianStudio/midaz/v3/components/ledger/internal/adapters/postgres/transaction" @@ -30,7 +31,7 @@ import ( "github.com/LerianStudio/midaz/v3/pkg/mmodel" ) -//nolint:gocognit // Will be refactored into smaller functions. +//nolint:gocognit,gocyclo // Will be refactored into smaller functions. func (handler *TransactionHandler) BuildOperations( ctx context.Context, balances []*mmodel.Balance, @@ -49,7 +50,7 @@ func (handler *TransactionHandler) BuildOperations( var preBalances []*mmodel.Balance - logger, tracer, _, metricFactory := libCommons.NewTrackingFromContext(ctx) + logger, tracer, _, metricFactory := libObservability.NewTrackingFromContext(ctx) _, span := tracer.Start(ctx, "handler.create_transaction_operations") defer span.End() @@ -560,7 +561,7 @@ func (handler *TransactionHandler) buildDoubleEntryPendingOps( transactionDate time.Time, isAnnotation bool, ) ([]*operation.Operation, error) { - logger, tracer, _, _ := libCommons.NewTrackingFromContext(ctx) + logger, tracer, _, _ := libObservability.NewTrackingFromContext(ctx) _, span := tracer.Start(ctx, "handler.build_double_entry_pending_ops") defer span.End() @@ -631,7 +632,7 @@ func (handler *TransactionHandler) buildDoubleEntryPendingOps( LedgerID: blc.LedgerID, CreatedAt: transactionDate, UpdatedAt: time.Now(), - Route: ft.Route, + Route: ft.Route, //nolint:staticcheck // legacy field kept for backward compatibility; RouteID is canonical RouteID: ft.RouteID, Metadata: ft.Metadata, BalanceAffected: !isAnnotation, @@ -681,7 +682,7 @@ func (handler *TransactionHandler) buildDoubleEntryPendingOps( LedgerID: blc.LedgerID, CreatedAt: transactionDate, UpdatedAt: time.Now(), - Route: ft.Route, + Route: ft.Route, //nolint:staticcheck // legacy field kept for backward compatibility; RouteID is canonical RouteID: ft.RouteID, Metadata: ft.Metadata, BalanceAffected: !isAnnotation, @@ -707,7 +708,7 @@ func (handler *TransactionHandler) buildDoubleEntryCanceledOps( transactionDate time.Time, isAnnotation bool, ) ([]*operation.Operation, error) { - logger, tracer, _, _ := libCommons.NewTrackingFromContext(ctx) + logger, tracer, _, _ := libObservability.NewTrackingFromContext(ctx) _, span := tracer.Start(ctx, "handler.build_double_entry_canceled_ops") defer span.End() @@ -764,7 +765,7 @@ func (handler *TransactionHandler) buildDoubleEntryCanceledOps( LedgerID: blc.LedgerID, CreatedAt: transactionDate, UpdatedAt: time.Now(), - Route: ft.Route, + Route: ft.Route, //nolint:staticcheck // legacy field kept for backward compatibility; RouteID is canonical RouteID: ft.RouteID, Metadata: ft.Metadata, BalanceAffected: !isAnnotation, @@ -816,7 +817,7 @@ func (handler *TransactionHandler) buildDoubleEntryCanceledOps( LedgerID: blc.LedgerID, CreatedAt: transactionDate, UpdatedAt: time.Now(), - Route: ft.Route, + Route: ft.Route, //nolint:staticcheck // legacy field kept for backward compatibility; RouteID is canonical RouteID: ft.RouteID, Metadata: ft.Metadata, BalanceAffected: !isAnnotation, @@ -944,7 +945,7 @@ func (handler *TransactionHandler) buildStandardOp( LedgerID: blc.LedgerID, CreatedAt: transactionDate, UpdatedAt: time.Now(), - Route: ft.Route, + Route: ft.Route, //nolint:staticcheck // legacy field kept for backward compatibility; RouteID is canonical RouteID: ft.RouteID, Metadata: ft.Metadata, BalanceAffected: !isAnnotation, @@ -964,9 +965,10 @@ func (handler *TransactionHandler) createRevertTransaction(c *fiber.Ctx, transac return handler.executeCreateTransaction(c, transactionInput, transactionStatus, true) } +//nolint:gocyclo // Orchestration step with conditional branches per transaction type; refactor candidate. func (handler *TransactionHandler) executeCreateTransaction(c *fiber.Ctx, transactionInput mtransaction.Transaction, transactionStatus string, isRevert bool) error { ctx := c.UserContext() - logger, tracer, _, _ := libCommons.NewTrackingFromContext(ctx) + logger, tracer, _, _ := libObservability.NewTrackingFromContext(ctx) _, span := tracer.Start(ctx, "handler.create_transaction.orchestrate") defer span.End() @@ -1196,7 +1198,7 @@ func (handler *TransactionHandler) executeCreateTransaction(c *fiber.Ctx, transa ChartOfAccountsGroupName: transactionInput.ChartOfAccountsGroupName, CreatedAt: transactionDate, UpdatedAt: time.Now(), - Route: transactionInput.Route, + Route: transactionInput.Route, //nolint:staticcheck // legacy field kept for backward compatibility; RouteID is canonical RouteID: transactionInput.RouteID, Metadata: transactionInput.Metadata, Status: transaction.Status{ diff --git a/components/ledger/internal/adapters/http/in/transaction_helper.go b/components/ledger/internal/adapters/http/in/transaction_helper.go index 7f39c8859..f889a5920 100644 --- a/components/ledger/internal/adapters/http/in/transaction_helper.go +++ b/components/ledger/internal/adapters/http/in/transaction_helper.go @@ -9,8 +9,8 @@ import ( "sort" "strings" - libCommons "github.com/LerianStudio/lib-commons/v5/commons" - libLog "github.com/LerianStudio/lib-commons/v5/commons/log" + libCommons "github.com/LerianStudio/lib-observability" + libLog "github.com/LerianStudio/lib-observability/log" "github.com/gofiber/fiber/v2" "github.com/google/uuid" @@ -126,7 +126,7 @@ type balanceRef struct { // (e.g. "0#@sender#default", "1#@sender#default" for same account appearing twice). // SplitAliasWithKey strips the index prefix, returning "alias#balanceKey" for balance lookup. func buildBalanceOperations(ctx context.Context, organizationID, ledgerID uuid.UUID, validate *mtransaction.Responses, balances []*mmodel.Balance) []mmodel.BalanceOperation { - logger, _, _, _ := libCommons.NewTrackingFromContext(ctx) + logger := libCommons.NewLoggerFromContext(ctx) // Index balances by aliasKey for O(1) lookup instead of O(balances * entries). balanceByAliasKey := make(map[string]balanceRef, len(balances)) diff --git a/components/ledger/internal/adapters/http/in/transaction_integration_test.go b/components/ledger/internal/adapters/http/in/transaction_integration_test.go index 42ae42e1d..6e7908f96 100644 --- a/components/ledger/internal/adapters/http/in/transaction_integration_test.go +++ b/components/ledger/internal/adapters/http/in/transaction_integration_test.go @@ -25,8 +25,9 @@ import ( "time" libCommons "github.com/LerianStudio/lib-commons/v5/commons" - libLog "github.com/LerianStudio/lib-commons/v5/commons/log" - libOpentelemetry "github.com/LerianStudio/lib-commons/v5/commons/opentelemetry" + libObservability "github.com/LerianStudio/lib-observability" + libLog "github.com/LerianStudio/lib-observability/log" + libOpentelemetry "github.com/LerianStudio/lib-observability/tracing" libPostgres "github.com/LerianStudio/lib-commons/v5/commons/postgres" libRabbitmq "github.com/LerianStudio/lib-commons/v5/commons/rabbitmq" mongodb "github.com/LerianStudio/midaz/v3/components/ledger/internal/adapters/mongodb/transaction" @@ -501,7 +502,7 @@ func (mq *testMultiQueueConsumer) run() error { // handlerBTOQueue processes messages from the balance transaction operation queue. // This mirrors the logic in bootstrap.MultiQueueConsumer.handlerBTOQueue. func (mq *testMultiQueueConsumer) handlerBTOQueue(ctx context.Context, body []byte) error { - logger, tracer, _, _ := libCommons.NewTrackingFromContext(ctx) + logger, tracer, _, _ := libObservability.NewTrackingFromContext(ctx) ctx, span := tracer.Start(ctx, "consumer.handler_balance_update") defer span.End() diff --git a/components/ledger/internal/adapters/http/in/transaction_overdraft_enrichment.go b/components/ledger/internal/adapters/http/in/transaction_overdraft_enrichment.go index f7caa44e5..e450ff34e 100644 --- a/components/ledger/internal/adapters/http/in/transaction_overdraft_enrichment.go +++ b/components/ledger/internal/adapters/http/in/transaction_overdraft_enrichment.go @@ -9,9 +9,9 @@ import ( "fmt" "strings" - libCommons "github.com/LerianStudio/lib-commons/v5/commons" + libCommons "github.com/LerianStudio/lib-observability" libConstants "github.com/LerianStudio/lib-commons/v5/commons/constants" - libLog "github.com/LerianStudio/lib-commons/v5/commons/log" + libLog "github.com/LerianStudio/lib-observability/log" "github.com/google/uuid" "github.com/shopspring/decimal" @@ -119,6 +119,8 @@ func rejectInternalScopeBalances(ctx context.Context, balances []*mmodel.Balance // (balances × fromTo) generates a persisted Operation for each companion. // Without this, the balance tables converge correctly but the audit trail // is missing the overdraft leg (TRD PRD §1 "Enriched Transaction Flow"). +// +//nolint:gocyclo // Multi-stage enrichment with branching by overdraft variant; refactor candidate. func enrichOverdraftOperations( ctx context.Context, organizationID, ledgerID uuid.UUID, @@ -691,7 +693,7 @@ func buildCompanionFromTo(primary mmodel.BalanceOperation, companionOp mmodel.Ba // the 0117 guard in validateAccountRules. if primaryRouteID != "" { routeID := primaryRouteID - ft.Route = routeID + ft.Route = routeID //nolint:staticcheck // legacy field kept for backward compatibility; RouteID is canonical ft.RouteID = &routeID } @@ -767,6 +769,7 @@ func accountAliasFromOperationAlias(alias string) string { return bare[:idx] } +//nolint:gocyclo // Aggregation with conditional skip rules per operation type; refactor candidate. func pendingOverdraftUsageByAlias(ops []*operation.Operation) map[string]decimal.Decimal { usage := make(map[string]decimal.Decimal) diff --git a/components/ledger/internal/adapters/http/in/transaction_query_handlers.go b/components/ledger/internal/adapters/http/in/transaction_query_handlers.go index adb67ac69..a966567f6 100644 --- a/components/ledger/internal/adapters/http/in/transaction_query_handlers.go +++ b/components/ledger/internal/adapters/http/in/transaction_query_handlers.go @@ -7,9 +7,9 @@ package in import ( "fmt" - libCommons "github.com/LerianStudio/lib-commons/v5/commons" - libLog "github.com/LerianStudio/lib-commons/v5/commons/log" - libOpentelemetry "github.com/LerianStudio/lib-commons/v5/commons/opentelemetry" + libCommons "github.com/LerianStudio/lib-observability" + libLog "github.com/LerianStudio/lib-observability/log" + libOpentelemetry "github.com/LerianStudio/lib-observability/tracing" "github.com/LerianStudio/midaz/v3/pkg/net/http" "github.com/gofiber/fiber/v2" "go.mongodb.org/mongo-driver/bson" diff --git a/components/ledger/internal/adapters/http/in/transaction_route.go b/components/ledger/internal/adapters/http/in/transaction_route.go index b4eb8387c..16f87ae80 100644 --- a/components/ledger/internal/adapters/http/in/transaction_route.go +++ b/components/ledger/internal/adapters/http/in/transaction_route.go @@ -5,9 +5,9 @@ package in import ( - libCommons "github.com/LerianStudio/lib-commons/v5/commons" - libLog "github.com/LerianStudio/lib-commons/v5/commons/log" - libOpentelemetry "github.com/LerianStudio/lib-commons/v5/commons/opentelemetry" + libCommons "github.com/LerianStudio/lib-observability" + libLog "github.com/LerianStudio/lib-observability/log" + libOpentelemetry "github.com/LerianStudio/lib-observability/tracing" "github.com/LerianStudio/midaz/v3/components/ledger/internal/services/command" "github.com/LerianStudio/midaz/v3/components/ledger/internal/services/query" "github.com/LerianStudio/midaz/v3/pkg/mmodel" diff --git a/components/ledger/internal/adapters/http/in/transaction_state_handlers.go b/components/ledger/internal/adapters/http/in/transaction_state_handlers.go index 523d4a1ca..faf0fdeae 100644 --- a/components/ledger/internal/adapters/http/in/transaction_state_handlers.go +++ b/components/ledger/internal/adapters/http/in/transaction_state_handlers.go @@ -11,9 +11,9 @@ import ( "strings" "time" - libCommons "github.com/LerianStudio/lib-commons/v5/commons" - libLog "github.com/LerianStudio/lib-commons/v5/commons/log" - libOpentelemetry "github.com/LerianStudio/lib-commons/v5/commons/opentelemetry" + libCommons "github.com/LerianStudio/lib-observability" + libLog "github.com/LerianStudio/lib-observability/log" + libOpentelemetry "github.com/LerianStudio/lib-observability/tracing" tmcore "github.com/LerianStudio/lib-commons/v5/commons/tenant-manager/core" "github.com/LerianStudio/midaz/v3/components/ledger/internal/adapters/postgres/transaction" "github.com/LerianStudio/midaz/v3/components/ledger/internal/services/command" @@ -362,6 +362,7 @@ func (handler *TransactionHandler) UpdateTransaction(p any, c *fiber.Ctx) error return http.OK(c, trans) } +//nolint:gocyclo // State machine with branches per status × action combination; refactor candidate. func (handler *TransactionHandler) commitOrCancelTransaction(c *fiber.Ctx, tran *transaction.Transaction, transactionStatus string) error { ctx := c.UserContext() logger, tracer, _, _ := libCommons.NewTrackingFromContext(ctx) diff --git a/components/ledger/internal/adapters/mongodb/onboarding/metadata.mongodb.go b/components/ledger/internal/adapters/mongodb/onboarding/metadata.mongodb.go index 338c080bf..2742333b7 100644 --- a/components/ledger/internal/adapters/mongodb/onboarding/metadata.mongodb.go +++ b/components/ledger/internal/adapters/mongodb/onboarding/metadata.mongodb.go @@ -12,10 +12,10 @@ import ( "strings" "time" - libCommons "github.com/LerianStudio/lib-commons/v5/commons" - libLog "github.com/LerianStudio/lib-commons/v5/commons/log" + libCommons "github.com/LerianStudio/lib-observability" + libLog "github.com/LerianStudio/lib-observability/log" libMongo "github.com/LerianStudio/lib-commons/v5/commons/mongo" - libOpentelemetry "github.com/LerianStudio/lib-commons/v5/commons/opentelemetry" + libOpentelemetry "github.com/LerianStudio/lib-observability/tracing" tmcore "github.com/LerianStudio/lib-commons/v5/commons/tenant-manager/core" "github.com/LerianStudio/midaz/v3/pkg" "github.com/LerianStudio/midaz/v3/pkg/constant" diff --git a/components/ledger/internal/adapters/mongodb/transaction/metadata.mongodb.go b/components/ledger/internal/adapters/mongodb/transaction/metadata.mongodb.go index 4c516f287..42c43968c 100644 --- a/components/ledger/internal/adapters/mongodb/transaction/metadata.mongodb.go +++ b/components/ledger/internal/adapters/mongodb/transaction/metadata.mongodb.go @@ -12,10 +12,10 @@ import ( "strings" "time" - libCommons "github.com/LerianStudio/lib-commons/v5/commons" - libLog "github.com/LerianStudio/lib-commons/v5/commons/log" + libCommons "github.com/LerianStudio/lib-observability" + libLog "github.com/LerianStudio/lib-observability/log" libMongo "github.com/LerianStudio/lib-commons/v5/commons/mongo" - libOpentelemetry "github.com/LerianStudio/lib-commons/v5/commons/opentelemetry" + libOpentelemetry "github.com/LerianStudio/lib-observability/tracing" tmcore "github.com/LerianStudio/lib-commons/v5/commons/tenant-manager/core" "github.com/LerianStudio/midaz/v3/pkg" "github.com/LerianStudio/midaz/v3/pkg/constant" diff --git a/components/ledger/internal/adapters/postgres/account/account.postgresql.go b/components/ledger/internal/adapters/postgres/account/account.postgresql.go index ddadf048a..1006cc2bb 100644 --- a/components/ledger/internal/adapters/postgres/account/account.postgresql.go +++ b/components/ledger/internal/adapters/postgres/account/account.postgresql.go @@ -14,8 +14,9 @@ import ( "time" libCommons "github.com/LerianStudio/lib-commons/v5/commons" - libLog "github.com/LerianStudio/lib-commons/v5/commons/log" - libOpentelemetry "github.com/LerianStudio/lib-commons/v5/commons/opentelemetry" + libObservability "github.com/LerianStudio/lib-observability" + libLog "github.com/LerianStudio/lib-observability/log" + libOpentelemetry "github.com/LerianStudio/lib-observability/tracing" libPointers "github.com/LerianStudio/lib-commons/v5/commons/pointers" libPostgres "github.com/LerianStudio/lib-commons/v5/commons/postgres" tmcore "github.com/LerianStudio/lib-commons/v5/commons/tenant-manager/core" @@ -118,7 +119,7 @@ func (r *AccountPostgreSQLRepository) getDB(ctx context.Context) (dbresolver.DB, // Create a new account entity into Postgresql and returns it. func (r *AccountPostgreSQLRepository) Create(ctx context.Context, acc *mmodel.Account) (*mmodel.Account, error) { - logger, tracer, _, _ := libCommons.NewTrackingFromContext(ctx) + logger, tracer, _, _ := libObservability.NewTrackingFromContext(ctx) ctx, span := tracer.Start(ctx, "postgres.create_account") defer span.End() @@ -232,8 +233,10 @@ func (r *AccountPostgreSQLRepository) Create(ctx context.Context, acc *mmodel.Ac } // FindAll retrieves an Account entities from the database (including soft-deleted ones) with pagination. +// +//nolint:gocyclo // Query builder with optional filters per parameter; refactor candidate. func (r *AccountPostgreSQLRepository) FindAll(ctx context.Context, organizationID, ledgerID uuid.UUID, portfolioID, segmentID *uuid.UUID, filter http.QueryHeader) ([]*mmodel.Account, error) { - logger, tracer, _, _ := libCommons.NewTrackingFromContext(ctx) + logger, tracer, _, _ := libObservability.NewTrackingFromContext(ctx) ctx, span := tracer.Start(ctx, "postgres.find_all_accounts") defer span.End() @@ -380,7 +383,7 @@ func (r *AccountPostgreSQLRepository) FindAll(ctx context.Context, organizationI // Find retrieves an Account entity from the database using the provided ID. func (r *AccountPostgreSQLRepository) Find(ctx context.Context, organizationID, ledgerID uuid.UUID, portfolioID *uuid.UUID, id uuid.UUID) (*mmodel.Account, error) { - logger, tracer, _, _ := libCommons.NewTrackingFromContext(ctx) + logger, tracer, _, _ := libObservability.NewTrackingFromContext(ctx) ctx, span := tracer.Start(ctx, "postgres.find_account") defer span.End() @@ -466,7 +469,7 @@ func (r *AccountPostgreSQLRepository) Find(ctx context.Context, organizationID, // FindWithDeleted retrieves an Account entity from the database using the provided ID (including soft-deleted ones). func (r *AccountPostgreSQLRepository) FindWithDeleted(ctx context.Context, organizationID, ledgerID uuid.UUID, portfolioID *uuid.UUID, id uuid.UUID) (*mmodel.Account, error) { - logger, tracer, _, _ := libCommons.NewTrackingFromContext(ctx) + logger, tracer, _, _ := libObservability.NewTrackingFromContext(ctx) ctx, span := tracer.Start(ctx, "postgres.find_with_deleted_account") defer span.End() @@ -551,7 +554,7 @@ func (r *AccountPostgreSQLRepository) FindWithDeleted(ctx context.Context, organ // FindAlias retrieves an Account entity from the database using the provided Alias. func (r *AccountPostgreSQLRepository) FindAlias(ctx context.Context, organizationID, ledgerID uuid.UUID, portfolioID *uuid.UUID, alias string) (*mmodel.Account, error) { - logger, tracer, _, _ := libCommons.NewTrackingFromContext(ctx) + logger, tracer, _, _ := libObservability.NewTrackingFromContext(ctx) ctx, span := tracer.Start(ctx, "postgres.find_alias") defer span.End() @@ -637,7 +640,7 @@ func (r *AccountPostgreSQLRepository) FindAlias(ctx context.Context, organizatio // FindByAlias find account from the database using Organization and Ledger id and Alias. Returns true and ErrAliasUnavailability error if the alias is already taken. func (r *AccountPostgreSQLRepository) FindByAlias(ctx context.Context, organizationID, ledgerID uuid.UUID, alias string) (bool, error) { - logger, tracer, _, _ := libCommons.NewTrackingFromContext(ctx) + logger, tracer, _, _ := libObservability.NewTrackingFromContext(ctx) ctx, span := tracer.Start(ctx, "postgres.find_account_by_alias") defer span.End() @@ -701,7 +704,7 @@ func (r *AccountPostgreSQLRepository) FindByAlias(ctx context.Context, organizat // ListByIDs retrieves Accounts entities from the database using the provided IDs. func (r *AccountPostgreSQLRepository) ListByIDs(ctx context.Context, organizationID, ledgerID uuid.UUID, portfolioID, segmentID *uuid.UUID, ids []uuid.UUID) ([]*mmodel.Account, error) { - logger, tracer, _, _ := libCommons.NewTrackingFromContext(ctx) + logger, tracer, _, _ := libObservability.NewTrackingFromContext(ctx) ctx, span := tracer.Start(ctx, "postgres.list_accounts_by_ids") defer span.End() @@ -801,7 +804,7 @@ func (r *AccountPostgreSQLRepository) ListByIDs(ctx context.Context, organizatio // ListByAlias retrieves Accounts entities from the database using the provided alias. func (r *AccountPostgreSQLRepository) ListByAlias(ctx context.Context, organizationID, ledgerID, portfolioID uuid.UUID, alias []string) ([]*mmodel.Account, error) { - logger, tracer, _, _ := libCommons.NewTrackingFromContext(ctx) + logger, tracer, _, _ := libObservability.NewTrackingFromContext(ctx) ctx, span := tracer.Start(ctx, "postgres.list_accounts_by_alias") defer span.End() @@ -918,7 +921,7 @@ func applyNullableFields(builder squirrel.UpdateBuilder, acc *mmodel.Account, re // Update an Account entity into Postgresql and returns the Account updated. func (r *AccountPostgreSQLRepository) Update(ctx context.Context, organizationID, ledgerID uuid.UUID, portfolioID *uuid.UUID, id uuid.UUID, acc *mmodel.Account) (*mmodel.Account, error) { - logger, tracer, _, _ := libCommons.NewTrackingFromContext(ctx) + logger, tracer, _, _ := libObservability.NewTrackingFromContext(ctx) ctx, span := tracer.Start(ctx, "postgres.update_account") defer span.End() @@ -1025,7 +1028,7 @@ func (r *AccountPostgreSQLRepository) Update(ctx context.Context, organizationID // Delete an Account entity from the database (soft delete) using the provided ID. func (r *AccountPostgreSQLRepository) Delete(ctx context.Context, organizationID, ledgerID uuid.UUID, portfolioID *uuid.UUID, id uuid.UUID) error { - logger, tracer, _, _ := libCommons.NewTrackingFromContext(ctx) + logger, tracer, _, _ := libObservability.NewTrackingFromContext(ctx) ctx, span := tracer.Start(ctx, "postgres.delete_account") defer span.End() @@ -1077,7 +1080,7 @@ func (r *AccountPostgreSQLRepository) Delete(ctx context.Context, organizationID // ListAccountsByIDs list Accounts entity from the database using the provided IDs. func (r *AccountPostgreSQLRepository) ListAccountsByIDs(ctx context.Context, organizationID, ledgerID uuid.UUID, ids []uuid.UUID) ([]*mmodel.Account, error) { - logger, tracer, _, _ := libCommons.NewTrackingFromContext(ctx) + logger, tracer, _, _ := libObservability.NewTrackingFromContext(ctx) ctx, span := tracer.Start(ctx, "postgres.list_accounts_by_ids") defer span.End() @@ -1169,7 +1172,7 @@ func (r *AccountPostgreSQLRepository) ListAccountsByIDs(ctx context.Context, org // ListAccountsByAlias list Accounts entity from the database using the provided alias. func (r *AccountPostgreSQLRepository) ListAccountsByAlias(ctx context.Context, organizationID, ledgerID uuid.UUID, aliases []string) ([]*mmodel.Account, error) { - logger, tracer, _, _ := libCommons.NewTrackingFromContext(ctx) + logger, tracer, _, _ := libObservability.NewTrackingFromContext(ctx) ctx, span := tracer.Start(ctx, "postgres.list_accounts_by_alias") defer span.End() @@ -1261,7 +1264,7 @@ func (r *AccountPostgreSQLRepository) ListAccountsByAlias(ctx context.Context, o // Count retrieves the count of accounts from the database. func (r *AccountPostgreSQLRepository) Count(ctx context.Context, organizationID, ledgerID uuid.UUID) (int64, error) { - logger, tracer, _, _ := libCommons.NewTrackingFromContext(ctx) + logger, tracer, _, _ := libObservability.NewTrackingFromContext(ctx) ctx, span := tracer.Start(ctx, "postgres.count_accounts") defer span.End() diff --git a/components/ledger/internal/adapters/postgres/accounttype/accounttype.postgresql.go b/components/ledger/internal/adapters/postgres/accounttype/accounttype.postgresql.go index f355b235f..db577e6ed 100644 --- a/components/ledger/internal/adapters/postgres/accounttype/accounttype.postgresql.go +++ b/components/ledger/internal/adapters/postgres/accounttype/accounttype.postgresql.go @@ -13,9 +13,10 @@ import ( "time" libCommons "github.com/LerianStudio/lib-commons/v5/commons" - libLog "github.com/LerianStudio/lib-commons/v5/commons/log" + libObservability "github.com/LerianStudio/lib-observability" + libLog "github.com/LerianStudio/lib-observability/log" libHTTP "github.com/LerianStudio/lib-commons/v5/commons/net/http" - libOpentelemetry "github.com/LerianStudio/lib-commons/v5/commons/opentelemetry" + libOpentelemetry "github.com/LerianStudio/lib-observability/tracing" libPointers "github.com/LerianStudio/lib-commons/v5/commons/pointers" libPostgres "github.com/LerianStudio/lib-commons/v5/commons/postgres" tmcore "github.com/LerianStudio/lib-commons/v5/commons/tenant-manager/core" @@ -103,7 +104,7 @@ func (r *AccountTypePostgreSQLRepository) getDB(ctx context.Context) (dbresolver // Create creates a new account type. // It returns the created account type and an error if the operation fails. func (r *AccountTypePostgreSQLRepository) Create(ctx context.Context, organizationID, ledgerID uuid.UUID, accountType *mmodel.AccountType) (*mmodel.AccountType, error) { - logger, tracer, _, _ := libCommons.NewTrackingFromContext(ctx) + logger, tracer, _, _ := libObservability.NewTrackingFromContext(ctx) ctx, span := tracer.Start(ctx, "postgres.create_account_type") defer span.End() @@ -180,7 +181,7 @@ func (r *AccountTypePostgreSQLRepository) Create(ctx context.Context, organizati // FindByID retrieves an account type by its ID. // It returns the account type if found, otherwise it returns an error. func (r *AccountTypePostgreSQLRepository) FindByID(ctx context.Context, organizationID, ledgerID, id uuid.UUID) (*mmodel.AccountType, error) { - logger, tracer, _, _ := libCommons.NewTrackingFromContext(ctx) + logger, tracer, _, _ := libObservability.NewTrackingFromContext(ctx) ctx, span := tracer.Start(ctx, "postgres.find_account_type_by_id") defer span.End() @@ -245,7 +246,7 @@ func (r *AccountTypePostgreSQLRepository) FindByID(ctx context.Context, organiza // FindByKey retrieves an account type by its key within an organization and ledger. // It returns the account type if found, otherwise it returns an error. func (r *AccountTypePostgreSQLRepository) FindByKey(ctx context.Context, organizationID, ledgerID uuid.UUID, key string) (*mmodel.AccountType, error) { - logger, tracer, _, _ := libCommons.NewTrackingFromContext(ctx) + logger, tracer, _, _ := libObservability.NewTrackingFromContext(ctx) ctx, span := tracer.Start(ctx, "postgres.find_account_type_by_key") defer span.End() @@ -310,7 +311,7 @@ func (r *AccountTypePostgreSQLRepository) FindByKey(ctx context.Context, organiz // Update updates an account type by its ID. // It returns the updated account type if found, otherwise it returns an error. func (r *AccountTypePostgreSQLRepository) Update(ctx context.Context, organizationID, ledgerID, id uuid.UUID, accountType *mmodel.AccountType) (*mmodel.AccountType, error) { - logger, tracer, _, _ := libCommons.NewTrackingFromContext(ctx) + logger, tracer, _, _ := libObservability.NewTrackingFromContext(ctx) ctx, span := tracer.Start(ctx, "postgres.update_account_type") defer span.End() @@ -398,7 +399,7 @@ func (r *AccountTypePostgreSQLRepository) Update(ctx context.Context, organizati // FindAll retrieves all account types with cursor pagination. // It returns the account types, pagination cursor, and an error if the operation fails. func (r *AccountTypePostgreSQLRepository) FindAll(ctx context.Context, organizationID, ledgerID uuid.UUID, filter http.QueryHeader) ([]*mmodel.AccountType, libHTTP.CursorPagination, error) { - logger, tracer, _, _ := libCommons.NewTrackingFromContext(ctx) + logger, tracer, _, _ := libObservability.NewTrackingFromContext(ctx) ctx, span := tracer.Start(ctx, "postgres.find_all_account_types") defer span.End() @@ -526,7 +527,7 @@ func (r *AccountTypePostgreSQLRepository) FindAll(ctx context.Context, organizat // ListByIDs retrieves account types by their IDs. // It returns the account types matching the provided IDs or an error if the operation fails. func (r *AccountTypePostgreSQLRepository) ListByIDs(ctx context.Context, organizationID, ledgerID uuid.UUID, ids []uuid.UUID) ([]*mmodel.AccountType, error) { - logger, tracer, _, _ := libCommons.NewTrackingFromContext(ctx) + logger, tracer, _, _ := libObservability.NewTrackingFromContext(ctx) ctx, span := tracer.Start(ctx, "postgres.list_account_types_by_ids") defer span.End() @@ -606,7 +607,7 @@ func (r *AccountTypePostgreSQLRepository) ListByIDs(ctx context.Context, organiz // Delete performs a soft delete of an account type by its ID. // It returns an error if the operation fails or if the account type is not found. func (r *AccountTypePostgreSQLRepository) Delete(ctx context.Context, organizationID, ledgerID, id uuid.UUID) error { - logger, tracer, _, _ := libCommons.NewTrackingFromContext(ctx) + logger, tracer, _, _ := libObservability.NewTrackingFromContext(ctx) ctx, span := tracer.Start(ctx, "postgres.delete_account_type") defer span.End() diff --git a/components/ledger/internal/adapters/postgres/asset/asset.postgresql.go b/components/ledger/internal/adapters/postgres/asset/asset.postgresql.go index 131673fc6..fb96f06b5 100644 --- a/components/ledger/internal/adapters/postgres/asset/asset.postgresql.go +++ b/components/ledger/internal/adapters/postgres/asset/asset.postgresql.go @@ -14,8 +14,9 @@ import ( "time" libCommons "github.com/LerianStudio/lib-commons/v5/commons" - libLog "github.com/LerianStudio/lib-commons/v5/commons/log" - libOpentelemetry "github.com/LerianStudio/lib-commons/v5/commons/opentelemetry" + libObservability "github.com/LerianStudio/lib-observability" + libLog "github.com/LerianStudio/lib-observability/log" + libOpentelemetry "github.com/LerianStudio/lib-observability/tracing" libPointers "github.com/LerianStudio/lib-commons/v5/commons/pointers" libPostgres "github.com/LerianStudio/lib-commons/v5/commons/postgres" tmcore "github.com/LerianStudio/lib-commons/v5/commons/tenant-manager/core" @@ -107,7 +108,7 @@ func (r *AssetPostgreSQLRepository) getDB(ctx context.Context) (dbresolver.DB, e // Create a new asset entity into Postgresql and returns it. func (r *AssetPostgreSQLRepository) Create(ctx context.Context, asset *mmodel.Asset) (*mmodel.Asset, error) { - logger, tracer, _, _ := libCommons.NewTrackingFromContext(ctx) + logger, tracer, _, _ := libObservability.NewTrackingFromContext(ctx) ctx, span := tracer.Start(ctx, "postgres.create_asset") defer span.End() @@ -176,7 +177,7 @@ func (r *AssetPostgreSQLRepository) Create(ctx context.Context, asset *mmodel.As // FindByNameOrCode retrieves Asset entities by name or code from the database. func (r *AssetPostgreSQLRepository) FindByNameOrCode(ctx context.Context, organizationID, ledgerID uuid.UUID, name, code string) (bool, error) { - logger, tracer, _, _ := libCommons.NewTrackingFromContext(ctx) + logger, tracer, _, _ := libObservability.NewTrackingFromContext(ctx) ctx, span := tracer.Start(ctx, "postgres.find_asset_by_name_or_code") defer span.End() @@ -238,7 +239,7 @@ func (r *AssetPostgreSQLRepository) FindByNameOrCode(ctx context.Context, organi // FindAll retrieves Asset entities from the database with soft-deleted records. func (r *AssetPostgreSQLRepository) FindAll(ctx context.Context, organizationID, ledgerID uuid.UUID, filter http.Pagination) ([]*mmodel.Asset, error) { - logger, tracer, _, _ := libCommons.NewTrackingFromContext(ctx) + logger, tracer, _, _ := libObservability.NewTrackingFromContext(ctx) ctx, span := tracer.Start(ctx, "postgres.find_all_assets") defer span.End() @@ -316,7 +317,7 @@ func (r *AssetPostgreSQLRepository) FindAll(ctx context.Context, organizationID, // ListByIDs retrieves Assets entities from the database using the provided IDs. func (r *AssetPostgreSQLRepository) ListByIDs(ctx context.Context, organizationID, ledgerID uuid.UUID, ids []uuid.UUID) ([]*mmodel.Asset, error) { - logger, tracer, _, _ := libCommons.NewTrackingFromContext(ctx) + logger, tracer, _, _ := libObservability.NewTrackingFromContext(ctx) ctx, span := tracer.Start(ctx, "postgres.list_assets_by_ids") defer span.End() @@ -392,7 +393,7 @@ func (r *AssetPostgreSQLRepository) ListByIDs(ctx context.Context, organizationI // Find retrieves an Asset entity from the database using the provided ID. func (r *AssetPostgreSQLRepository) Find(ctx context.Context, organizationID, ledgerID, id uuid.UUID) (*mmodel.Asset, error) { - logger, tracer, _, _ := libCommons.NewTrackingFromContext(ctx) + logger, tracer, _, _ := libObservability.NewTrackingFromContext(ctx) ctx, span := tracer.Start(ctx, "postgres.find_asset") defer span.End() @@ -448,7 +449,7 @@ func (r *AssetPostgreSQLRepository) Find(ctx context.Context, organizationID, le // Update an Asset entity into Postgresql and returns the Asset updated. func (r *AssetPostgreSQLRepository) Update(ctx context.Context, organizationID, ledgerID, id uuid.UUID, asset *mmodel.Asset) (*mmodel.Asset, error) { - logger, tracer, _, _ := libCommons.NewTrackingFromContext(ctx) + logger, tracer, _, _ := libObservability.NewTrackingFromContext(ctx) ctx, span := tracer.Start(ctx, "postgres.update_asset") defer span.End() @@ -545,7 +546,7 @@ func (r *AssetPostgreSQLRepository) Update(ctx context.Context, organizationID, // Delete removes an Asset entity from the database using the provided IDs. func (r *AssetPostgreSQLRepository) Delete(ctx context.Context, organizationID, ledgerID, id uuid.UUID) error { - logger, tracer, _, _ := libCommons.NewTrackingFromContext(ctx) + logger, tracer, _, _ := libObservability.NewTrackingFromContext(ctx) ctx, span := tracer.Start(ctx, "postgres.delete_asset") defer span.End() @@ -595,7 +596,7 @@ func (r *AssetPostgreSQLRepository) Delete(ctx context.Context, organizationID, // Count retrieves the total count of Asset entities from the database. func (r *AssetPostgreSQLRepository) Count(ctx context.Context, organizationID, ledgerID uuid.UUID) (int64, error) { - logger, tracer, _, _ := libCommons.NewTrackingFromContext(ctx) + logger, tracer, _, _ := libObservability.NewTrackingFromContext(ctx) ctx, span := tracer.Start(ctx, "postgres.count_assets") defer span.End() diff --git a/components/ledger/internal/adapters/postgres/assetrate/assetrate.postgresql.go b/components/ledger/internal/adapters/postgres/assetrate/assetrate.postgresql.go index ca6a4fe93..4e4a91983 100644 --- a/components/ledger/internal/adapters/postgres/assetrate/assetrate.postgresql.go +++ b/components/ledger/internal/adapters/postgres/assetrate/assetrate.postgresql.go @@ -15,9 +15,10 @@ import ( "time" libCommons "github.com/LerianStudio/lib-commons/v5/commons" - libLog "github.com/LerianStudio/lib-commons/v5/commons/log" + libObservability "github.com/LerianStudio/lib-observability" + libLog "github.com/LerianStudio/lib-observability/log" libHTTP "github.com/LerianStudio/lib-commons/v5/commons/net/http" - libOpentelemetry "github.com/LerianStudio/lib-commons/v5/commons/opentelemetry" + libOpentelemetry "github.com/LerianStudio/lib-observability/tracing" libPointers "github.com/LerianStudio/lib-commons/v5/commons/pointers" libPostgres "github.com/LerianStudio/lib-commons/v5/commons/postgres" tmcore "github.com/LerianStudio/lib-commons/v5/commons/tenant-manager/core" @@ -103,7 +104,7 @@ func (r *AssetRatePostgreSQLRepository) getDB(ctx context.Context) (dbresolver.D // Create a new AssetRate entity into Postgresql and returns it. func (r *AssetRatePostgreSQLRepository) Create(ctx context.Context, assetRate *AssetRate) (*AssetRate, error) { - logger, tracer, _, _ := libCommons.NewTrackingFromContext(ctx) + logger, tracer, _, _ := libObservability.NewTrackingFromContext(ctx) ctx, span := tracer.Start(ctx, "postgres.create_asset_rate") defer span.End() @@ -175,7 +176,7 @@ func (r *AssetRatePostgreSQLRepository) Create(ctx context.Context, assetRate *A // FindByExternalID an AssetRate entity by its external ID in Postgresql and returns it. func (r *AssetRatePostgreSQLRepository) FindByExternalID(ctx context.Context, organizationID, ledgerID, externalID uuid.UUID) (*AssetRate, error) { - logger, tracer, _, _ := libCommons.NewTrackingFromContext(ctx) + logger, tracer, _, _ := libObservability.NewTrackingFromContext(ctx) ctx, span := tracer.Start(ctx, "postgres.find_asset_rate_by_external_id") defer span.End() @@ -252,7 +253,7 @@ func (r *AssetRatePostgreSQLRepository) FindByExternalID(ctx context.Context, or // FindByCurrencyPair an AssetRate entity by its currency pair in Postgresql and returns it. func (r *AssetRatePostgreSQLRepository) FindByCurrencyPair(ctx context.Context, organizationID, ledgerID uuid.UUID, from, to string) (*AssetRate, error) { - logger, tracer, _, _ := libCommons.NewTrackingFromContext(ctx) + logger, tracer, _, _ := libObservability.NewTrackingFromContext(ctx) ctx, span := tracer.Start(ctx, "postgres.find_asset_rate_by_currency_pair") defer span.End() @@ -326,7 +327,7 @@ func (r *AssetRatePostgreSQLRepository) FindByCurrencyPair(ctx context.Context, // FindAllByAssetCodes returns all asset rates by asset codes. func (r *AssetRatePostgreSQLRepository) FindAllByAssetCodes(ctx context.Context, organizationID, ledgerID uuid.UUID, fromAssetCode string, toAssetCodes []string, filter http.Pagination) ([]*AssetRate, libHTTP.CursorPagination, error) { - logger, tracer, _, _ := libCommons.NewTrackingFromContext(ctx) + logger, tracer, _, _ := libObservability.NewTrackingFromContext(ctx) ctx, span := tracer.Start(ctx, "postgres.find_all_asset_rates_by_asset_codes") defer span.End() @@ -458,7 +459,7 @@ func (r *AssetRatePostgreSQLRepository) FindAllByAssetCodes(ctx context.Context, // Update an AssetRate entity into Postgresql and returns the AssetRate updated. func (r *AssetRatePostgreSQLRepository) Update(ctx context.Context, organizationID, ledgerID, id uuid.UUID, assetRate *AssetRate) (*AssetRate, error) { - logger, tracer, _, _ := libCommons.NewTrackingFromContext(ctx) + logger, tracer, _, _ := libObservability.NewTrackingFromContext(ctx) ctx, span := tracer.Start(ctx, "postgres.update_asset_rate") defer span.End() diff --git a/components/ledger/internal/adapters/postgres/balance/balance.go b/components/ledger/internal/adapters/postgres/balance/balance.go index fbbb27850..7c5c0ed03 100644 --- a/components/ledger/internal/adapters/postgres/balance/balance.go +++ b/components/ledger/internal/adapters/postgres/balance/balance.go @@ -65,7 +65,7 @@ func (b *BalancePostgreSQLModel) FromEntity(balance *mmodel.Balance) { // JSON-safe primitives (string, bool, *string). We intentionally // discard the error and leave b.Settings as nil on the (impossible) // failure path, matching the existing behavior for a nil Settings. - b.Settings, _ = json.Marshal(balance.Settings) + b.Settings, _ = json.Marshal(balance.Settings) //nolint:errchkjson // see comment above } if libCommons.IsNilOrEmpty(&balance.Key) { diff --git a/components/ledger/internal/adapters/postgres/balance/balance.postgresql.go b/components/ledger/internal/adapters/postgres/balance/balance.postgresql.go index 07aa1105f..d696c72d3 100644 --- a/components/ledger/internal/adapters/postgres/balance/balance.postgresql.go +++ b/components/ledger/internal/adapters/postgres/balance/balance.postgresql.go @@ -16,9 +16,10 @@ import ( "time" libCommons "github.com/LerianStudio/lib-commons/v5/commons" - libLog "github.com/LerianStudio/lib-commons/v5/commons/log" + libObservability "github.com/LerianStudio/lib-observability" + libLog "github.com/LerianStudio/lib-observability/log" libHTTP "github.com/LerianStudio/lib-commons/v5/commons/net/http" - libOpentelemetry "github.com/LerianStudio/lib-commons/v5/commons/opentelemetry" + libOpentelemetry "github.com/LerianStudio/lib-observability/tracing" libPointers "github.com/LerianStudio/lib-commons/v5/commons/pointers" libPostgres "github.com/LerianStudio/lib-commons/v5/commons/postgres" tmcore "github.com/LerianStudio/lib-commons/v5/commons/tenant-manager/core" @@ -126,7 +127,7 @@ func (r *BalancePostgreSQLRepository) getDB(ctx context.Context) (dbresolver.DB, } func (r *BalancePostgreSQLRepository) Create(ctx context.Context, balance *mmodel.Balance) (*mmodel.Balance, error) { - logger, tracer, _, _ := libCommons.NewTrackingFromContext(ctx) + logger, tracer, _, _ := libObservability.NewTrackingFromContext(ctx) ctx, span := tracer.Start(ctx, "postgres.create_balance") defer span.End() @@ -214,7 +215,7 @@ func (r *BalancePostgreSQLRepository) Create(ctx context.Context, balance *mmode // ListByAccountIDs list Balances entity from the database using the provided accountIDs. func (r *BalancePostgreSQLRepository) ListByAccountIDs(ctx context.Context, organizationID, ledgerID uuid.UUID, accountIds []uuid.UUID) ([]*mmodel.Balance, error) { - logger, tracer, _, _ := libCommons.NewTrackingFromContext(ctx) + logger, tracer, _, _ := libObservability.NewTrackingFromContext(ctx) ctx, span := tracer.Start(ctx, "postgres.list_balances_by_ids") defer span.End() @@ -306,7 +307,7 @@ func (r *BalancePostgreSQLRepository) ListByAccountIDs(ctx context.Context, orga // ListByIDs retrieves balances by their balance IDs. func (r *BalancePostgreSQLRepository) ListByIDs(ctx context.Context, organizationID, ledgerID uuid.UUID, ids []uuid.UUID) ([]*mmodel.Balance, error) { - logger, tracer, _, _ := libCommons.NewTrackingFromContext(ctx) + logger, tracer, _, _ := libObservability.NewTrackingFromContext(ctx) ctx, span := tracer.Start(ctx, "postgres.list_balances_by_balance_ids") defer span.End() @@ -402,7 +403,7 @@ func (r *BalancePostgreSQLRepository) ListByIDs(ctx context.Context, organizatio // ListAll list Balances entity from the database. func (r *BalancePostgreSQLRepository) ListAll(ctx context.Context, organizationID, ledgerID uuid.UUID, filter http.Pagination) ([]*mmodel.Balance, libHTTP.CursorPagination, error) { - logger, tracer, _, _ := libCommons.NewTrackingFromContext(ctx) + logger, tracer, _, _ := libObservability.NewTrackingFromContext(ctx) ctx, span := tracer.Start(ctx, "postgres.list_all_balances") defer span.End() @@ -534,7 +535,7 @@ func (r *BalancePostgreSQLRepository) ListAll(ctx context.Context, organizationI // ListAllByAccountID list Balances entity from the database using the provided accountID. func (r *BalancePostgreSQLRepository) ListAllByAccountID(ctx context.Context, organizationID, ledgerID, accountID uuid.UUID, filter http.Pagination) ([]*mmodel.Balance, libHTTP.CursorPagination, error) { - logger, tracer, _, _ := libCommons.NewTrackingFromContext(ctx) + logger, tracer, _, _ := libObservability.NewTrackingFromContext(ctx) ctx, span := tracer.Start(ctx, "postgres.list_all_balances_by_account_id") defer span.End() @@ -667,7 +668,7 @@ func (r *BalancePostgreSQLRepository) ListAllByAccountID(ctx context.Context, or // ListByAliases list Balances entity from the database using the provided aliases. func (r *BalancePostgreSQLRepository) ListByAliases(ctx context.Context, organizationID, ledgerID uuid.UUID, aliases []string) ([]*mmodel.Balance, error) { - logger, tracer, _, _ := libCommons.NewTrackingFromContext(ctx) + logger, tracer, _, _ := libObservability.NewTrackingFromContext(ctx) ctx, span := tracer.Start(ctx, "postgres.list_balances_by_aliases") defer span.End() @@ -761,7 +762,7 @@ func (r *BalancePostgreSQLRepository) ListByAliases(ctx context.Context, organiz // ListByAliasesWithKeys list Balances entity from the database using the provided alias#key pairs. func (r *BalancePostgreSQLRepository) ListByAliasesWithKeys(ctx context.Context, organizationID, ledgerID uuid.UUID, aliasesWithKeys []string) ([]*mmodel.Balance, error) { - logger, tracer, _, _ := libCommons.NewTrackingFromContext(ctx) + logger, tracer, _, _ := libObservability.NewTrackingFromContext(ctx) ctx, span := tracer.Start(ctx, "postgres.list_balances_by_aliases_with_keys") defer span.End() @@ -886,7 +887,7 @@ func (r *BalancePostgreSQLRepository) ListByAliasesWithKeys(ctx context.Context, // Net effect: this method keeps the hot commit path narrow (no overdraft // coupling), while `UpdateMany` (sync worker path) owns overdraft_used durability. func (r *BalancePostgreSQLRepository) BalancesUpdate(ctx context.Context, organizationID, ledgerID uuid.UUID, balances []*mmodel.Balance) error { - logger, tracer, _, _ := libCommons.NewTrackingFromContext(ctx) + logger, tracer, _, _ := libObservability.NewTrackingFromContext(ctx) _, span := tracer.Start(ctx, "postgres.update_balances") defer span.End() @@ -981,7 +982,7 @@ func (r *BalancePostgreSQLRepository) BalancesUpdate(ctx context.Context, organi // Find retrieves a balance entity from the database using the provided ID. func (r *BalancePostgreSQLRepository) Find(ctx context.Context, organizationID, ledgerID, id uuid.UUID) (*mmodel.Balance, error) { - logger, tracer, _, _ := libCommons.NewTrackingFromContext(ctx) + logger, tracer, _, _ := libObservability.NewTrackingFromContext(ctx) ctx, span := tracer.Start(ctx, "postgres.find_balance") defer span.End() @@ -1063,7 +1064,7 @@ func (r *BalancePostgreSQLRepository) Find(ctx context.Context, organizationID, // FindByAccountIDAndKey retrieves a balance record based on accountID and key within the specified organization and ledger. func (r *BalancePostgreSQLRepository) FindByAccountIDAndKey(ctx context.Context, organizationID, ledgerID, accountID uuid.UUID, key string) (*mmodel.Balance, error) { - logger, tracer, _, _ := libCommons.NewTrackingFromContext(ctx) + logger, tracer, _, _ := libObservability.NewTrackingFromContext(ctx) ctx, span := tracer.Start(ctx, "postgres.find_balance_by_account_id_and_key") defer span.End() @@ -1136,7 +1137,7 @@ func (r *BalancePostgreSQLRepository) FindByAccountIDAndKey(ctx context.Context, // ExistsByAccountIDAndKey returns true if a balance exists for the given accountID and key within the specified organization and ledger. func (r *BalancePostgreSQLRepository) ExistsByAccountIDAndKey(ctx context.Context, organizationID, ledgerID, accountID uuid.UUID, key string) (bool, error) { - logger, tracer, _, _ := libCommons.NewTrackingFromContext(ctx) + logger, tracer, _, _ := libObservability.NewTrackingFromContext(ctx) ctx, span := tracer.Start(ctx, "postgres.exists_balance_by_account_id_and_key") defer span.End() @@ -1190,7 +1191,7 @@ func (r *BalancePostgreSQLRepository) ExistsByAccountIDAndKey(ctx context.Contex // Delete marks a balance as deleted in the database using the ID provided func (r *BalancePostgreSQLRepository) Delete(ctx context.Context, organizationID, ledgerID, id uuid.UUID) error { - logger, tracer, _, _ := libCommons.NewTrackingFromContext(ctx) + logger, tracer, _, _ := libObservability.NewTrackingFromContext(ctx) ctx, span := tracer.Start(ctx, "postgres.delete_balance") defer span.End() @@ -1246,7 +1247,7 @@ func (r *BalancePostgreSQLRepository) Delete(ctx context.Context, organizationID // DeleteAllByIDs marks all provided balances as deleted in the database using the IDs provided func (r *BalancePostgreSQLRepository) DeleteAllByIDs(ctx context.Context, organizationID, ledgerID uuid.UUID, ids []uuid.UUID) error { - logger, tracer, _, _ := libCommons.NewTrackingFromContext(ctx) + logger, tracer, _, _ := libObservability.NewTrackingFromContext(ctx) ctx, span := tracer.Start(ctx, "postgres.delete_balances") defer span.End() @@ -1353,7 +1354,7 @@ func (r *BalancePostgreSQLRepository) DeleteAllByIDs(ctx context.Context, organi // PATCH any subset of {allow_sending, allow_receiving, settings} without the // repo emitting placeholder strings for fields the request omits. func (r *BalancePostgreSQLRepository) Update(ctx context.Context, organizationID, ledgerID, id uuid.UUID, balance mmodel.UpdateBalance) (*mmodel.Balance, error) { - logger, tracer, _, _ := libCommons.NewTrackingFromContext(ctx) + logger, tracer, _, _ := libObservability.NewTrackingFromContext(ctx) ctx, span := tracer.Start(ctx, "postgres.update_balance") defer span.End() @@ -1471,7 +1472,7 @@ func (r *BalancePostgreSQLRepository) UpdateMany(ctx context.Context, organizati return 0, nil } - logger, tracer, _, _ := libCommons.NewTrackingFromContext(ctx) + logger, tracer, _, _ := libObservability.NewTrackingFromContext(ctx) ctx, span := tracer.Start(ctx, "postgres.sync_batch") defer span.End() @@ -1597,7 +1598,7 @@ func (r *BalancePostgreSQLRepository) UpdateMany(ctx context.Context, organizati } func (r *BalancePostgreSQLRepository) UpdateAllByAccountID(ctx context.Context, organizationID, ledgerID, accountID uuid.UUID, balance mmodel.UpdateBalance) error { - logger, tracer, _, _ := libCommons.NewTrackingFromContext(ctx) + logger, tracer, _, _ := libObservability.NewTrackingFromContext(ctx) ctx, span := tracer.Start(ctx, "postgres.update_all_by_account_id") defer span.End() @@ -1670,7 +1671,7 @@ func (r *BalancePostgreSQLRepository) UpdateAllByAccountID(ctx context.Context, // ListByAccountID list Balances entity from the database using the provided accountID. // This method does not support pagination or date filtering. func (r *BalancePostgreSQLRepository) ListByAccountID(ctx context.Context, organizationID, ledgerID, accountID uuid.UUID) ([]*mmodel.Balance, error) { - logger, tracer, _, _ := libCommons.NewTrackingFromContext(ctx) + logger, tracer, _, _ := libObservability.NewTrackingFromContext(ctx) ctx, span := tracer.Start(ctx, "postgres.list_balances_by_account_id") defer span.End() @@ -1761,7 +1762,7 @@ func (r *BalancePostgreSQLRepository) ListByAccountID(ctx context.Context, organ // It uses a single optimized query with LEFT JOIN to fetch balance states, avoiding multiple round-trips. // Balances without operations at the timestamp are returned with zero values (initial state). func (r *BalancePostgreSQLRepository) ListByAccountIDAtTimestamp(ctx context.Context, organizationID, ledgerID, accountID uuid.UUID, timestamp time.Time) ([]*mmodel.Balance, error) { - logger, tracer, _, _ := libCommons.NewTrackingFromContext(ctx) + logger, tracer, _, _ := libObservability.NewTrackingFromContext(ctx) ctx, span := tracer.Start(ctx, "postgres.list_balances_by_account_id_at_timestamp") defer span.End() diff --git a/components/ledger/internal/adapters/postgres/ledger/ledger.postgresql.go b/components/ledger/internal/adapters/postgres/ledger/ledger.postgresql.go index 9d25e7066..10d189be4 100644 --- a/components/ledger/internal/adapters/postgres/ledger/ledger.postgresql.go +++ b/components/ledger/internal/adapters/postgres/ledger/ledger.postgresql.go @@ -15,8 +15,9 @@ import ( "time" libCommons "github.com/LerianStudio/lib-commons/v5/commons" - libLog "github.com/LerianStudio/lib-commons/v5/commons/log" - libOpentelemetry "github.com/LerianStudio/lib-commons/v5/commons/opentelemetry" + libObservability "github.com/LerianStudio/lib-observability" + libLog "github.com/LerianStudio/lib-observability/log" + libOpentelemetry "github.com/LerianStudio/lib-observability/tracing" libPointers "github.com/LerianStudio/lib-commons/v5/commons/pointers" libPostgres "github.com/LerianStudio/lib-commons/v5/commons/postgres" tmcore "github.com/LerianStudio/lib-commons/v5/commons/tenant-manager/core" @@ -162,7 +163,7 @@ func (r *LedgerPostgreSQLRepository) getDB(ctx context.Context) (dbresolver.DB, } func (r *LedgerPostgreSQLRepository) Create(ctx context.Context, ledger *mmodel.Ledger) (*mmodel.Ledger, error) { - logger, tracer, _, _ := libCommons.NewTrackingFromContext(ctx) + logger, tracer, _, _ := libObservability.NewTrackingFromContext(ctx) ctx, span := tracer.Start(ctx, "postgres.create_ledger") defer span.End() @@ -260,7 +261,7 @@ func (r *LedgerPostgreSQLRepository) Create(ctx context.Context, ledger *mmodel. } func (r *LedgerPostgreSQLRepository) Find(ctx context.Context, organizationID, id uuid.UUID) (*mmodel.Ledger, error) { - logger, tracer, _, _ := libCommons.NewTrackingFromContext(ctx) + logger, tracer, _, _ := libObservability.NewTrackingFromContext(ctx) ctx, span := tracer.Start(ctx, "postgres.find_ledger") defer span.End() @@ -330,7 +331,7 @@ func (r *LedgerPostgreSQLRepository) Find(ctx context.Context, organizationID, i } func (r *LedgerPostgreSQLRepository) FindAll(ctx context.Context, organizationID uuid.UUID, filter http.QueryHeader) ([]*mmodel.Ledger, error) { - logger, tracer, _, _ := libCommons.NewTrackingFromContext(ctx) + logger, tracer, _, _ := libObservability.NewTrackingFromContext(ctx) ctx, span := tracer.Start(ctx, "postgres.find_all_ledgers") defer span.End() @@ -431,7 +432,7 @@ func (r *LedgerPostgreSQLRepository) FindAll(ctx context.Context, organizationID } func (r *LedgerPostgreSQLRepository) FindByName(ctx context.Context, organizationID uuid.UUID, name string) (bool, error) { - logger, tracer, _, _ := libCommons.NewTrackingFromContext(ctx) + logger, tracer, _, _ := libObservability.NewTrackingFromContext(ctx) ctx, span := tracer.Start(ctx, "postgres.find_ledger_by_name") defer span.End() @@ -484,7 +485,7 @@ func (r *LedgerPostgreSQLRepository) FindByName(ctx context.Context, organizatio } func (r *LedgerPostgreSQLRepository) ListByIDs(ctx context.Context, organizationID uuid.UUID, ids []uuid.UUID) ([]*mmodel.Ledger, error) { - logger, tracer, _, _ := libCommons.NewTrackingFromContext(ctx) + logger, tracer, _, _ := libObservability.NewTrackingFromContext(ctx) ctx, span := tracer.Start(ctx, "postgres.list_ledgers_by_ids") defer span.End() @@ -567,7 +568,7 @@ func (r *LedgerPostgreSQLRepository) ListByIDs(ctx context.Context, organization } func (r *LedgerPostgreSQLRepository) Update(ctx context.Context, organizationID, id uuid.UUID, ledger *mmodel.Ledger) (*mmodel.Ledger, error) { - logger, tracer, _, _ := libCommons.NewTrackingFromContext(ctx) + logger, tracer, _, _ := libObservability.NewTrackingFromContext(ctx) ctx, span := tracer.Start(ctx, "postgres.update_ledger") defer span.End() @@ -671,7 +672,7 @@ func (r *LedgerPostgreSQLRepository) Update(ctx context.Context, organizationID, } func (r *LedgerPostgreSQLRepository) Delete(ctx context.Context, organizationID, id uuid.UUID) error { - logger, tracer, _, _ := libCommons.NewTrackingFromContext(ctx) + logger, tracer, _, _ := libObservability.NewTrackingFromContext(ctx) ctx, span := tracer.Start(ctx, "postgres.delete_ledger") defer span.End() @@ -717,7 +718,7 @@ func (r *LedgerPostgreSQLRepository) Delete(ctx context.Context, organizationID, } func (r *LedgerPostgreSQLRepository) Count(ctx context.Context, organizationID uuid.UUID) (int64, error) { - logger, tracer, _, _ := libCommons.NewTrackingFromContext(ctx) + logger, tracer, _, _ := libObservability.NewTrackingFromContext(ctx) ctx, span := tracer.Start(ctx, "postgres.count_ledgers") defer span.End() @@ -747,7 +748,7 @@ func (r *LedgerPostgreSQLRepository) Count(ctx context.Context, organizationID u } func (r *LedgerPostgreSQLRepository) GetSettings(ctx context.Context, organizationID, ledgerID uuid.UUID) (map[string]any, error) { - logger, tracer, _, _ := libCommons.NewTrackingFromContext(ctx) + logger, tracer, _, _ := libObservability.NewTrackingFromContext(ctx) ctx, span := tracer.Start(ctx, "postgres.get_ledger_settings") defer span.End() @@ -804,7 +805,7 @@ func (r *LedgerPostgreSQLRepository) GetSettings(ctx context.Context, organizati // Implementation note: merges via PostgreSQL's JSONB || operator (top-level only). func (r *LedgerPostgreSQLRepository) UpdateSettings(ctx context.Context, organizationID, ledgerID uuid.UUID, settings map[string]any) (map[string]any, error) { - logger, tracer, _, _ := libCommons.NewTrackingFromContext(ctx) + logger, tracer, _, _ := libObservability.NewTrackingFromContext(ctx) ctx, span := tracer.Start(ctx, "postgres.update_ledger_settings") defer span.End() @@ -891,7 +892,7 @@ func (r *LedgerPostgreSQLRepository) UpdateSettings(ctx context.Context, organiz } func (r *LedgerPostgreSQLRepository) ReplaceSettings(ctx context.Context, organizationID, ledgerID uuid.UUID, settings map[string]any) (map[string]any, error) { - logger, tracer, _, _ := libCommons.NewTrackingFromContext(ctx) + logger, tracer, _, _ := libObservability.NewTrackingFromContext(ctx) ctx, span := tracer.Start(ctx, "postgres.replace_ledger_settings") defer span.End() @@ -969,7 +970,7 @@ func (r *LedgerPostgreSQLRepository) ReplaceSettings(ctx context.Context, organi // Implementation note: uses SELECT FOR UPDATE inside a transaction to lock the row. func (r *LedgerPostgreSQLRepository) UpdateSettingsAtomic(ctx context.Context, organizationID, ledgerID uuid.UUID, mergeFn func(existing map[string]any) (map[string]any, error)) (map[string]any, error) { - logger, tracer, _, _ := libCommons.NewTrackingFromContext(ctx) + logger, tracer, _, _ := libObservability.NewTrackingFromContext(ctx) ctx, span := tracer.Start(ctx, "postgres.update_ledger_settings_atomic") defer span.End() diff --git a/components/ledger/internal/adapters/postgres/operation/operation.postgresql.go b/components/ledger/internal/adapters/postgres/operation/operation.postgresql.go index aa94a2b16..a214be123 100644 --- a/components/ledger/internal/adapters/postgres/operation/operation.postgresql.go +++ b/components/ledger/internal/adapters/postgres/operation/operation.postgresql.go @@ -15,8 +15,9 @@ import ( "time" libCommons "github.com/LerianStudio/lib-commons/v5/commons" + libObservability "github.com/LerianStudio/lib-observability" libHTTP "github.com/LerianStudio/lib-commons/v5/commons/net/http" - libOpentelemetry "github.com/LerianStudio/lib-commons/v5/commons/opentelemetry" + libOpentelemetry "github.com/LerianStudio/lib-observability/tracing" libPointers "github.com/LerianStudio/lib-commons/v5/commons/pointers" libPostgres "github.com/LerianStudio/lib-commons/v5/commons/postgres" tmcore "github.com/LerianStudio/lib-commons/v5/commons/tenant-manager/core" @@ -30,7 +31,7 @@ import ( "github.com/jackc/pgx/v5/pgconn" "github.com/lib/pq" - libLog "github.com/LerianStudio/lib-commons/v5/commons/log" + libLog "github.com/LerianStudio/lib-observability/log" ) // OperationFilter holds optional filters for listing operations. @@ -168,7 +169,7 @@ func (r *OperationPostgreSQLRepository) getDB(ctx context.Context) (dbresolver.D // Create a new Operation entity into Postgresql and returns it. func (r *OperationPostgreSQLRepository) Create(ctx context.Context, operation *Operation) (*Operation, error) { - logger, tracer, _, _ := libCommons.NewTrackingFromContext(ctx) + logger, tracer, _, _ := libObservability.NewTrackingFromContext(ctx) ctx, span := tracer.Start(ctx, "postgres.create_operation") defer span.End() @@ -285,7 +286,7 @@ func (r *OperationPostgreSQLRepository) Create(ctx context.Context, operation *O // // NOTE: The input slice is sorted in-place by ID. Callers should not rely on original order after this call. func (r *OperationPostgreSQLRepository) CreateBulk(ctx context.Context, operations []*Operation) (*repository.BulkInsertResult, error) { - logger, tracer, _, _ := libCommons.NewTrackingFromContext(ctx) + logger, tracer, _, _ := libObservability.NewTrackingFromContext(ctx) ctx, span := tracer.Start(ctx, "postgres.create_bulk_operations") defer span.End() @@ -335,7 +336,7 @@ func (r *OperationPostgreSQLRepository) createBulkInternal( spanName string, logSuffix string, ) (*repository.BulkInsertResult, error) { - logger, tracer, _, _ := libCommons.NewTrackingFromContext(ctx) + logger, tracer, _, _ := libObservability.NewTrackingFromContext(ctx) ctx, span := tracer.Start(ctx, spanName) defer span.End() @@ -413,7 +414,7 @@ type operationChunkInsertResult struct { // Uses repository.DBExecutor to work with both dbresolver.DB and dbresolver.Tx. // Returns the count of inserted rows and their IDs for downstream filtering. func (r *OperationPostgreSQLRepository) insertOperationChunk(ctx context.Context, db repository.DBExecutor, operations []*Operation) (*operationChunkInsertResult, error) { - logger, tracer, _, _ := libCommons.NewTrackingFromContext(ctx) + logger, tracer, _, _ := libObservability.NewTrackingFromContext(ctx) ctx, span := tracer.Start(ctx, "postgres.insert_operation_chunk") defer span.End() @@ -516,7 +517,7 @@ func (r *OperationPostgreSQLRepository) insertOperationChunk(ctx context.Context // FindAll retrieves Operations entities from the database. func (r *OperationPostgreSQLRepository) FindAll(ctx context.Context, organizationID, ledgerID, transactionID uuid.UUID, filter http.Pagination) ([]*Operation, libHTTP.CursorPagination, error) { - logger, tracer, _, _ := libCommons.NewTrackingFromContext(ctx) + logger, tracer, _, _ := libObservability.NewTrackingFromContext(ctx) ctx, span := tracer.Start(ctx, "postgres.find_all_operations") defer span.End() @@ -667,7 +668,7 @@ func (r *OperationPostgreSQLRepository) FindAll(ctx context.Context, organizatio // ListByIDs retrieves Operation entities from the database using the provided IDs. func (r *OperationPostgreSQLRepository) ListByIDs(ctx context.Context, organizationID, ledgerID uuid.UUID, ids []uuid.UUID) ([]*Operation, error) { - logger, tracer, _, _ := libCommons.NewTrackingFromContext(ctx) + logger, tracer, _, _ := libObservability.NewTrackingFromContext(ctx) ctx, span := tracer.Start(ctx, "postgres.list_all_operations_by_ids") defer span.End() @@ -779,7 +780,7 @@ func (r *OperationPostgreSQLRepository) ListByIDs(ctx context.Context, organizat // Find retrieves a Operation entity from the database using the provided ID. func (r *OperationPostgreSQLRepository) Find(ctx context.Context, organizationID, ledgerID, transactionID, id uuid.UUID) (*Operation, error) { - logger, tracer, _, _ := libCommons.NewTrackingFromContext(ctx) + logger, tracer, _, _ := libObservability.NewTrackingFromContext(ctx) ctx, span := tracer.Start(ctx, "postgres.find_operation") defer span.End() @@ -878,7 +879,7 @@ func (r *OperationPostgreSQLRepository) Find(ctx context.Context, organizationID // FindByAccount retrieves a Operation entity from the database using the provided account ID. func (r *OperationPostgreSQLRepository) FindByAccount(ctx context.Context, organizationID, ledgerID, accountID, id uuid.UUID) (*Operation, error) { - logger, tracer, _, _ := libCommons.NewTrackingFromContext(ctx) + logger, tracer, _, _ := libObservability.NewTrackingFromContext(ctx) ctx, span := tracer.Start(ctx, "postgres.find_all_operations_by_account") defer span.End() @@ -977,7 +978,7 @@ func (r *OperationPostgreSQLRepository) FindByAccount(ctx context.Context, organ // Update an Operation entity into Postgresql and returns the Operation updated. func (r *OperationPostgreSQLRepository) Update(ctx context.Context, organizationID, ledgerID, transactionID, id uuid.UUID, operation *Operation) (*Operation, error) { - logger, tracer, _, _ := libCommons.NewTrackingFromContext(ctx) + logger, tracer, _, _ := libObservability.NewTrackingFromContext(ctx) ctx, span := tracer.Start(ctx, "postgres.update_operation") defer span.End() @@ -1053,7 +1054,7 @@ func (r *OperationPostgreSQLRepository) Update(ctx context.Context, organization // Delete removes a Operation entity from the database using the provided IDs. func (r *OperationPostgreSQLRepository) Delete(ctx context.Context, organizationID, ledgerID, id uuid.UUID) error { - logger, tracer, _, _ := libCommons.NewTrackingFromContext(ctx) + logger, tracer, _, _ := libObservability.NewTrackingFromContext(ctx) ctx, span := tracer.Start(ctx, "postgres.delete_operation") defer span.End() @@ -1140,7 +1141,7 @@ func applyDirectionFallbackFilter(findAll squirrel.SelectBuilder, direction stri // FindAllByAccount retrieves Operations entities from the database using the provided account ID. func (r *OperationPostgreSQLRepository) FindAllByAccount(ctx context.Context, organizationID, ledgerID, accountID uuid.UUID, opFilter OperationFilter, filter http.Pagination) ([]*Operation, libHTTP.CursorPagination, error) { - logger, tracer, _, _ := libCommons.NewTrackingFromContext(ctx) + logger, tracer, _, _ := libObservability.NewTrackingFromContext(ctx) ctx, span := tracer.Start(ctx, "postgres.find_all_operations_by_account") defer span.End() @@ -1308,7 +1309,7 @@ func (r *OperationPostgreSQLRepository) FindAllByAccount(ctx context.Context, or // FindLastOperationBeforeTimestamp finds the last operation for a specific balance before a given timestamp. // This is used for point-in-time balance queries to determine the balance state at a specific moment. func (r *OperationPostgreSQLRepository) FindLastOperationBeforeTimestamp(ctx context.Context, organizationID, ledgerID, accountID, balanceID uuid.UUID, timestamp time.Time) (*Operation, error) { - logger, tracer, _, _ := libCommons.NewTrackingFromContext(ctx) + logger, tracer, _, _ := libObservability.NewTrackingFromContext(ctx) ctx, span := tracer.Start(ctx, "postgres.find_last_operation_before_timestamp") defer span.End() @@ -1383,7 +1384,7 @@ func (r *OperationPostgreSQLRepository) FindLastOperationBeforeTimestamp(ctx con // FindLastOperationsForAccountBeforeTimestamp finds the last operation for each balance of an account before a given timestamp. // This is used for point-in-time account balance queries to get all balance states at a specific moment. func (r *OperationPostgreSQLRepository) FindLastOperationsForAccountBeforeTimestamp(ctx context.Context, organizationID, ledgerID, accountID uuid.UUID, timestamp time.Time, filter http.Pagination) ([]*Operation, libHTTP.CursorPagination, error) { - logger, tracer, _, _ := libCommons.NewTrackingFromContext(ctx) + logger, tracer, _, _ := libObservability.NewTrackingFromContext(ctx) ctx, span := tracer.Start(ctx, "postgres.find_last_operations_for_account_before_timestamp") defer span.End() diff --git a/components/ledger/internal/adapters/postgres/operationroute/operationroute.go b/components/ledger/internal/adapters/postgres/operationroute/operationroute.go index b2dfbac48..e299d1878 100644 --- a/components/ledger/internal/adapters/postgres/operationroute/operationroute.go +++ b/components/ledger/internal/adapters/postgres/operationroute/operationroute.go @@ -102,10 +102,10 @@ func (m *OperationRoutePostgreSQLModel) FromEntity(e *mmodel.OperationRoute) { m.Title = e.Title m.Description = e.Description - if strings.TrimSpace(e.Code) == "" { + if strings.TrimSpace(e.Code) == "" { //nolint:staticcheck // legacy Code field persisted for backward compatibility m.Code = sql.NullString{} } else { - m.Code = sql.NullString{String: e.Code, Valid: true} + m.Code = sql.NullString{String: e.Code, Valid: true} //nolint:staticcheck // legacy Code field persisted for backward compatibility } m.OperationType = strings.ToLower(e.OperationType) diff --git a/components/ledger/internal/adapters/postgres/operationroute/operationroute.postgresql.go b/components/ledger/internal/adapters/postgres/operationroute/operationroute.postgresql.go index 32dbbb571..d86153078 100644 --- a/components/ledger/internal/adapters/postgres/operationroute/operationroute.postgresql.go +++ b/components/ledger/internal/adapters/postgres/operationroute/operationroute.postgresql.go @@ -14,8 +14,9 @@ import ( "time" libCommons "github.com/LerianStudio/lib-commons/v5/commons" + libObservability "github.com/LerianStudio/lib-observability" libHTTP "github.com/LerianStudio/lib-commons/v5/commons/net/http" - libOpentelemetry "github.com/LerianStudio/lib-commons/v5/commons/opentelemetry" + libOpentelemetry "github.com/LerianStudio/lib-observability/tracing" libPointers "github.com/LerianStudio/lib-commons/v5/commons/pointers" libPostgres "github.com/LerianStudio/lib-commons/v5/commons/postgres" tmcore "github.com/LerianStudio/lib-commons/v5/commons/tenant-manager/core" @@ -31,7 +32,7 @@ import ( "github.com/lib/pq" "go.opentelemetry.io/otel/attribute" - libLog "github.com/LerianStudio/lib-commons/v5/commons/log" + libLog "github.com/LerianStudio/lib-observability/log" ) // operationRouteReturningColumns is the SELECT expression used in the @@ -156,7 +157,7 @@ func (r *OperationRoutePostgreSQLRepository) getDB(ctx context.Context) (dbresol } func (r *OperationRoutePostgreSQLRepository) Create(ctx context.Context, organizationID, ledgerID uuid.UUID, operationRoute *mmodel.OperationRoute) (*mmodel.OperationRoute, error) { - logger, tracer, _, _ := libCommons.NewTrackingFromContext(ctx) + logger, tracer, _, _ := libObservability.NewTrackingFromContext(ctx) operationRouteID := uuid.Nil if operationRoute != nil { @@ -244,7 +245,7 @@ func (r *OperationRoutePostgreSQLRepository) Create(ctx context.Context, organiz } func (r *OperationRoutePostgreSQLRepository) FindByID(ctx context.Context, organizationID, ledgerID, id uuid.UUID) (*mmodel.OperationRoute, error) { - logger, tracer, _, _ := libCommons.NewTrackingFromContext(ctx) + logger, tracer, _, _ := libObservability.NewTrackingFromContext(ctx) ctx, span := tracer.Start(ctx, "postgres.find_operation_route") defer span.End() @@ -337,7 +338,7 @@ func (r *OperationRoutePostgreSQLRepository) FindByID(ctx context.Context, organ } func (r *OperationRoutePostgreSQLRepository) FindByIDs(ctx context.Context, organizationID, ledgerID uuid.UUID, ids []uuid.UUID) ([]*mmodel.OperationRoute, error) { - logger, tracer, _, _ := libCommons.NewTrackingFromContext(ctx) + logger, tracer, _, _ := libObservability.NewTrackingFromContext(ctx) ctx, span := tracer.Start(ctx, "postgres.find_operation_routes_by_ids") defer span.End() @@ -467,7 +468,7 @@ func (r *OperationRoutePostgreSQLRepository) FindByIDs(ctx context.Context, orga } func (r *OperationRoutePostgreSQLRepository) Update(ctx context.Context, organizationID, ledgerID, id uuid.UUID, operationRoute *mmodel.OperationRoute) (*mmodel.OperationRoute, error) { - logger, tracer, _, _ := libCommons.NewTrackingFromContext(ctx) + logger, tracer, _, _ := libObservability.NewTrackingFromContext(ctx) ctx, span := tracer.Start(ctx, "postgres.update_operation_route") defer span.End() @@ -505,7 +506,7 @@ func (r *OperationRoutePostgreSQLRepository) Update(ctx context.Context, organiz qb = qb.Set("description", record.Description) } - if operationRoute.Code != "" { + if operationRoute.Code != "" { //nolint:staticcheck // legacy Code field persisted for backward compatibility qb = qb.Set("code", record.Code) } @@ -600,7 +601,7 @@ func (r *OperationRoutePostgreSQLRepository) Update(ctx context.Context, organiz } func (r *OperationRoutePostgreSQLRepository) Delete(ctx context.Context, organizationID, ledgerID, id uuid.UUID) error { - logger, tracer, _, _ := libCommons.NewTrackingFromContext(ctx) + logger, tracer, _, _ := libObservability.NewTrackingFromContext(ctx) ctx, span := tracer.Start(ctx, "postgres.delete_operation_route") defer span.End() @@ -695,7 +696,7 @@ func (r *OperationRoutePostgreSQLRepository) Delete(ctx context.Context, organiz } func (r *OperationRoutePostgreSQLRepository) FindAll(ctx context.Context, organizationID, ledgerID uuid.UUID, filter http.Pagination) ([]*mmodel.OperationRoute, libHTTP.CursorPagination, error) { - logger, tracer, _, _ := libCommons.NewTrackingFromContext(ctx) + logger, tracer, _, _ := libObservability.NewTrackingFromContext(ctx) ctx, span := tracer.Start(ctx, "postgres.find_all_operation_routes") defer span.End() @@ -834,7 +835,7 @@ func (r *OperationRoutePostgreSQLRepository) FindAll(ctx context.Context, organi } func (r *OperationRoutePostgreSQLRepository) HasTransactionRouteLinks(ctx context.Context, organizationID, ledgerID, operationRouteID uuid.UUID) (bool, error) { - logger, tracer, _, _ := libCommons.NewTrackingFromContext(ctx) + logger, tracer, _, _ := libObservability.NewTrackingFromContext(ctx) ctx, span := tracer.Start(ctx, "postgres.has_transaction_route_links") defer span.End() @@ -913,7 +914,7 @@ func (r *OperationRoutePostgreSQLRepository) HasTransactionRouteLinks(ctx contex } func (r *OperationRoutePostgreSQLRepository) FindTransactionRouteIDs(ctx context.Context, operationRouteID uuid.UUID) ([]uuid.UUID, error) { - logger, tracer, _, _ := libCommons.NewTrackingFromContext(ctx) + logger, tracer, _, _ := libObservability.NewTrackingFromContext(ctx) ctx, span := tracer.Start(ctx, "postgres.find_transaction_route_ids") defer span.End() diff --git a/components/ledger/internal/adapters/postgres/organization/organization.postgresql.go b/components/ledger/internal/adapters/postgres/organization/organization.postgresql.go index 1e221dcfa..b6a9be769 100644 --- a/components/ledger/internal/adapters/postgres/organization/organization.postgresql.go +++ b/components/ledger/internal/adapters/postgres/organization/organization.postgresql.go @@ -15,8 +15,9 @@ import ( "time" libCommons "github.com/LerianStudio/lib-commons/v5/commons" - libLog "github.com/LerianStudio/lib-commons/v5/commons/log" - libOpentelemetry "github.com/LerianStudio/lib-commons/v5/commons/opentelemetry" + libObservability "github.com/LerianStudio/lib-observability" + libLog "github.com/LerianStudio/lib-observability/log" + libOpentelemetry "github.com/LerianStudio/lib-observability/tracing" libPointers "github.com/LerianStudio/lib-commons/v5/commons/pointers" libPostgres "github.com/LerianStudio/lib-commons/v5/commons/postgres" tmcore "github.com/LerianStudio/lib-commons/v5/commons/tenant-manager/core" @@ -124,7 +125,7 @@ func (r *OrganizationPostgreSQLRepository) getDB(ctx context.Context) (dbresolve } func (r *OrganizationPostgreSQLRepository) Create(ctx context.Context, organization *mmodel.Organization) (*mmodel.Organization, error) { - logger, tracer, _, _ := libCommons.NewTrackingFromContext(ctx) + logger, tracer, _, _ := libObservability.NewTrackingFromContext(ctx) ctx, span := tracer.Start(ctx, "postgres.create_organization") defer span.End() @@ -212,7 +213,7 @@ func (r *OrganizationPostgreSQLRepository) Create(ctx context.Context, organizat } func (r *OrganizationPostgreSQLRepository) Update(ctx context.Context, id uuid.UUID, organization *mmodel.Organization) (*mmodel.Organization, error) { - logger, tracer, _, _ := libCommons.NewTrackingFromContext(ctx) + logger, tracer, _, _ := libObservability.NewTrackingFromContext(ctx) ctx, span := tracer.Start(ctx, "postgres.update_organization") defer span.End() @@ -327,7 +328,7 @@ func (r *OrganizationPostgreSQLRepository) Update(ctx context.Context, id uuid.U } func (r *OrganizationPostgreSQLRepository) Find(ctx context.Context, id uuid.UUID) (*mmodel.Organization, error) { - logger, tracer, _, _ := libCommons.NewTrackingFromContext(ctx) + logger, tracer, _, _ := libObservability.NewTrackingFromContext(ctx) ctx, span := tracer.Start(ctx, "postgres.find_organization") defer span.End() @@ -397,7 +398,7 @@ func (r *OrganizationPostgreSQLRepository) Find(ctx context.Context, id uuid.UUI } func (r *OrganizationPostgreSQLRepository) FindAll(ctx context.Context, filter http.QueryHeader) ([]*mmodel.Organization, error) { - logger, tracer, _, _ := libCommons.NewTrackingFromContext(ctx) + logger, tracer, _, _ := libObservability.NewTrackingFromContext(ctx) ctx, span := tracer.Start(ctx, "postgres.find_all_organizations") defer span.End() @@ -511,7 +512,7 @@ func (r *OrganizationPostgreSQLRepository) FindAll(ctx context.Context, filter h } func (r *OrganizationPostgreSQLRepository) ListByIDs(ctx context.Context, ids []uuid.UUID) ([]*mmodel.Organization, error) { - logger, tracer, _, _ := libCommons.NewTrackingFromContext(ctx) + logger, tracer, _, _ := libObservability.NewTrackingFromContext(ctx) ctx, span := tracer.Start(ctx, "postgres.list_organizations_by_ids") defer span.End() @@ -598,7 +599,7 @@ func (r *OrganizationPostgreSQLRepository) ListByIDs(ctx context.Context, ids [] } func (r *OrganizationPostgreSQLRepository) Delete(ctx context.Context, id uuid.UUID) error { - logger, tracer, _, _ := libCommons.NewTrackingFromContext(ctx) + logger, tracer, _, _ := libObservability.NewTrackingFromContext(ctx) ctx, span := tracer.Start(ctx, "postgres.delete_organization") defer span.End() @@ -646,7 +647,7 @@ func (r *OrganizationPostgreSQLRepository) Delete(ctx context.Context, id uuid.U } func (r *OrganizationPostgreSQLRepository) Count(ctx context.Context) (int64, error) { - logger, tracer, _, _ := libCommons.NewTrackingFromContext(ctx) + logger, tracer, _, _ := libObservability.NewTrackingFromContext(ctx) ctx, span := tracer.Start(ctx, "postgres.count_organizations") defer span.End() diff --git a/components/ledger/internal/adapters/postgres/portfolio/portfolio.postgresql.go b/components/ledger/internal/adapters/postgres/portfolio/portfolio.postgresql.go index c775ccd61..ec4e3ae13 100644 --- a/components/ledger/internal/adapters/postgres/portfolio/portfolio.postgresql.go +++ b/components/ledger/internal/adapters/postgres/portfolio/portfolio.postgresql.go @@ -13,8 +13,9 @@ import ( "time" libCommons "github.com/LerianStudio/lib-commons/v5/commons" - libLog "github.com/LerianStudio/lib-commons/v5/commons/log" - libOpentelemetry "github.com/LerianStudio/lib-commons/v5/commons/opentelemetry" + libObservability "github.com/LerianStudio/lib-observability" + libLog "github.com/LerianStudio/lib-observability/log" + libOpentelemetry "github.com/LerianStudio/lib-observability/tracing" libPointers "github.com/LerianStudio/lib-commons/v5/commons/pointers" libPostgres "github.com/LerianStudio/lib-commons/v5/commons/postgres" tmcore "github.com/LerianStudio/lib-commons/v5/commons/tenant-manager/core" @@ -105,7 +106,7 @@ func (r *PortfolioPostgreSQLRepository) getDB(ctx context.Context) (dbresolver.D // Create a new portfolio entity into Postgresql and returns it. func (r *PortfolioPostgreSQLRepository) Create(ctx context.Context, portfolio *mmodel.Portfolio) (*mmodel.Portfolio, error) { - logger, tracer, _, _ := libCommons.NewTrackingFromContext(ctx) + logger, tracer, _, _ := libObservability.NewTrackingFromContext(ctx) ctx, span := tracer.Start(ctx, "postgres.create_portfolio") defer span.End() @@ -176,7 +177,7 @@ func (r *PortfolioPostgreSQLRepository) Create(ctx context.Context, portfolio *m // FindByIDEntity find portfolio from the database using the Entity id. func (r *PortfolioPostgreSQLRepository) FindByIDEntity(ctx context.Context, organizationID, ledgerID, entityID uuid.UUID) (*mmodel.Portfolio, error) { - logger, tracer, _, _ := libCommons.NewTrackingFromContext(ctx) + logger, tracer, _, _ := libObservability.NewTrackingFromContext(ctx) ctx, span := tracer.Start(ctx, "postgres.find_portfolio_by_id_entity") defer span.End() @@ -244,7 +245,7 @@ func (r *PortfolioPostgreSQLRepository) FindByIDEntity(ctx context.Context, orga // FindAll retrieves Portfolio entities from the database. func (r *PortfolioPostgreSQLRepository) FindAll(ctx context.Context, organizationID, ledgerID uuid.UUID, filter http.QueryHeader) ([]*mmodel.Portfolio, error) { - logger, tracer, _, _ := libCommons.NewTrackingFromContext(ctx) + logger, tracer, _, _ := libObservability.NewTrackingFromContext(ctx) ctx, span := tracer.Start(ctx, "postgres.find_all_portfolios") defer span.End() @@ -344,7 +345,7 @@ func (r *PortfolioPostgreSQLRepository) FindAll(ctx context.Context, organizatio // Find retrieves a Portfolio entity from the database using the provided ID. func (r *PortfolioPostgreSQLRepository) Find(ctx context.Context, organizationID, ledgerID, id uuid.UUID) (*mmodel.Portfolio, error) { - logger, tracer, _, _ := libCommons.NewTrackingFromContext(ctx) + logger, tracer, _, _ := libObservability.NewTrackingFromContext(ctx) ctx, span := tracer.Start(ctx, "postgres.find_portfolio") defer span.End() @@ -412,7 +413,7 @@ func (r *PortfolioPostgreSQLRepository) Find(ctx context.Context, organizationID // ListByIDs retrieves Portfolios entities from the database using the provided IDs. func (r *PortfolioPostgreSQLRepository) ListByIDs(ctx context.Context, organizationID, ledgerID uuid.UUID, ids []uuid.UUID) ([]*mmodel.Portfolio, error) { - logger, tracer, _, _ := libCommons.NewTrackingFromContext(ctx) + logger, tracer, _, _ := libObservability.NewTrackingFromContext(ctx) ctx, span := tracer.Start(ctx, "postgres.list_portfolios_by_ids") defer span.End() @@ -495,7 +496,7 @@ func (r *PortfolioPostgreSQLRepository) ListByIDs(ctx context.Context, organizat // Update a Portfolio entity into Postgresql and returns the Portfolio updated. func (r *PortfolioPostgreSQLRepository) Update(ctx context.Context, organizationID, ledgerID, id uuid.UUID, portfolio *mmodel.Portfolio) (*mmodel.Portfolio, error) { - logger, tracer, _, _ := libCommons.NewTrackingFromContext(ctx) + logger, tracer, _, _ := libObservability.NewTrackingFromContext(ctx) ctx, span := tracer.Start(ctx, "postgres.update_portfolio") defer span.End() @@ -595,7 +596,7 @@ func (r *PortfolioPostgreSQLRepository) Update(ctx context.Context, organization // Delete removes a Portfolio entity from the database using the provided IDs. func (r *PortfolioPostgreSQLRepository) Delete(ctx context.Context, organizationID, ledgerID, id uuid.UUID) error { - logger, tracer, _, _ := libCommons.NewTrackingFromContext(ctx) + logger, tracer, _, _ := libObservability.NewTrackingFromContext(ctx) ctx, span := tracer.Start(ctx, "postgres.delete_portfolio") defer span.End() @@ -645,7 +646,7 @@ func (r *PortfolioPostgreSQLRepository) Delete(ctx context.Context, organization // Count retrieves the number of Portfolio entities in the database. func (r *PortfolioPostgreSQLRepository) Count(ctx context.Context, organizationID, ledgerID uuid.UUID) (int64, error) { - logger, tracer, _, _ := libCommons.NewTrackingFromContext(ctx) + logger, tracer, _, _ := libObservability.NewTrackingFromContext(ctx) ctx, span := tracer.Start(ctx, "postgres.count_portfolios") defer span.End() diff --git a/components/ledger/internal/adapters/postgres/segment/segment.postgresql.go b/components/ledger/internal/adapters/postgres/segment/segment.postgresql.go index 04c0bdb12..98e5b1864 100644 --- a/components/ledger/internal/adapters/postgres/segment/segment.postgresql.go +++ b/components/ledger/internal/adapters/postgres/segment/segment.postgresql.go @@ -13,8 +13,9 @@ import ( "time" libCommons "github.com/LerianStudio/lib-commons/v5/commons" - libLog "github.com/LerianStudio/lib-commons/v5/commons/log" - libOpentelemetry "github.com/LerianStudio/lib-commons/v5/commons/opentelemetry" + libObservability "github.com/LerianStudio/lib-observability" + libLog "github.com/LerianStudio/lib-observability/log" + libOpentelemetry "github.com/LerianStudio/lib-observability/tracing" libPointers "github.com/LerianStudio/lib-commons/v5/commons/pointers" libPostgres "github.com/LerianStudio/lib-commons/v5/commons/postgres" tmcore "github.com/LerianStudio/lib-commons/v5/commons/tenant-manager/core" @@ -111,7 +112,7 @@ func (p *SegmentPostgreSQLRepository) getDB(ctx context.Context) (dbresolver.DB, } func (p *SegmentPostgreSQLRepository) Create(ctx context.Context, segment *mmodel.Segment) (*mmodel.Segment, error) { - logger, tracer, _, _ := libCommons.NewTrackingFromContext(ctx) + logger, tracer, _, _ := libObservability.NewTrackingFromContext(ctx) ctx, span := tracer.Start(ctx, "postgres.create_segment") defer span.End() @@ -190,7 +191,7 @@ func (p *SegmentPostgreSQLRepository) Create(ctx context.Context, segment *mmode } func (p *SegmentPostgreSQLRepository) ExistsByName(ctx context.Context, organizationID, ledgerID uuid.UUID, name string) (bool, error) { - logger, tracer, _, _ := libCommons.NewTrackingFromContext(ctx) + logger, tracer, _, _ := libObservability.NewTrackingFromContext(ctx) ctx, span := tracer.Start(ctx, "postgres.exists_segment_by_name") defer span.End() @@ -254,7 +255,7 @@ func (p *SegmentPostgreSQLRepository) ExistsByName(ctx context.Context, organiza } func (p *SegmentPostgreSQLRepository) FindAll(ctx context.Context, organizationID, ledgerID uuid.UUID, filter http.Pagination) ([]*mmodel.Segment, error) { - logger, tracer, _, _ := libCommons.NewTrackingFromContext(ctx) + logger, tracer, _, _ := libObservability.NewTrackingFromContext(ctx) ctx, span := tracer.Start(ctx, "postgres.find_all_segments") defer span.End() @@ -329,7 +330,7 @@ func (p *SegmentPostgreSQLRepository) FindAll(ctx context.Context, organizationI } func (p *SegmentPostgreSQLRepository) FindByIDs(ctx context.Context, organizationID, ledgerID uuid.UUID, ids []uuid.UUID) ([]*mmodel.Segment, error) { - logger, tracer, _, _ := libCommons.NewTrackingFromContext(ctx) + logger, tracer, _, _ := libObservability.NewTrackingFromContext(ctx) ctx, span := tracer.Start(ctx, "postgres.find_segments_by_ids") defer span.End() @@ -400,7 +401,7 @@ func (p *SegmentPostgreSQLRepository) FindByIDs(ctx context.Context, organizatio } func (p *SegmentPostgreSQLRepository) Find(ctx context.Context, organizationID, ledgerID, id uuid.UUID) (*mmodel.Segment, error) { - logger, tracer, _, _ := libCommons.NewTrackingFromContext(ctx) + logger, tracer, _, _ := libObservability.NewTrackingFromContext(ctx) ctx, span := tracer.Start(ctx, "postgres.find_segment") defer span.End() @@ -459,7 +460,7 @@ func (p *SegmentPostgreSQLRepository) Find(ctx context.Context, organizationID, } func (p *SegmentPostgreSQLRepository) Update(ctx context.Context, organizationID, ledgerID, id uuid.UUID, prd *mmodel.Segment) (*mmodel.Segment, error) { - logger, tracer, _, _ := libCommons.NewTrackingFromContext(ctx) + logger, tracer, _, _ := libObservability.NewTrackingFromContext(ctx) ctx, span := tracer.Start(ctx, "postgres.update_segment") defer span.End() @@ -552,7 +553,7 @@ func (p *SegmentPostgreSQLRepository) Update(ctx context.Context, organizationID } func (p *SegmentPostgreSQLRepository) Delete(ctx context.Context, organizationID, ledgerID, id uuid.UUID) error { - logger, tracer, _, _ := libCommons.NewTrackingFromContext(ctx) + logger, tracer, _, _ := libObservability.NewTrackingFromContext(ctx) ctx, span := tracer.Start(ctx, "postgres.delete_segment") defer span.End() @@ -615,7 +616,7 @@ func (p *SegmentPostgreSQLRepository) Delete(ctx context.Context, organizationID } func (p *SegmentPostgreSQLRepository) Count(ctx context.Context, organizationID, ledgerID uuid.UUID) (int64, error) { - logger, tracer, _, _ := libCommons.NewTrackingFromContext(ctx) + logger, tracer, _, _ := libObservability.NewTrackingFromContext(ctx) ctx, span := tracer.Start(ctx, "postgres.count_segments") defer span.End() diff --git a/components/ledger/internal/adapters/postgres/transaction/transaction.go b/components/ledger/internal/adapters/postgres/transaction/transaction.go index 639024bb8..7b163286a 100644 --- a/components/ledger/internal/adapters/postgres/transaction/transaction.go +++ b/components/ledger/internal/adapters/postgres/transaction/transaction.go @@ -339,7 +339,7 @@ func (t Transaction) TransactionRevert() mtransaction.Transaction { Description: op.Description, ChartOfAccounts: op.ChartOfAccounts, Metadata: op.Metadata, - Route: op.Route, + Route: op.Route, //nolint:staticcheck // legacy field kept for backward compatibility; RouteID is canonical RouteID: op.RouteID, }) fromByAlias[op.AccountAlias] = len(froms) - 1 @@ -361,7 +361,7 @@ func (t Transaction) TransactionRevert() mtransaction.Transaction { Description: op.Description, ChartOfAccounts: op.ChartOfAccounts, Metadata: op.Metadata, - Route: op.Route, + Route: op.Route, //nolint:staticcheck // legacy field kept for backward compatibility; RouteID is canonical RouteID: op.RouteID, }) toByAlias[op.AccountAlias] = len(tos) - 1 diff --git a/components/ledger/internal/adapters/postgres/transaction/transaction.postgresql.go b/components/ledger/internal/adapters/postgres/transaction/transaction.postgresql.go index 9191ff5b5..a59829682 100644 --- a/components/ledger/internal/adapters/postgres/transaction/transaction.postgresql.go +++ b/components/ledger/internal/adapters/postgres/transaction/transaction.postgresql.go @@ -17,9 +17,10 @@ import ( "time" libCommons "github.com/LerianStudio/lib-commons/v5/commons" - libLog "github.com/LerianStudio/lib-commons/v5/commons/log" + libObservability "github.com/LerianStudio/lib-observability" + libLog "github.com/LerianStudio/lib-observability/log" libHTTP "github.com/LerianStudio/lib-commons/v5/commons/net/http" - libOpentelemetry "github.com/LerianStudio/lib-commons/v5/commons/opentelemetry" + libOpentelemetry "github.com/LerianStudio/lib-observability/tracing" libPointers "github.com/LerianStudio/lib-commons/v5/commons/pointers" libPostgres "github.com/LerianStudio/lib-commons/v5/commons/postgres" tmcore "github.com/LerianStudio/lib-commons/v5/commons/tenant-manager/core" @@ -179,7 +180,7 @@ func (r *TransactionPostgreSQLRepository) BeginTx(ctx context.Context) (reposito // Create a new Transaction entity into Postgresql and returns it. func (r *TransactionPostgreSQLRepository) Create(ctx context.Context, transaction *Transaction) (*Transaction, error) { - logger, tracer, _, _ := libCommons.NewTrackingFromContext(ctx) + logger, tracer, _, _ := libObservability.NewTrackingFromContext(ctx) ctx, span := tracer.Start(ctx, "postgres.create_transaction") defer span.End() @@ -276,7 +277,7 @@ func (r *TransactionPostgreSQLRepository) Create(ctx context.Context, transactio // // NOTE: The input slice is sorted in-place by ID. Callers should not rely on original order after this call. func (r *TransactionPostgreSQLRepository) CreateBulk(ctx context.Context, transactions []*Transaction) (*repository.BulkInsertResult, error) { - logger, tracer, _, _ := libCommons.NewTrackingFromContext(ctx) + logger, tracer, _, _ := libObservability.NewTrackingFromContext(ctx) ctx, span := tracer.Start(ctx, "postgres.create_bulk_transactions") defer span.End() @@ -326,7 +327,7 @@ func (r *TransactionPostgreSQLRepository) createBulkInternal( spanName string, logSuffix string, ) (*repository.BulkInsertResult, error) { - logger, tracer, _, _ := libCommons.NewTrackingFromContext(ctx) + logger, tracer, _, _ := libObservability.NewTrackingFromContext(ctx) ctx, span := tracer.Start(ctx, spanName) defer span.End() @@ -404,7 +405,7 @@ type chunkInsertResult struct { // Uses repository.DBExecutor to work with both dbresolver.DB and dbresolver.Tx. // Returns the count of inserted rows and their IDs for downstream filtering. func (r *TransactionPostgreSQLRepository) insertTransactionChunk(ctx context.Context, db repository.DBExecutor, transactions []*Transaction) (*chunkInsertResult, error) { - logger, tracer, _, _ := libCommons.NewTrackingFromContext(ctx) + logger, tracer, _, _ := libObservability.NewTrackingFromContext(ctx) ctx, span := tracer.Start(ctx, "postgres.insert_transaction_chunk") defer span.End() @@ -501,7 +502,7 @@ func (r *TransactionPostgreSQLRepository) insertTransactionChunk(ctx context.Con // // NOTE: The input slice is sorted in-place by ID. Callers should not rely on original order after this call. func (r *TransactionPostgreSQLRepository) UpdateBulk(ctx context.Context, transactions []*Transaction) (*repository.BulkUpdateResult, error) { - logger, tracer, _, _ := libCommons.NewTrackingFromContext(ctx) + logger, tracer, _, _ := libObservability.NewTrackingFromContext(ctx) ctx, span := tracer.Start(ctx, "postgres.update_bulk_transactions") defer span.End() @@ -550,7 +551,7 @@ func (r *TransactionPostgreSQLRepository) updateBulkInternal( spanName string, logSuffix string, ) (*repository.BulkUpdateResult, error) { - logger, tracer, _, _ := libCommons.NewTrackingFromContext(ctx) + logger, tracer, _, _ := libObservability.NewTrackingFromContext(ctx) ctx, span := tracer.Start(ctx, spanName) defer span.End() @@ -624,7 +625,7 @@ func (r *TransactionPostgreSQLRepository) updateBulkInternal( // Each transaction is updated only if its status differs from the new status. // Uses repository.DBExecutor to work with both dbresolver.DB and dbresolver.Tx. func (r *TransactionPostgreSQLRepository) updateTransactionChunk(ctx context.Context, db repository.DBExecutor, transactions []*Transaction) (int64, error) { - logger, tracer, _, _ := libCommons.NewTrackingFromContext(ctx) + logger, tracer, _, _ := libObservability.NewTrackingFromContext(ctx) ctx, span := tracer.Start(ctx, "postgres.update_transaction_chunk") defer span.End() @@ -689,7 +690,7 @@ func (r *TransactionPostgreSQLRepository) updateTransactionChunk(ctx context.Con // FindAll retrieves Transactions entities from the database. func (r *TransactionPostgreSQLRepository) FindAll(ctx context.Context, organizationID, ledgerID uuid.UUID, filter http.Pagination) ([]*Transaction, libHTTP.CursorPagination, error) { - logger, tracer, _, _ := libCommons.NewTrackingFromContext(ctx) + logger, tracer, _, _ := libObservability.NewTrackingFromContext(ctx) ctx, span := tracer.Start(ctx, "postgres.find_all_transactions") defer span.End() @@ -831,7 +832,7 @@ func (r *TransactionPostgreSQLRepository) FindAll(ctx context.Context, organizat // ListByIDs retrieves Transaction entities from the database using the provided IDs. func (r *TransactionPostgreSQLRepository) ListByIDs(ctx context.Context, organizationID, ledgerID uuid.UUID, ids []uuid.UUID) ([]*Transaction, error) { - logger, tracer, _, _ := libCommons.NewTrackingFromContext(ctx) + logger, tracer, _, _ := libObservability.NewTrackingFromContext(ctx) ctx, span := tracer.Start(ctx, "postgres.list_transactions_by_ids") defer span.End() @@ -935,7 +936,7 @@ func (r *TransactionPostgreSQLRepository) ListByIDs(ctx context.Context, organiz // Find retrieves a Transaction entity from the database using the provided ID. func (r *TransactionPostgreSQLRepository) Find(ctx context.Context, organizationID, ledgerID, id uuid.UUID) (*Transaction, error) { - logger, tracer, _, _ := libCommons.NewTrackingFromContext(ctx) + logger, tracer, _, _ := libObservability.NewTrackingFromContext(ctx) ctx, span := tracer.Start(ctx, "postgres.find_transaction") defer span.End() @@ -1026,7 +1027,7 @@ func (r *TransactionPostgreSQLRepository) Find(ctx context.Context, organization // FindByParentID retrieves a Transaction entity from the database using the provided parent ID. func (r *TransactionPostgreSQLRepository) FindByParentID(ctx context.Context, organizationID, ledgerID, parentID uuid.UUID) (*Transaction, error) { - logger, tracer, _, _ := libCommons.NewTrackingFromContext(ctx) + logger, tracer, _, _ := libObservability.NewTrackingFromContext(ctx) ctx, span := tracer.Start(ctx, "postgres.find_transaction") defer span.End() @@ -1115,7 +1116,7 @@ func (r *TransactionPostgreSQLRepository) FindByParentID(ctx context.Context, or // Update a Transaction entity into Postgresql and returns the Transaction updated. func (r *TransactionPostgreSQLRepository) Update(ctx context.Context, organizationID, ledgerID, id uuid.UUID, transaction *Transaction) (*Transaction, error) { - logger, tracer, _, _ := libCommons.NewTrackingFromContext(ctx) + logger, tracer, _, _ := libObservability.NewTrackingFromContext(ctx) ctx, span := tracer.Start(ctx, "postgres.update_transaction") defer span.End() @@ -1202,7 +1203,7 @@ func (r *TransactionPostgreSQLRepository) Update(ctx context.Context, organizati // Delete removes a Transaction entity from the database using the provided IDs. func (r *TransactionPostgreSQLRepository) Delete(ctx context.Context, organizationID, ledgerID, id uuid.UUID) error { - logger, tracer, _, _ := libCommons.NewTrackingFromContext(ctx) + logger, tracer, _, _ := libObservability.NewTrackingFromContext(ctx) ctx, span := tracer.Start(ctx, "postgres.delete_transaction") defer span.End() @@ -1253,7 +1254,7 @@ func (r *TransactionPostgreSQLRepository) Delete(ctx context.Context, organizati // FindWithOperations retrieves a Transaction and Operations entity from the database using the provided ID . func (r *TransactionPostgreSQLRepository) FindWithOperations(ctx context.Context, organizationID, ledgerID, id uuid.UUID) (*Transaction, error) { - logger, tracer, _, _ := libCommons.NewTrackingFromContext(ctx) + logger, tracer, _, _ := libObservability.NewTrackingFromContext(ctx) ctx, span := tracer.Start(ctx, "postgres.find_transaction_with_operations") defer span.End() @@ -1403,7 +1404,7 @@ func (r *TransactionPostgreSQLRepository) FindWithOperations(ctx context.Context // func (r *TransactionPostgreSQLRepository) FindOrListAllWithOperations(ctx context.Context, organizationID, ledgerID uuid.UUID, ids []uuid.UUID, filter http.Pagination) ([]*Transaction, libHTTP.CursorPagination, error) { - logger, tracer, _, _ := libCommons.NewTrackingFromContext(ctx) + logger, tracer, _, _ := libObservability.NewTrackingFromContext(ctx) ctx, span := tracer.Start(ctx, "postgres.find_or_list_all_with_operations") defer span.End() @@ -1661,7 +1662,7 @@ func (r *TransactionPostgreSQLRepository) FindOrListAllWithOperations(ctx contex // CountByFilters returns the number of transactions matching the given filters. func (r *TransactionPostgreSQLRepository) CountByFilters(ctx context.Context, organizationID, ledgerID uuid.UUID, filter CountFilter) (int64, error) { - logger, tracer, _, _ := libCommons.NewTrackingFromContext(ctx) + logger, tracer, _, _ := libObservability.NewTrackingFromContext(ctx) ctx, span := tracer.Start(ctx, "postgres.count_transactions_by_filters") defer span.End() diff --git a/components/ledger/internal/adapters/postgres/transactionroute/transactionroute.postgresql.go b/components/ledger/internal/adapters/postgres/transactionroute/transactionroute.postgresql.go index 9dc300220..8ca5018d5 100644 --- a/components/ledger/internal/adapters/postgres/transactionroute/transactionroute.postgresql.go +++ b/components/ledger/internal/adapters/postgres/transactionroute/transactionroute.postgresql.go @@ -13,9 +13,10 @@ import ( "time" libCommons "github.com/LerianStudio/lib-commons/v5/commons" - libLog "github.com/LerianStudio/lib-commons/v5/commons/log" + libObservability "github.com/LerianStudio/lib-observability" + libLog "github.com/LerianStudio/lib-observability/log" libHTTP "github.com/LerianStudio/lib-commons/v5/commons/net/http" - libOpentelemetry "github.com/LerianStudio/lib-commons/v5/commons/opentelemetry" + libOpentelemetry "github.com/LerianStudio/lib-observability/tracing" libPointers "github.com/LerianStudio/lib-commons/v5/commons/pointers" libPostgres "github.com/LerianStudio/lib-commons/v5/commons/postgres" tmcore "github.com/LerianStudio/lib-commons/v5/commons/tenant-manager/core" @@ -137,7 +138,7 @@ func (r *TransactionRoutePostgreSQLRepository) getDB(ctx context.Context) (dbres // It returns the created transaction route and an error if the operation fails. // Uses database transactions to ensure atomicity - if any operation route relation fails, the entire operation is rolled back. func (r *TransactionRoutePostgreSQLRepository) Create(ctx context.Context, organizationID, ledgerID uuid.UUID, transactionRoute *mmodel.TransactionRoute) (*mmodel.TransactionRoute, error) { - logger, tracer, _, _ := libCommons.NewTrackingFromContext(ctx) + logger, tracer, _, _ := libObservability.NewTrackingFromContext(ctx) ctx, span := tracer.Start(ctx, "postgres.create_transaction_route") defer span.End() @@ -272,7 +273,7 @@ func (r *TransactionRoutePostgreSQLRepository) Create(ctx context.Context, organ // FindByID retrieves a transaction route by its ID including its operation routes. // It returns the transaction route if found, otherwise it returns an error. func (r *TransactionRoutePostgreSQLRepository) FindByID(ctx context.Context, organizationID, ledgerID uuid.UUID, id uuid.UUID) (*mmodel.TransactionRoute, error) { - logger, tracer, _, _ := libCommons.NewTrackingFromContext(ctx) + logger, tracer, _, _ := libObservability.NewTrackingFromContext(ctx) ctx, span := tracer.Start(ctx, "postgres.find_transaction_route_by_id") defer span.End() @@ -438,7 +439,7 @@ func (r *TransactionRoutePostgreSQLRepository) FindByID(ctx context.Context, org // It returns the updated transaction route and an error if the operation fails. // If the transaction route has operation routes, it will update the relationships atomically. func (r *TransactionRoutePostgreSQLRepository) Update(ctx context.Context, organizationID, ledgerID, id uuid.UUID, transactionRoute *mmodel.TransactionRoute, toAdd, toRemove []uuid.UUID) (*mmodel.TransactionRoute, error) { - logger, tracer, _, _ := libCommons.NewTrackingFromContext(ctx) + logger, tracer, _, _ := libObservability.NewTrackingFromContext(ctx) ctx, span := tracer.Start(ctx, "postgres.update_transaction_route") defer span.End() @@ -557,7 +558,7 @@ func (r *TransactionRoutePostgreSQLRepository) Update(ctx context.Context, organ // It returns an error if the operation fails. // If the transaction route has operation routes, it will delete the relationships atomically. func (r *TransactionRoutePostgreSQLRepository) Delete(ctx context.Context, organizationID, ledgerID, id uuid.UUID, toRemove []uuid.UUID) error { - logger, tracer, _, _ := libCommons.NewTrackingFromContext(ctx) + logger, tracer, _, _ := libObservability.NewTrackingFromContext(ctx) ctx, span := tracer.Start(ctx, "postgres.delete_transaction_route") defer span.End() @@ -626,7 +627,7 @@ func (r *TransactionRoutePostgreSQLRepository) Delete(ctx context.Context, organ // It returns a list of transaction routes, a cursor pagination object, and an error if the operation fails. // The function supports filtering by date range and pagination. func (r *TransactionRoutePostgreSQLRepository) FindAll(ctx context.Context, organizationID, ledgerID uuid.UUID, filter http.Pagination) ([]*mmodel.TransactionRoute, libHTTP.CursorPagination, error) { - logger, tracer, _, _ := libCommons.NewTrackingFromContext(ctx) + logger, tracer, _, _ := libObservability.NewTrackingFromContext(ctx) ctx, span := tracer.Start(ctx, "postgres.find_all_transaction_routes") defer span.End() @@ -747,7 +748,7 @@ func (r *TransactionRoutePostgreSQLRepository) FindAll(ctx context.Context, orga // a mapping of transaction route IDs to their linked operation route IDs. // Returns an empty map (not nil) when no links are found or input is empty. func (r *TransactionRoutePostgreSQLRepository) FindOperationRouteIDsByTransactionRouteIDs(ctx context.Context, transactionRouteIDs []uuid.UUID) (map[uuid.UUID][]uuid.UUID, error) { - logger, tracer, _, _ := libCommons.NewTrackingFromContext(ctx) + logger, tracer, _, _ := libObservability.NewTrackingFromContext(ctx) ctx, span := tracer.Start(ctx, "postgres.find_operation_route_ids_by_transaction_route_ids") defer span.End() @@ -828,7 +829,7 @@ func (r *TransactionRoutePostgreSQLRepository) updateOperationRouteRelationships QueryContext(context.Context, string, ...any) (*sql.Rows, error) }, transactionRouteID uuid.UUID, toAdd, toRemove []uuid.UUID, ) error { - logger, tracer, _, _ := libCommons.NewTrackingFromContext(ctx) + logger, tracer, _, _ := libObservability.NewTrackingFromContext(ctx) ctxSpan, span := tracer.Start(ctx, "postgres.update_operation_route_relationships") defer span.End() diff --git a/components/ledger/internal/adapters/rabbitmq/circuitbreaker_integration_test.go b/components/ledger/internal/adapters/rabbitmq/circuitbreaker_integration_test.go index 45baa16a5..cac1d5141 100644 --- a/components/ledger/internal/adapters/rabbitmq/circuitbreaker_integration_test.go +++ b/components/ledger/internal/adapters/rabbitmq/circuitbreaker_integration_test.go @@ -20,7 +20,7 @@ import ( libCircuitBreaker "github.com/LerianStudio/lib-commons/v5/commons/circuitbreaker" libRabbitmq "github.com/LerianStudio/lib-commons/v5/commons/rabbitmq" - libZap "github.com/LerianStudio/lib-commons/v5/commons/zap" + libZap "github.com/LerianStudio/lib-observability/zap" "github.com/LerianStudio/midaz/v3/tests/utils/chaos" rmqtestutil "github.com/LerianStudio/midaz/v3/tests/utils/rabbitmq" diff --git a/components/ledger/internal/adapters/rabbitmq/consumer.rabbitmq.go b/components/ledger/internal/adapters/rabbitmq/consumer.rabbitmq.go index b272c0f32..022644725 100644 --- a/components/ledger/internal/adapters/rabbitmq/consumer.rabbitmq.go +++ b/components/ledger/internal/adapters/rabbitmq/consumer.rabbitmq.go @@ -9,9 +9,10 @@ import ( "time" libCommons "github.com/LerianStudio/lib-commons/v5/commons" + libObservability "github.com/LerianStudio/lib-observability" libConstants "github.com/LerianStudio/lib-commons/v5/commons/constants" - libLog "github.com/LerianStudio/lib-commons/v5/commons/log" - libOpentelemetry "github.com/LerianStudio/lib-commons/v5/commons/opentelemetry" + libLog "github.com/LerianStudio/lib-observability/log" + libOpentelemetry "github.com/LerianStudio/lib-observability/tracing" libRabbitmq "github.com/LerianStudio/lib-commons/v5/commons/rabbitmq" "github.com/LerianStudio/midaz/v3/pkg/utils" "github.com/google/uuid" @@ -300,18 +301,17 @@ func (cr *ConsumerRoutes) startWorker(channelCtx context.Context, workerID int, libLog.String(libConstants.HeaderID, midazID), ) - ctx := libCommons.ContextWithLogger( - libCommons.ContextWithHeaderID(context.Background(), midazID), + // Derive from channelCtx so channel closure cancels in-flight handlers. + ctx := libObservability.ContextWithLogger( + libObservability.ContextWithHeaderID(channelCtx, midazID), log, ) - - ctx = libCommons.ContextWithHeaderID(ctx, midazID) ctx = libOpentelemetry.ExtractTraceContextFromQueueHeaders(ctx, msg.Headers) - logger, tracer, reqId, _ := libCommons.NewTrackingFromContext(ctx) + logger, tracer, reqId, _ := libObservability.NewTrackingFromContext(ctx) ctx, spanConsumer := tracer.Start(ctx, "rabbitmq.consumer.process_message") - ctx = libCommons.ContextWithSpanAttributes(ctx, attribute.String("app.request.request_id", reqId)) + ctx = libObservability.ContextWithSpanAttributes(ctx, attribute.String("app.request.request_id", reqId)) err := libOpentelemetry.SetSpanAttributesFromValue(spanConsumer, "app.request.rabbitmq.consumer.message", msg.Body, nil) if err != nil { @@ -442,7 +442,7 @@ func (cr *ConsumerRoutes) processBulkFlush( // Build context with trace information from first message bulkCtx := cr.buildBulkContext(ctx, deliveries) - logger, tracer, _, _ := libCommons.NewTrackingFromContext(bulkCtx) + logger, tracer, _, _ := libObservability.NewTrackingFromContext(bulkCtx) bulkCtx, span := tracer.Start(bulkCtx, "rabbitmq.consumer.process_bulk") defer span.End() @@ -564,8 +564,8 @@ func (cr *ConsumerRoutes) buildBulkContext(ctx context.Context, deliveries []amq libLog.Int("bulk_size", len(deliveries)), ) - bulkCtx := libCommons.ContextWithLogger( - libCommons.ContextWithHeaderID(ctx, midazID), + bulkCtx := libObservability.ContextWithLogger( + libObservability.ContextWithHeaderID(ctx, midazID), log, ) @@ -611,19 +611,19 @@ func (cr *ConsumerRoutes) processIndividualMessage( libLog.String(libConstants.HeaderID, midazID), ) - msgCtx := libCommons.ContextWithLogger( - libCommons.ContextWithHeaderID(ctx, midazID), + msgCtx := libObservability.ContextWithLogger( + libObservability.ContextWithHeaderID(ctx, midazID), log, ) msgCtx = libOpentelemetry.ExtractTraceContextFromQueueHeaders(msgCtx, msg.Headers) - logger, tracer, reqID, _ := libCommons.NewTrackingFromContext(msgCtx) + logger, tracer, reqID, _ := libObservability.NewTrackingFromContext(msgCtx) msgCtx, span := tracer.Start(msgCtx, "rabbitmq.consumer.process_message_fallback") defer span.End() - msgCtx = libCommons.ContextWithSpanAttributes(msgCtx, attribute.String("app.request.request_id", reqID)) + msgCtx = libObservability.ContextWithSpanAttributes(msgCtx, attribute.String("app.request.request_id", reqID)) err := handler(msgCtx, msg.Body) if err != nil { diff --git a/components/ledger/internal/adapters/rabbitmq/consumer.rabbitmq_integration_test.go b/components/ledger/internal/adapters/rabbitmq/consumer.rabbitmq_integration_test.go index 40666c4d3..ac4feb200 100644 --- a/components/ledger/internal/adapters/rabbitmq/consumer.rabbitmq_integration_test.go +++ b/components/ledger/internal/adapters/rabbitmq/consumer.rabbitmq_integration_test.go @@ -15,9 +15,9 @@ import ( "testing" "time" - libOpentelemetry "github.com/LerianStudio/lib-commons/v5/commons/opentelemetry" + libOpentelemetry "github.com/LerianStudio/lib-observability/tracing" libRabbitmq "github.com/LerianStudio/lib-commons/v5/commons/rabbitmq" - libZap "github.com/LerianStudio/lib-commons/v5/commons/zap" + libZap "github.com/LerianStudio/lib-observability/zap" "github.com/LerianStudio/midaz/v3/tests/utils/chaos" rmqtestutil "github.com/LerianStudio/midaz/v3/tests/utils/rabbitmq" diff --git a/components/ledger/internal/adapters/rabbitmq/consumer.rabbitmq_test.go b/components/ledger/internal/adapters/rabbitmq/consumer.rabbitmq_test.go index 1dc3de2e2..e1ccaf3da 100644 --- a/components/ledger/internal/adapters/rabbitmq/consumer.rabbitmq_test.go +++ b/components/ledger/internal/adapters/rabbitmq/consumer.rabbitmq_test.go @@ -12,8 +12,8 @@ import ( libCommons "github.com/LerianStudio/lib-commons/v5/commons" libConstants "github.com/LerianStudio/lib-commons/v5/commons/constants" - libLog "github.com/LerianStudio/lib-commons/v5/commons/log" - libZap "github.com/LerianStudio/lib-commons/v5/commons/zap" + libLog "github.com/LerianStudio/lib-observability/log" + libZap "github.com/LerianStudio/lib-observability/zap" "github.com/google/uuid" amqp "github.com/rabbitmq/amqp091-go" "github.com/stretchr/testify/assert" diff --git a/components/ledger/internal/adapters/rabbitmq/healthcheck.go b/components/ledger/internal/adapters/rabbitmq/healthcheck.go index d0aa9dc90..873656650 100644 --- a/components/ledger/internal/adapters/rabbitmq/healthcheck.go +++ b/components/ledger/internal/adapters/rabbitmq/healthcheck.go @@ -11,7 +11,7 @@ import ( "time" libCircuitBreaker "github.com/LerianStudio/lib-commons/v5/commons/circuitbreaker" - libLog "github.com/LerianStudio/lib-commons/v5/commons/log" + libLog "github.com/LerianStudio/lib-observability/log" ) // ErrRabbitMQUnhealthy indicates the RabbitMQ broker health check failed. diff --git a/components/ledger/internal/adapters/rabbitmq/healthcheck_test.go b/components/ledger/internal/adapters/rabbitmq/healthcheck_test.go index 1173d466e..c817438c3 100644 --- a/components/ledger/internal/adapters/rabbitmq/healthcheck_test.go +++ b/components/ledger/internal/adapters/rabbitmq/healthcheck_test.go @@ -13,7 +13,7 @@ import ( "time" libCircuitBreaker "github.com/LerianStudio/lib-commons/v5/commons/circuitbreaker" - libLog "github.com/LerianStudio/lib-commons/v5/commons/log" + libLog "github.com/LerianStudio/lib-observability/log" "github.com/stretchr/testify/assert" "github.com/stretchr/testify/require" "go.uber.org/goleak" diff --git a/components/ledger/internal/adapters/rabbitmq/metric_state_listener.go b/components/ledger/internal/adapters/rabbitmq/metric_state_listener.go index e90142849..25e4a510a 100644 --- a/components/ledger/internal/adapters/rabbitmq/metric_state_listener.go +++ b/components/ledger/internal/adapters/rabbitmq/metric_state_listener.go @@ -9,7 +9,7 @@ import ( "errors" libCircuitBreaker "github.com/LerianStudio/lib-commons/v5/commons/circuitbreaker" - "github.com/LerianStudio/lib-commons/v5/commons/opentelemetry/metrics" + "github.com/LerianStudio/lib-observability/metrics" "github.com/LerianStudio/midaz/v3/pkg/utils" "go.opentelemetry.io/otel/attribute" ) diff --git a/components/ledger/internal/adapters/rabbitmq/metric_state_listener_test.go b/components/ledger/internal/adapters/rabbitmq/metric_state_listener_test.go index 08dfc0e2b..b549bdd4b 100644 --- a/components/ledger/internal/adapters/rabbitmq/metric_state_listener_test.go +++ b/components/ledger/internal/adapters/rabbitmq/metric_state_listener_test.go @@ -9,7 +9,7 @@ import ( "testing" libCircuitBreaker "github.com/LerianStudio/lib-commons/v5/commons/circuitbreaker" - "github.com/LerianStudio/lib-commons/v5/commons/opentelemetry/metrics" + "github.com/LerianStudio/lib-observability/metrics" "github.com/stretchr/testify/assert" "github.com/stretchr/testify/require" sdkmetric "go.opentelemetry.io/otel/sdk/metric" diff --git a/components/ledger/internal/adapters/rabbitmq/producer.circuitbreaker.go b/components/ledger/internal/adapters/rabbitmq/producer.circuitbreaker.go index af55ce37d..39602fdbc 100644 --- a/components/ledger/internal/adapters/rabbitmq/producer.circuitbreaker.go +++ b/components/ledger/internal/adapters/rabbitmq/producer.circuitbreaker.go @@ -10,7 +10,7 @@ import ( "time" libCircuitBreaker "github.com/LerianStudio/lib-commons/v5/commons/circuitbreaker" - libLog "github.com/LerianStudio/lib-commons/v5/commons/log" + libLog "github.com/LerianStudio/lib-observability/log" ) var ( diff --git a/components/ledger/internal/adapters/rabbitmq/producer.circuitbreaker_test.go b/components/ledger/internal/adapters/rabbitmq/producer.circuitbreaker_test.go index ca1c4c24c..7856296ab 100644 --- a/components/ledger/internal/adapters/rabbitmq/producer.circuitbreaker_test.go +++ b/components/ledger/internal/adapters/rabbitmq/producer.circuitbreaker_test.go @@ -11,7 +11,7 @@ import ( "time" libCircuitBreaker "github.com/LerianStudio/lib-commons/v5/commons/circuitbreaker" - libLog "github.com/LerianStudio/lib-commons/v5/commons/log" + libLog "github.com/LerianStudio/lib-observability/log" "github.com/stretchr/testify/assert" "github.com/stretchr/testify/require" "go.uber.org/mock/gomock" diff --git a/components/ledger/internal/adapters/rabbitmq/producer.multitenant.go b/components/ledger/internal/adapters/rabbitmq/producer.multitenant.go index ea9dae363..7da80cd2d 100644 --- a/components/ledger/internal/adapters/rabbitmq/producer.multitenant.go +++ b/components/ledger/internal/adapters/rabbitmq/producer.multitenant.go @@ -8,10 +8,10 @@ import ( "context" "fmt" - libCommons "github.com/LerianStudio/lib-commons/v5/commons" + libCommons "github.com/LerianStudio/lib-observability" libConstants "github.com/LerianStudio/lib-commons/v5/commons/constants" - libLog "github.com/LerianStudio/lib-commons/v5/commons/log" - libOpentelemetry "github.com/LerianStudio/lib-commons/v5/commons/opentelemetry" + libLog "github.com/LerianStudio/lib-observability/log" + libOpentelemetry "github.com/LerianStudio/lib-observability/tracing" tmcore "github.com/LerianStudio/lib-commons/v5/commons/tenant-manager/core" amqp "github.com/rabbitmq/amqp091-go" ) diff --git a/components/ledger/internal/adapters/rabbitmq/producer.multitenant_integration_test.go b/components/ledger/internal/adapters/rabbitmq/producer.multitenant_integration_test.go index 6ca39b4c8..6a93e5f61 100644 --- a/components/ledger/internal/adapters/rabbitmq/producer.multitenant_integration_test.go +++ b/components/ledger/internal/adapters/rabbitmq/producer.multitenant_integration_test.go @@ -24,7 +24,7 @@ import ( tmclient "github.com/LerianStudio/lib-commons/v5/commons/tenant-manager/client" tmcore "github.com/LerianStudio/lib-commons/v5/commons/tenant-manager/core" tmrabbitmq "github.com/LerianStudio/lib-commons/v5/commons/tenant-manager/rabbitmq" - libZap "github.com/LerianStudio/lib-commons/v5/commons/zap" + libZap "github.com/LerianStudio/lib-observability/zap" rmqtestutil "github.com/LerianStudio/midaz/v3/tests/utils/rabbitmq" amqp "github.com/rabbitmq/amqp091-go" diff --git a/components/ledger/internal/adapters/rabbitmq/producer.multitenant_test.go b/components/ledger/internal/adapters/rabbitmq/producer.multitenant_test.go index 07f5621ff..2140d70ad 100644 --- a/components/ledger/internal/adapters/rabbitmq/producer.multitenant_test.go +++ b/components/ledger/internal/adapters/rabbitmq/producer.multitenant_test.go @@ -10,7 +10,7 @@ import ( "testing" libConstants "github.com/LerianStudio/lib-commons/v5/commons/constants" - libLog "github.com/LerianStudio/lib-commons/v5/commons/log" + libLog "github.com/LerianStudio/lib-observability/log" tmcore "github.com/LerianStudio/lib-commons/v5/commons/tenant-manager/core" amqp "github.com/rabbitmq/amqp091-go" "github.com/stretchr/testify/assert" diff --git a/components/ledger/internal/adapters/rabbitmq/producer.rabbitmq.go b/components/ledger/internal/adapters/rabbitmq/producer.rabbitmq.go index 9ee1f26fc..82af50ea1 100644 --- a/components/ledger/internal/adapters/rabbitmq/producer.rabbitmq.go +++ b/components/ledger/internal/adapters/rabbitmq/producer.rabbitmq.go @@ -10,10 +10,10 @@ import ( "os" "strings" - libCommons "github.com/LerianStudio/lib-commons/v5/commons" + libCommons "github.com/LerianStudio/lib-observability" libConstants "github.com/LerianStudio/lib-commons/v5/commons/constants" - libLog "github.com/LerianStudio/lib-commons/v5/commons/log" - libOpentelemetry "github.com/LerianStudio/lib-commons/v5/commons/opentelemetry" + libLog "github.com/LerianStudio/lib-observability/log" + libOpentelemetry "github.com/LerianStudio/lib-observability/tracing" libRabbitmq "github.com/LerianStudio/lib-commons/v5/commons/rabbitmq" amqp "github.com/rabbitmq/amqp091-go" ) diff --git a/components/ledger/internal/adapters/rabbitmq/producer.rabbitmq_integration_test.go b/components/ledger/internal/adapters/rabbitmq/producer.rabbitmq_integration_test.go index bb52885dc..d809fb145 100644 --- a/components/ledger/internal/adapters/rabbitmq/producer.rabbitmq_integration_test.go +++ b/components/ledger/internal/adapters/rabbitmq/producer.rabbitmq_integration_test.go @@ -22,7 +22,7 @@ import ( "time" libRabbitmq "github.com/LerianStudio/lib-commons/v5/commons/rabbitmq" - libZap "github.com/LerianStudio/lib-commons/v5/commons/zap" + libZap "github.com/LerianStudio/lib-observability/zap" "github.com/LerianStudio/midaz/v3/tests/utils/chaos" rmqtestutil "github.com/LerianStudio/midaz/v3/tests/utils/rabbitmq" diff --git a/components/ledger/internal/adapters/redis/onboarding/consumer.redis.go b/components/ledger/internal/adapters/redis/onboarding/consumer.redis.go index e6076c24a..d11571e19 100644 --- a/components/ledger/internal/adapters/redis/onboarding/consumer.redis.go +++ b/components/ledger/internal/adapters/redis/onboarding/consumer.redis.go @@ -10,9 +10,9 @@ import ( "fmt" "time" - libCommons "github.com/LerianStudio/lib-commons/v5/commons" - libLog "github.com/LerianStudio/lib-commons/v5/commons/log" - libOpentelemetry "github.com/LerianStudio/lib-commons/v5/commons/opentelemetry" + libCommons "github.com/LerianStudio/lib-observability" + libLog "github.com/LerianStudio/lib-observability/log" + libOpentelemetry "github.com/LerianStudio/lib-observability/tracing" tmvalkey "github.com/LerianStudio/lib-commons/v5/commons/tenant-manager/valkey" "github.com/redis/go-redis/v9" ) diff --git a/components/ledger/internal/adapters/redis/transaction/balance/aggregation.go b/components/ledger/internal/adapters/redis/transaction/balance/aggregation.go index e3dfc1786..d22a70d9b 100644 --- a/components/ledger/internal/adapters/redis/transaction/balance/aggregation.go +++ b/components/ledger/internal/adapters/redis/transaction/balance/aggregation.go @@ -10,7 +10,7 @@ import ( "sort" "strings" - libCommons "github.com/LerianStudio/lib-commons/v5/commons" + libCommons "github.com/LerianStudio/lib-observability" "github.com/LerianStudio/midaz/v3/pkg/constant" "github.com/LerianStudio/midaz/v3/pkg/mmodel" "github.com/google/uuid" diff --git a/components/ledger/internal/adapters/redis/transaction/consumer.redis.go b/components/ledger/internal/adapters/redis/transaction/consumer.redis.go index fcaaf5c08..ec893524a 100644 --- a/components/ledger/internal/adapters/redis/transaction/consumer.redis.go +++ b/components/ledger/internal/adapters/redis/transaction/consumer.redis.go @@ -15,9 +15,9 @@ import ( "strings" "time" - libCommons "github.com/LerianStudio/lib-commons/v5/commons" - libLog "github.com/LerianStudio/lib-commons/v5/commons/log" - libOpentelemetry "github.com/LerianStudio/lib-commons/v5/commons/opentelemetry" + libCommons "github.com/LerianStudio/lib-observability" + libLog "github.com/LerianStudio/lib-observability/log" + libOpentelemetry "github.com/LerianStudio/lib-observability/tracing" tmvalkey "github.com/LerianStudio/lib-commons/v5/commons/tenant-manager/valkey" "github.com/LerianStudio/midaz/v3/pkg" "github.com/LerianStudio/midaz/v3/pkg/constant" @@ -825,7 +825,7 @@ func normalizeBalanceAtomicResult(result any) ([]byte, error) { } func collectBalanceSnapshots(ctx context.Context, balances balanceRedisList, mapBalances map[string]*mmodel.Balance, phase string) []*mmodel.Balance { - logger, _, _, _ := libCommons.NewTrackingFromContext(ctx) + logger := libCommons.NewLoggerFromContext(ctx) collected := make([]*mmodel.Balance, 0, len(balances)) for _, balanceRedis := range balances { diff --git a/components/ledger/internal/adapters/redis/transaction/consumer.redis_test.go b/components/ledger/internal/adapters/redis/transaction/consumer.redis_test.go index bc9972f75..c90c6b856 100644 --- a/components/ledger/internal/adapters/redis/transaction/consumer.redis_test.go +++ b/components/ledger/internal/adapters/redis/transaction/consumer.redis_test.go @@ -10,7 +10,7 @@ import ( "time" libCommons "github.com/LerianStudio/lib-commons/v5/commons" - libLog "github.com/LerianStudio/lib-commons/v5/commons/log" + libLog "github.com/LerianStudio/lib-observability/log" "github.com/LerianStudio/midaz/v3/pkg/constant" "github.com/LerianStudio/midaz/v3/pkg/mmodel" "github.com/LerianStudio/midaz/v3/pkg/mtransaction" diff --git a/components/ledger/internal/bootstrap/balance_sync.collector.go b/components/ledger/internal/bootstrap/balance_sync.collector.go index 487986c2d..7175ac9af 100644 --- a/components/ledger/internal/bootstrap/balance_sync.collector.go +++ b/components/ledger/internal/bootstrap/balance_sync.collector.go @@ -9,7 +9,7 @@ import ( "sync" "time" - libLog "github.com/LerianStudio/lib-commons/v5/commons/log" + libLog "github.com/LerianStudio/lib-observability/log" redisTransaction "github.com/LerianStudio/midaz/v3/components/ledger/internal/adapters/redis/transaction" ) diff --git a/components/ledger/internal/bootstrap/balance_sync.collector_test.go b/components/ledger/internal/bootstrap/balance_sync.collector_test.go index be0d4d966..a9ed48af6 100644 --- a/components/ledger/internal/bootstrap/balance_sync.collector_test.go +++ b/components/ledger/internal/bootstrap/balance_sync.collector_test.go @@ -12,7 +12,7 @@ import ( "testing" "time" - libLog "github.com/LerianStudio/lib-commons/v5/commons/log" + libLog "github.com/LerianStudio/lib-observability/log" redisTransaction "github.com/LerianStudio/midaz/v3/components/ledger/internal/adapters/redis/transaction" "github.com/stretchr/testify/assert" "github.com/stretchr/testify/require" diff --git a/components/ledger/internal/bootstrap/balance_sync.worker.go b/components/ledger/internal/bootstrap/balance_sync.worker.go index 185d9b504..72ed81d63 100644 --- a/components/ledger/internal/bootstrap/balance_sync.worker.go +++ b/components/ledger/internal/bootstrap/balance_sync.worker.go @@ -13,7 +13,8 @@ import ( "time" libCommons "github.com/LerianStudio/lib-commons/v5/commons" - libLog "github.com/LerianStudio/lib-commons/v5/commons/log" + libObservability "github.com/LerianStudio/lib-observability" + libLog "github.com/LerianStudio/lib-observability/log" tmcore "github.com/LerianStudio/lib-commons/v5/commons/tenant-manager/core" tmpostgres "github.com/LerianStudio/lib-commons/v5/commons/tenant-manager/postgres" "github.com/LerianStudio/lib-commons/v5/commons/tenant-manager/tenantcache" @@ -504,7 +505,7 @@ func (w *BalanceSyncWorker) processSyncBatch(ctx context.Context, organizationID ctx, cancel := context.WithTimeout(ctx, syncBatchTimeout) defer cancel() - _, tracer, _, metricFactory := libCommons.NewTrackingFromContext(ctx) + _, tracer, _, metricFactory := libObservability.NewTrackingFromContext(ctx) ctx, span := tracer.Start(ctx, "balance.worker.process_batch") defer span.End() diff --git a/components/ledger/internal/bootstrap/balance_sync.worker_test.go b/components/ledger/internal/bootstrap/balance_sync.worker_test.go index 0dd552abf..3daa0707e 100644 --- a/components/ledger/internal/bootstrap/balance_sync.worker_test.go +++ b/components/ledger/internal/bootstrap/balance_sync.worker_test.go @@ -11,7 +11,7 @@ import ( "time" libCommons "github.com/LerianStudio/lib-commons/v5/commons" - libLog "github.com/LerianStudio/lib-commons/v5/commons/log" + libLog "github.com/LerianStudio/lib-observability/log" "github.com/LerianStudio/midaz/v3/components/ledger/internal/services/command" "github.com/google/uuid" "github.com/stretchr/testify/assert" diff --git a/components/ledger/internal/bootstrap/circuitbreaker.go b/components/ledger/internal/bootstrap/circuitbreaker.go index c311853bb..70f2a0b47 100644 --- a/components/ledger/internal/bootstrap/circuitbreaker.go +++ b/components/ledger/internal/bootstrap/circuitbreaker.go @@ -14,7 +14,7 @@ import ( libCommons "github.com/LerianStudio/lib-commons/v5/commons" libCircuitBreaker "github.com/LerianStudio/lib-commons/v5/commons/circuitbreaker" - libLog "github.com/LerianStudio/lib-commons/v5/commons/log" + libLog "github.com/LerianStudio/lib-observability/log" libRabbitmq "github.com/LerianStudio/lib-commons/v5/commons/rabbitmq" "github.com/LerianStudio/midaz/v3/components/ledger/internal/adapters/rabbitmq" ) diff --git a/components/ledger/internal/bootstrap/circuitbreaker_test.go b/components/ledger/internal/bootstrap/circuitbreaker_test.go index d74b01afe..62698cb79 100644 --- a/components/ledger/internal/bootstrap/circuitbreaker_test.go +++ b/components/ledger/internal/bootstrap/circuitbreaker_test.go @@ -13,7 +13,7 @@ import ( "time" libCircuitBreaker "github.com/LerianStudio/lib-commons/v5/commons/circuitbreaker" - libLog "github.com/LerianStudio/lib-commons/v5/commons/log" + libLog "github.com/LerianStudio/lib-observability/log" libRabbitmq "github.com/LerianStudio/lib-commons/v5/commons/rabbitmq" "github.com/LerianStudio/midaz/v3/components/ledger/internal/adapters/rabbitmq" diff --git a/components/ledger/internal/bootstrap/config.go b/components/ledger/internal/bootstrap/config.go index 0e19135da..d02ec1f2d 100644 --- a/components/ledger/internal/bootstrap/config.go +++ b/components/ledger/internal/bootstrap/config.go @@ -16,9 +16,9 @@ import ( "github.com/LerianStudio/lib-auth/v2/auth/middleware" libCommons "github.com/LerianStudio/lib-commons/v5/commons" libCircuitBreaker "github.com/LerianStudio/lib-commons/v5/commons/circuitbreaker" - libLog "github.com/LerianStudio/lib-commons/v5/commons/log" - libOpentelemetry "github.com/LerianStudio/lib-commons/v5/commons/opentelemetry" - "github.com/LerianStudio/lib-commons/v5/commons/opentelemetry/metrics" + libLog "github.com/LerianStudio/lib-observability/log" + libOpentelemetry "github.com/LerianStudio/lib-observability/tracing" + "github.com/LerianStudio/lib-observability/metrics" libRedis "github.com/LerianStudio/lib-commons/v5/commons/redis" tmclient "github.com/LerianStudio/lib-commons/v5/commons/tenant-manager/client" tmcore "github.com/LerianStudio/lib-commons/v5/commons/tenant-manager/core" @@ -28,7 +28,7 @@ import ( tmpostgres "github.com/LerianStudio/lib-commons/v5/commons/tenant-manager/postgres" tmredis "github.com/LerianStudio/lib-commons/v5/commons/tenant-manager/redis" "github.com/LerianStudio/lib-commons/v5/commons/tenant-manager/tenantcache" - libZap "github.com/LerianStudio/lib-commons/v5/commons/zap" + libZap "github.com/LerianStudio/lib-observability/zap" httpin "github.com/LerianStudio/midaz/v3/components/ledger/internal/adapters/http/in" onbRedis "github.com/LerianStudio/midaz/v3/components/ledger/internal/adapters/redis/onboarding" txRedis "github.com/LerianStudio/midaz/v3/components/ledger/internal/adapters/redis/transaction" diff --git a/components/ledger/internal/bootstrap/config.mongo.onboarding.go b/components/ledger/internal/bootstrap/config.mongo.onboarding.go index f2d857a40..57c01ca86 100644 --- a/components/ledger/internal/bootstrap/config.mongo.onboarding.go +++ b/components/ledger/internal/bootstrap/config.mongo.onboarding.go @@ -11,7 +11,7 @@ import ( "strings" "time" - libLog "github.com/LerianStudio/lib-commons/v5/commons/log" + libLog "github.com/LerianStudio/lib-observability/log" libMongo "github.com/LerianStudio/lib-commons/v5/commons/mongo" tmmongo "github.com/LerianStudio/lib-commons/v5/commons/tenant-manager/mongo" mongodb "github.com/LerianStudio/midaz/v3/components/ledger/internal/adapters/mongodb/onboarding" diff --git a/components/ledger/internal/bootstrap/config.mongo.onboarding_test.go b/components/ledger/internal/bootstrap/config.mongo.onboarding_test.go index edd7d789d..5cadc63f1 100644 --- a/components/ledger/internal/bootstrap/config.mongo.onboarding_test.go +++ b/components/ledger/internal/bootstrap/config.mongo.onboarding_test.go @@ -7,7 +7,7 @@ package bootstrap import ( "testing" - libLog "github.com/LerianStudio/lib-commons/v5/commons/log" + libLog "github.com/LerianStudio/lib-observability/log" tmclient "github.com/LerianStudio/lib-commons/v5/commons/tenant-manager/client" "github.com/stretchr/testify/assert" "github.com/stretchr/testify/require" diff --git a/components/ledger/internal/bootstrap/config.mongo.transaction.go b/components/ledger/internal/bootstrap/config.mongo.transaction.go index f4aee234a..15f00d730 100644 --- a/components/ledger/internal/bootstrap/config.mongo.transaction.go +++ b/components/ledger/internal/bootstrap/config.mongo.transaction.go @@ -11,7 +11,7 @@ import ( "strings" "time" - libLog "github.com/LerianStudio/lib-commons/v5/commons/log" + libLog "github.com/LerianStudio/lib-observability/log" libMongo "github.com/LerianStudio/lib-commons/v5/commons/mongo" tmmongo "github.com/LerianStudio/lib-commons/v5/commons/tenant-manager/mongo" mongodb "github.com/LerianStudio/midaz/v3/components/ledger/internal/adapters/mongodb/transaction" diff --git a/components/ledger/internal/bootstrap/config.mongo.transaction_test.go b/components/ledger/internal/bootstrap/config.mongo.transaction_test.go index aee48e8ee..4fc76324e 100644 --- a/components/ledger/internal/bootstrap/config.mongo.transaction_test.go +++ b/components/ledger/internal/bootstrap/config.mongo.transaction_test.go @@ -7,7 +7,7 @@ package bootstrap import ( "testing" - libLog "github.com/LerianStudio/lib-commons/v5/commons/log" + libLog "github.com/LerianStudio/lib-observability/log" tmclient "github.com/LerianStudio/lib-commons/v5/commons/tenant-manager/client" "github.com/stretchr/testify/assert" "github.com/stretchr/testify/require" diff --git a/components/ledger/internal/bootstrap/config.postgres.onboarding.go b/components/ledger/internal/bootstrap/config.postgres.onboarding.go index 66808636e..8a3927eea 100644 --- a/components/ledger/internal/bootstrap/config.postgres.onboarding.go +++ b/components/ledger/internal/bootstrap/config.postgres.onboarding.go @@ -9,7 +9,7 @@ import ( "fmt" "time" - libLog "github.com/LerianStudio/lib-commons/v5/commons/log" + libLog "github.com/LerianStudio/lib-observability/log" libPostgres "github.com/LerianStudio/lib-commons/v5/commons/postgres" tmpostgres "github.com/LerianStudio/lib-commons/v5/commons/tenant-manager/postgres" "github.com/LerianStudio/midaz/v3/components/ledger/internal/adapters/postgres/account" diff --git a/components/ledger/internal/bootstrap/config.postgres.onboarding_chaos_test.go b/components/ledger/internal/bootstrap/config.postgres.onboarding_chaos_test.go index db76a5c0e..fa86ce864 100644 --- a/components/ledger/internal/bootstrap/config.postgres.onboarding_chaos_test.go +++ b/components/ledger/internal/bootstrap/config.postgres.onboarding_chaos_test.go @@ -32,7 +32,7 @@ import ( "time" tmclient "github.com/LerianStudio/lib-commons/v5/commons/tenant-manager/client" - libZap "github.com/LerianStudio/lib-commons/v5/commons/zap" + libZap "github.com/LerianStudio/lib-observability/zap" "github.com/LerianStudio/midaz/v3/tests/utils/chaos" pgtestutil "github.com/LerianStudio/midaz/v3/tests/utils/postgres" "github.com/stretchr/testify/assert" diff --git a/components/ledger/internal/bootstrap/config.postgres.onboarding_fuzz_test.go b/components/ledger/internal/bootstrap/config.postgres.onboarding_fuzz_test.go index 0f1a79caa..e041b4aca 100644 --- a/components/ledger/internal/bootstrap/config.postgres.onboarding_fuzz_test.go +++ b/components/ledger/internal/bootstrap/config.postgres.onboarding_fuzz_test.go @@ -25,7 +25,7 @@ import ( "strings" "testing" - libLog "github.com/LerianStudio/lib-commons/v5/commons/log" + libLog "github.com/LerianStudio/lib-observability/log" "github.com/stretchr/testify/assert" "github.com/stretchr/testify/require" ) diff --git a/components/ledger/internal/bootstrap/config.postgres.onboarding_integration_test.go b/components/ledger/internal/bootstrap/config.postgres.onboarding_integration_test.go index 62758d0ff..b6987498f 100644 --- a/components/ledger/internal/bootstrap/config.postgres.onboarding_integration_test.go +++ b/components/ledger/internal/bootstrap/config.postgres.onboarding_integration_test.go @@ -25,7 +25,7 @@ import ( libPostgres "github.com/LerianStudio/lib-commons/v5/commons/postgres" tmclient "github.com/LerianStudio/lib-commons/v5/commons/tenant-manager/client" - libZap "github.com/LerianStudio/lib-commons/v5/commons/zap" + libZap "github.com/LerianStudio/lib-observability/zap" pgtestutil "github.com/LerianStudio/midaz/v3/tests/utils/postgres" "github.com/stretchr/testify/assert" "github.com/stretchr/testify/require" diff --git a/components/ledger/internal/bootstrap/config.postgres.onboarding_property_test.go b/components/ledger/internal/bootstrap/config.postgres.onboarding_property_test.go index d42a547c7..fba2a415c 100644 --- a/components/ledger/internal/bootstrap/config.postgres.onboarding_property_test.go +++ b/components/ledger/internal/bootstrap/config.postgres.onboarding_property_test.go @@ -31,7 +31,7 @@ import ( "testing" "testing/quick" - libLog "github.com/LerianStudio/lib-commons/v5/commons/log" + libLog "github.com/LerianStudio/lib-observability/log" tmclient "github.com/LerianStudio/lib-commons/v5/commons/tenant-manager/client" "github.com/stretchr/testify/require" ) diff --git a/components/ledger/internal/bootstrap/config.postgres.onboarding_test.go b/components/ledger/internal/bootstrap/config.postgres.onboarding_test.go index 74b53411c..6eff5df2a 100644 --- a/components/ledger/internal/bootstrap/config.postgres.onboarding_test.go +++ b/components/ledger/internal/bootstrap/config.postgres.onboarding_test.go @@ -8,7 +8,7 @@ import ( "fmt" "testing" - libLog "github.com/LerianStudio/lib-commons/v5/commons/log" + libLog "github.com/LerianStudio/lib-observability/log" libPostgres "github.com/LerianStudio/lib-commons/v5/commons/postgres" "github.com/stretchr/testify/assert" "github.com/stretchr/testify/require" diff --git a/components/ledger/internal/bootstrap/config.postgres.transaction.go b/components/ledger/internal/bootstrap/config.postgres.transaction.go index 421adfbb8..931b4b7d9 100644 --- a/components/ledger/internal/bootstrap/config.postgres.transaction.go +++ b/components/ledger/internal/bootstrap/config.postgres.transaction.go @@ -9,7 +9,7 @@ import ( "fmt" "time" - libLog "github.com/LerianStudio/lib-commons/v5/commons/log" + libLog "github.com/LerianStudio/lib-observability/log" libPostgres "github.com/LerianStudio/lib-commons/v5/commons/postgres" tmpostgres "github.com/LerianStudio/lib-commons/v5/commons/tenant-manager/postgres" "github.com/LerianStudio/midaz/v3/components/ledger/internal/adapters/postgres/assetrate" diff --git a/components/ledger/internal/bootstrap/config.postgres.transaction_chaos_test.go b/components/ledger/internal/bootstrap/config.postgres.transaction_chaos_test.go index 49fad1bf2..c191d91f0 100644 --- a/components/ledger/internal/bootstrap/config.postgres.transaction_chaos_test.go +++ b/components/ledger/internal/bootstrap/config.postgres.transaction_chaos_test.go @@ -30,7 +30,7 @@ import ( "time" tmclient "github.com/LerianStudio/lib-commons/v5/commons/tenant-manager/client" - libZap "github.com/LerianStudio/lib-commons/v5/commons/zap" + libZap "github.com/LerianStudio/lib-observability/zap" "github.com/LerianStudio/midaz/v3/tests/utils/chaos" pgtestutil "github.com/LerianStudio/midaz/v3/tests/utils/postgres" "github.com/stretchr/testify/assert" diff --git a/components/ledger/internal/bootstrap/config.postgres.transaction_fuzz_test.go b/components/ledger/internal/bootstrap/config.postgres.transaction_fuzz_test.go index f8a9f8d39..2758fd02f 100644 --- a/components/ledger/internal/bootstrap/config.postgres.transaction_fuzz_test.go +++ b/components/ledger/internal/bootstrap/config.postgres.transaction_fuzz_test.go @@ -25,7 +25,7 @@ import ( "strings" "testing" - libLog "github.com/LerianStudio/lib-commons/v5/commons/log" + libLog "github.com/LerianStudio/lib-observability/log" "github.com/stretchr/testify/assert" "github.com/stretchr/testify/require" ) diff --git a/components/ledger/internal/bootstrap/config.postgres.transaction_integration_test.go b/components/ledger/internal/bootstrap/config.postgres.transaction_integration_test.go index ef9e2a903..d44206ce6 100644 --- a/components/ledger/internal/bootstrap/config.postgres.transaction_integration_test.go +++ b/components/ledger/internal/bootstrap/config.postgres.transaction_integration_test.go @@ -21,7 +21,7 @@ import ( libPostgres "github.com/LerianStudio/lib-commons/v5/commons/postgres" tmclient "github.com/LerianStudio/lib-commons/v5/commons/tenant-manager/client" - libZap "github.com/LerianStudio/lib-commons/v5/commons/zap" + libZap "github.com/LerianStudio/lib-observability/zap" pgtestutil "github.com/LerianStudio/midaz/v3/tests/utils/postgres" "github.com/stretchr/testify/assert" "github.com/stretchr/testify/require" diff --git a/components/ledger/internal/bootstrap/config.postgres.transaction_property_test.go b/components/ledger/internal/bootstrap/config.postgres.transaction_property_test.go index 8ab5cbddc..3bb0a6f8a 100644 --- a/components/ledger/internal/bootstrap/config.postgres.transaction_property_test.go +++ b/components/ledger/internal/bootstrap/config.postgres.transaction_property_test.go @@ -31,7 +31,7 @@ import ( "testing" "testing/quick" - libLog "github.com/LerianStudio/lib-commons/v5/commons/log" + libLog "github.com/LerianStudio/lib-observability/log" tmclient "github.com/LerianStudio/lib-commons/v5/commons/tenant-manager/client" "github.com/stretchr/testify/require" ) diff --git a/components/ledger/internal/bootstrap/config.postgres.transaction_test.go b/components/ledger/internal/bootstrap/config.postgres.transaction_test.go index 83d32a102..a030669b5 100644 --- a/components/ledger/internal/bootstrap/config.postgres.transaction_test.go +++ b/components/ledger/internal/bootstrap/config.postgres.transaction_test.go @@ -8,7 +8,7 @@ import ( "fmt" "testing" - libLog "github.com/LerianStudio/lib-commons/v5/commons/log" + libLog "github.com/LerianStudio/lib-observability/log" libPostgres "github.com/LerianStudio/lib-commons/v5/commons/postgres" "github.com/stretchr/testify/assert" "github.com/stretchr/testify/require" diff --git a/components/ledger/internal/bootstrap/config.rabbitmq.go b/components/ledger/internal/bootstrap/config.rabbitmq.go index c5f73bd08..4e6bfee5c 100644 --- a/components/ledger/internal/bootstrap/config.rabbitmq.go +++ b/components/ledger/internal/bootstrap/config.rabbitmq.go @@ -12,9 +12,9 @@ import ( "time" libCircuitBreaker "github.com/LerianStudio/lib-commons/v5/commons/circuitbreaker" - libLog "github.com/LerianStudio/lib-commons/v5/commons/log" - libOpentelemetry "github.com/LerianStudio/lib-commons/v5/commons/opentelemetry" - "github.com/LerianStudio/lib-commons/v5/commons/opentelemetry/metrics" + libLog "github.com/LerianStudio/lib-observability/log" + libOpentelemetry "github.com/LerianStudio/lib-observability/tracing" + "github.com/LerianStudio/lib-observability/metrics" libRabbitmq "github.com/LerianStudio/lib-commons/v5/commons/rabbitmq" tmconsumer "github.com/LerianStudio/lib-commons/v5/commons/tenant-manager/consumer" tmcore "github.com/LerianStudio/lib-commons/v5/commons/tenant-manager/core" diff --git a/components/ledger/internal/bootstrap/config.rabbitmq_test.go b/components/ledger/internal/bootstrap/config.rabbitmq_test.go index 0e493e415..781a34e53 100644 --- a/components/ledger/internal/bootstrap/config.rabbitmq_test.go +++ b/components/ledger/internal/bootstrap/config.rabbitmq_test.go @@ -8,7 +8,7 @@ import ( "context" "testing" - "github.com/LerianStudio/lib-commons/v5/commons/opentelemetry/metrics" + "github.com/LerianStudio/lib-observability/metrics" tmcore "github.com/LerianStudio/lib-commons/v5/commons/tenant-manager/core" "github.com/stretchr/testify/assert" "github.com/stretchr/testify/require" diff --git a/components/ledger/internal/bootstrap/config_runtime_test.go b/components/ledger/internal/bootstrap/config_runtime_test.go index 75d71eab4..f44f8309b 100644 --- a/components/ledger/internal/bootstrap/config_runtime_test.go +++ b/components/ledger/internal/bootstrap/config_runtime_test.go @@ -8,9 +8,9 @@ import ( "testing" "time" - libLog "github.com/LerianStudio/lib-commons/v5/commons/log" + libLog "github.com/LerianStudio/lib-observability/log" libRedis "github.com/LerianStudio/lib-commons/v5/commons/redis" - libZap "github.com/LerianStudio/lib-commons/v5/commons/zap" + libZap "github.com/LerianStudio/lib-observability/zap" "github.com/stretchr/testify/assert" "github.com/stretchr/testify/require" ) diff --git a/components/ledger/internal/bootstrap/config_test.go b/components/ledger/internal/bootstrap/config_test.go index 90d376e65..bb2deb141 100644 --- a/components/ledger/internal/bootstrap/config_test.go +++ b/components/ledger/internal/bootstrap/config_test.go @@ -13,7 +13,7 @@ import ( libCommons "github.com/LerianStudio/lib-commons/v5/commons" tmclient "github.com/LerianStudio/lib-commons/v5/commons/tenant-manager/client" - libZap "github.com/LerianStudio/lib-commons/v5/commons/zap" + libZap "github.com/LerianStudio/lib-observability/zap" "github.com/stretchr/testify/assert" "github.com/stretchr/testify/require" ) diff --git a/components/ledger/internal/bootstrap/onboarding_config_logger_test.go b/components/ledger/internal/bootstrap/onboarding_config_logger_test.go index e0f4d498f..e79ecb926 100644 --- a/components/ledger/internal/bootstrap/onboarding_config_logger_test.go +++ b/components/ledger/internal/bootstrap/onboarding_config_logger_test.go @@ -7,7 +7,7 @@ package bootstrap import ( "testing" - libZap "github.com/LerianStudio/lib-commons/v5/commons/zap" + libZap "github.com/LerianStudio/lib-observability/zap" "github.com/stretchr/testify/assert" ) diff --git a/components/ledger/internal/bootstrap/rabbitmq.multitenant.go b/components/ledger/internal/bootstrap/rabbitmq.multitenant.go index 3a35d012e..d9d063d42 100644 --- a/components/ledger/internal/bootstrap/rabbitmq.multitenant.go +++ b/components/ledger/internal/bootstrap/rabbitmq.multitenant.go @@ -11,7 +11,7 @@ import ( "syscall" libCommons "github.com/LerianStudio/lib-commons/v5/commons" - "github.com/LerianStudio/lib-commons/v5/commons/opentelemetry/metrics" + "github.com/LerianStudio/lib-observability/metrics" tmconsumer "github.com/LerianStudio/lib-commons/v5/commons/tenant-manager/consumer" "github.com/LerianStudio/midaz/v3/pkg/utils" ) diff --git a/components/ledger/internal/bootstrap/rabbitmq.server.go b/components/ledger/internal/bootstrap/rabbitmq.server.go index 539c3104b..6f28b3554 100644 --- a/components/ledger/internal/bootstrap/rabbitmq.server.go +++ b/components/ledger/internal/bootstrap/rabbitmq.server.go @@ -11,9 +11,10 @@ import ( "time" libCommons "github.com/LerianStudio/lib-commons/v5/commons" - libLog "github.com/LerianStudio/lib-commons/v5/commons/log" - libOpentelemetry "github.com/LerianStudio/lib-commons/v5/commons/opentelemetry" - "github.com/LerianStudio/lib-commons/v5/commons/opentelemetry/metrics" + libObservability "github.com/LerianStudio/lib-observability" + libLog "github.com/LerianStudio/lib-observability/log" + libOpentelemetry "github.com/LerianStudio/lib-observability/tracing" + "github.com/LerianStudio/lib-observability/metrics" "github.com/LerianStudio/midaz/v3/components/ledger/internal/adapters/postgres/transaction" "github.com/LerianStudio/midaz/v3/components/ledger/internal/adapters/rabbitmq" "github.com/LerianStudio/midaz/v3/components/ledger/internal/services/command" @@ -66,11 +67,16 @@ func (mq *MultiQueueConsumer) handlerBTOQueue(ctx context.Context, body []byte) // Extracted as a package-level function so both the single-tenant MultiQueueConsumer // and the multi-tenant consumer can reuse the same logic. func handlerBTO(ctx context.Context, body []byte, useCase *command.UseCase) error { - logger, tracer, _, _ := libCommons.NewTrackingFromContext(ctx) + logger, tracer, _, _ := libObservability.NewTrackingFromContext(ctx) ctx, span := tracer.Start(ctx, "consumer.handler_balance_update") defer span.End() + if err := ctx.Err(); err != nil { + libOpentelemetry.HandleSpanError(span, "Context cancelled before processing", err) + return err + } + logger.Log(ctx, libLog.LevelInfo, "Processing message from balance_retry_queue_fifo") var message mmodel.Queue @@ -108,11 +114,16 @@ func (mq *MultiQueueConsumer) handlerBTOBulkQueue(ctx context.Context, messages // It unmarshals all messages, extracts payloads, and calls CreateBulkTransactionOperationsAsync. // The metricsFactory parameter can be nil when telemetry is disabled. func handlerBTOBulk(ctx context.Context, messages []amqp.Delivery, useCase *command.UseCase, metricsFactory *metrics.MetricsFactory) ([]rabbitmq.BulkMessageResult, error) { - logger, tracer, _, _ := libCommons.NewTrackingFromContext(ctx) + logger, tracer, _, _ := libObservability.NewTrackingFromContext(ctx) ctx, span := tracer.Start(ctx, "consumer.handler_balance_update_bulk") defer span.End() + if err := ctx.Err(); err != nil { + libOpentelemetry.HandleSpanError(span, "Context cancelled before processing", err) + return nil, err + } + startTime := time.Now() logger.Log(ctx, libLog.LevelInfo, fmt.Sprintf("Processing bulk of %d messages from balance_queue", len(messages))) diff --git a/components/ledger/internal/bootstrap/rabbitmq.server_integration_test.go b/components/ledger/internal/bootstrap/rabbitmq.server_integration_test.go index eaecd1db5..311b0b9a4 100644 --- a/components/ledger/internal/bootstrap/rabbitmq.server_integration_test.go +++ b/components/ledger/internal/bootstrap/rabbitmq.server_integration_test.go @@ -12,10 +12,10 @@ import ( "testing" "time" - libCommons "github.com/LerianStudio/lib-commons/v5/commons" - libOpentelemetry "github.com/LerianStudio/lib-commons/v5/commons/opentelemetry" + libCommons "github.com/LerianStudio/lib-observability" + libOpentelemetry "github.com/LerianStudio/lib-observability/tracing" libRabbitmq "github.com/LerianStudio/lib-commons/v5/commons/rabbitmq" - libZap "github.com/LerianStudio/lib-commons/v5/commons/zap" + libZap "github.com/LerianStudio/lib-observability/zap" mongodb "github.com/LerianStudio/midaz/v3/components/ledger/internal/adapters/mongodb/transaction" "github.com/LerianStudio/midaz/v3/components/ledger/internal/adapters/postgres/balance" "github.com/LerianStudio/midaz/v3/components/ledger/internal/adapters/postgres/operation" diff --git a/components/ledger/internal/bootstrap/readyz.go b/components/ledger/internal/bootstrap/readyz.go index bc14581a1..b8a53d985 100644 --- a/components/ledger/internal/bootstrap/readyz.go +++ b/components/ledger/internal/bootstrap/readyz.go @@ -12,8 +12,8 @@ import ( "time" libCircuitBreaker "github.com/LerianStudio/lib-commons/v5/commons/circuitbreaker" - libLog "github.com/LerianStudio/lib-commons/v5/commons/log" - "github.com/LerianStudio/lib-commons/v5/commons/opentelemetry/metrics" + libLog "github.com/LerianStudio/lib-observability/log" + "github.com/LerianStudio/lib-observability/metrics" libRedis "github.com/LerianStudio/lib-commons/v5/commons/redis" "github.com/LerianStudio/midaz/v3/pkg/utils" "github.com/gofiber/fiber/v2" diff --git a/components/ledger/internal/bootstrap/readyz_checkers.go b/components/ledger/internal/bootstrap/readyz_checkers.go index 2d3980e52..9c3c7c80d 100644 --- a/components/ledger/internal/bootstrap/readyz_checkers.go +++ b/components/ledger/internal/bootstrap/readyz_checkers.go @@ -13,7 +13,7 @@ import ( "time" libCircuitBreaker "github.com/LerianStudio/lib-commons/v5/commons/circuitbreaker" - libLog "github.com/LerianStudio/lib-commons/v5/commons/log" + libLog "github.com/LerianStudio/lib-observability/log" libMongo "github.com/LerianStudio/lib-commons/v5/commons/mongo" libPostgres "github.com/LerianStudio/lib-commons/v5/commons/postgres" libRedis "github.com/LerianStudio/lib-commons/v5/commons/redis" diff --git a/components/ledger/internal/bootstrap/readyz_general_test.go b/components/ledger/internal/bootstrap/readyz_general_test.go index 5d85292df..9c5263568 100644 --- a/components/ledger/internal/bootstrap/readyz_general_test.go +++ b/components/ledger/internal/bootstrap/readyz_general_test.go @@ -18,7 +18,7 @@ import ( "time" libCircuitBreaker "github.com/LerianStudio/lib-commons/v5/commons/circuitbreaker" - libLog "github.com/LerianStudio/lib-commons/v5/commons/log" + libLog "github.com/LerianStudio/lib-observability/log" "github.com/gofiber/fiber/v2" "github.com/stretchr/testify/assert" "github.com/stretchr/testify/require" diff --git a/components/ledger/internal/bootstrap/readyz_integration_test.go b/components/ledger/internal/bootstrap/readyz_integration_test.go index 02516e4bb..e6adb8ecf 100644 --- a/components/ledger/internal/bootstrap/readyz_integration_test.go +++ b/components/ledger/internal/bootstrap/readyz_integration_test.go @@ -14,7 +14,7 @@ import ( "net/http/httptest" "testing" - libLog "github.com/LerianStudio/lib-commons/v5/commons/log" + libLog "github.com/LerianStudio/lib-observability/log" "github.com/gofiber/fiber/v2" "github.com/stretchr/testify/assert" "github.com/stretchr/testify/require" diff --git a/components/ledger/internal/bootstrap/readyz_test.go b/components/ledger/internal/bootstrap/readyz_test.go index 40a330f01..d34e1b926 100644 --- a/components/ledger/internal/bootstrap/readyz_test.go +++ b/components/ledger/internal/bootstrap/readyz_test.go @@ -13,7 +13,7 @@ import ( "testing" "time" - libLog "github.com/LerianStudio/lib-commons/v5/commons/log" + libLog "github.com/LerianStudio/lib-observability/log" "github.com/gofiber/fiber/v2" "github.com/stretchr/testify/assert" "github.com/stretchr/testify/require" diff --git a/components/ledger/internal/bootstrap/redis.consumer.go b/components/ledger/internal/bootstrap/redis.consumer.go index 959f3d713..79a087b20 100644 --- a/components/ledger/internal/bootstrap/redis.consumer.go +++ b/components/ledger/internal/bootstrap/redis.consumer.go @@ -15,9 +15,10 @@ import ( "time" libCommons "github.com/LerianStudio/lib-commons/v5/commons" + libObservability "github.com/LerianStudio/lib-observability" libConstants "github.com/LerianStudio/lib-commons/v5/commons/constants" - libLog "github.com/LerianStudio/lib-commons/v5/commons/log" - libOpentelemetry "github.com/LerianStudio/lib-commons/v5/commons/opentelemetry" + libLog "github.com/LerianStudio/lib-observability/log" + libOpentelemetry "github.com/LerianStudio/lib-observability/tracing" tmcore "github.com/LerianStudio/lib-commons/v5/commons/tenant-manager/core" tmpostgres "github.com/LerianStudio/lib-commons/v5/commons/tenant-manager/postgres" "github.com/LerianStudio/lib-commons/v5/commons/tenant-manager/tenantcache" @@ -248,7 +249,7 @@ func podIdentifier() string { } func (r *RedisQueueConsumer) readMessagesAndProcess(ctx context.Context) { - _, tracer, _, _ := libCommons.NewTrackingFromContext(ctx) //nolint:dogsled + _, tracer, _, _ := libObservability.NewTrackingFromContext(ctx) //nolint:dogsled ctx, span := tracer.Start(ctx, "redis.consumer.read_messages_from_queue") defer span.End() @@ -319,16 +320,18 @@ Outer: // and operations, and writes the transaction via the async path. // Duplicate-processing prevention is handled at the cycle level by acquireCycleLock; // only the leader pod reaches this method. +// +//nolint:gocognit,gocyclo // Will be refactored into smaller helpers; tracked separately. func (r *RedisQueueConsumer) processMessage(ctx context.Context, key string, m mmodel.TransactionRedisQueue) { - _, tracer, _, _ := libCommons.NewTrackingFromContext(ctx) //nolint:dogsled + _, tracer, _, _ := libObservability.NewTrackingFromContext(ctx) //nolint:dogsled msgCtx, cancel := context.WithTimeout(ctx, 30*time.Second) defer cancel() logger := r.Logger.With(libLog.String(libConstants.HeaderID, m.HeaderID)) - ctxWithLogger := libCommons.ContextWithLogger( - libCommons.ContextWithHeaderID(msgCtx, m.HeaderID), + ctxWithLogger := libObservability.ContextWithLogger( + libObservability.ContextWithHeaderID(msgCtx, m.HeaderID), logger, ) @@ -418,7 +421,7 @@ func (r *RedisQueueConsumer) processMessage(ctx context.Context, key string, m m ChartOfAccountsGroupName: m.TransactionInput.ChartOfAccountsGroupName, CreatedAt: m.TransactionDate, UpdatedAt: time.Now(), - Route: m.TransactionInput.Route, + Route: m.TransactionInput.Route, //nolint:staticcheck // legacy field kept for backward compatibility; RouteID is canonical RouteID: m.TransactionInput.RouteID, Metadata: m.TransactionInput.Metadata, Status: postgreTransaction.Status{ diff --git a/components/ledger/internal/bootstrap/service.go b/components/ledger/internal/bootstrap/service.go index 86e933777..cff4369b2 100644 --- a/components/ledger/internal/bootstrap/service.go +++ b/components/ledger/internal/bootstrap/service.go @@ -11,9 +11,9 @@ import ( "syscall" libCommons "github.com/LerianStudio/lib-commons/v5/commons" - libLog "github.com/LerianStudio/lib-commons/v5/commons/log" - libOpentelemetry "github.com/LerianStudio/lib-commons/v5/commons/opentelemetry" - "github.com/LerianStudio/lib-commons/v5/commons/opentelemetry/metrics" + libLog "github.com/LerianStudio/lib-observability/log" + libOpentelemetry "github.com/LerianStudio/lib-observability/tracing" + "github.com/LerianStudio/lib-observability/metrics" tmconsumer "github.com/LerianStudio/lib-commons/v5/commons/tenant-manager/consumer" tmevent "github.com/LerianStudio/lib-commons/v5/commons/tenant-manager/event" ) diff --git a/components/ledger/internal/bootstrap/service_test.go b/components/ledger/internal/bootstrap/service_test.go index b080cb8cb..a81721a4e 100644 --- a/components/ledger/internal/bootstrap/service_test.go +++ b/components/ledger/internal/bootstrap/service_test.go @@ -11,7 +11,7 @@ import ( "testing" libCommons "github.com/LerianStudio/lib-commons/v5/commons" - libOpentelemetry "github.com/LerianStudio/lib-commons/v5/commons/opentelemetry" + libOpentelemetry "github.com/LerianStudio/lib-observability/tracing" tmcore "github.com/LerianStudio/lib-commons/v5/commons/tenant-manager/core" tmmiddleware "github.com/LerianStudio/lib-commons/v5/commons/tenant-manager/middleware" "github.com/gofiber/fiber/v2" diff --git a/components/ledger/internal/bootstrap/streaming.go b/components/ledger/internal/bootstrap/streaming.go index e160d2a26..e9b5cfa8d 100644 --- a/components/ledger/internal/bootstrap/streaming.go +++ b/components/ledger/internal/bootstrap/streaming.go @@ -9,8 +9,8 @@ import ( "fmt" "strings" - libLog "github.com/LerianStudio/lib-commons/v5/commons/log" - libOpentelemetry "github.com/LerianStudio/lib-commons/v5/commons/opentelemetry" + libLog "github.com/LerianStudio/lib-observability/log" + libOpentelemetry "github.com/LerianStudio/lib-observability/tracing" libStreaming "github.com/LerianStudio/lib-streaming" "github.com/LerianStudio/midaz/v3/pkg/streaming/events" "github.com/twmb/franz-go/pkg/sasl" @@ -113,10 +113,7 @@ func BuildStreamingEmitter( // Build the route table. One required route per event keyed to the // canonical "lerian.streaming.." topic name. - routes, err := buildRoutes(streamingPrimaryTargetName) - if err != nil { - return nil, noopStreamingCloser, fmt.Errorf("failed to build streaming routes: %w", err) - } + routes := buildRoutes(streamingPrimaryTargetName) builder := libStreaming.NewBuilder(). Source(streamingCfg.CloudEventsSource). @@ -302,7 +299,7 @@ func buildCatalog() (libStreaming.Catalog, error) { // dot-delimited pattern, and the target-name suffix guarantees uniqueness // when the same event is later routed to multiple targets (e.g. a parallel // shadow route). -func buildRoutes(targetName string) ([]libStreaming.RouteDefinition, error) { +func buildRoutes(targetName string) []libStreaming.RouteDefinition { defs := midazEventDefinitions() routes := make([]libStreaming.RouteDefinition, 0, len(defs)) @@ -317,5 +314,5 @@ func buildRoutes(targetName string) ([]libStreaming.RouteDefinition, error) { }) } - return routes, nil + return routes } diff --git a/components/ledger/internal/bootstrap/unified-server.go b/components/ledger/internal/bootstrap/unified-server.go index 504f1f107..8ba7c022d 100644 --- a/components/ledger/internal/bootstrap/unified-server.go +++ b/components/ledger/internal/bootstrap/unified-server.go @@ -10,9 +10,10 @@ import ( "time" libCommons "github.com/LerianStudio/lib-commons/v5/commons" - libLog "github.com/LerianStudio/lib-commons/v5/commons/log" + libLog "github.com/LerianStudio/lib-observability/log" libHTTP "github.com/LerianStudio/lib-commons/v5/commons/net/http" - libOpentelemetry "github.com/LerianStudio/lib-commons/v5/commons/opentelemetry" + libObsMiddleware "github.com/LerianStudio/lib-observability/middleware" + libOpentelemetry "github.com/LerianStudio/lib-observability/tracing" libCommonsServer "github.com/LerianStudio/lib-commons/v5/commons/server" _ "github.com/LerianStudio/midaz/v3/components/ledger/api" "github.com/gofiber/fiber/v2" @@ -52,10 +53,10 @@ func NewUnifiedServer( }) // Add common middleware (only once for all routes) - tlMid := libHTTP.NewTelemetryMiddleware(telemetry) + tlMid := libObsMiddleware.NewTelemetryMiddleware(telemetry) app.Use(tlMid.WithTelemetry(telemetry)) app.Use(cors.New()) - app.Use(libHTTP.WithHTTPLogging(libHTTP.WithCustomLogger(logger))) + app.Use(libObsMiddleware.WithHTTPLogging(libObsMiddleware.WithCustomLogger(logger))) // Health check for the unified server app.Get("/health", libHTTP.Ping) diff --git a/components/ledger/internal/services/command/create_account.go b/components/ledger/internal/services/command/create_account.go index 78b97887d..6632bfafb 100644 --- a/components/ledger/internal/services/command/create_account.go +++ b/components/ledger/internal/services/command/create_account.go @@ -11,8 +11,9 @@ import ( "time" libCommons "github.com/LerianStudio/lib-commons/v5/commons" - libLog "github.com/LerianStudio/lib-commons/v5/commons/log" - libOpentelemetry "github.com/LerianStudio/lib-commons/v5/commons/opentelemetry" + libObservability "github.com/LerianStudio/lib-observability" + libLog "github.com/LerianStudio/lib-observability/log" + libOpentelemetry "github.com/LerianStudio/lib-observability/tracing" libStreaming "github.com/LerianStudio/lib-streaming" "github.com/LerianStudio/midaz/v3/components/ledger/internal/services" "github.com/LerianStudio/midaz/v3/pkg" @@ -27,8 +28,10 @@ import ( // CreateAccount creates an account and metadata, then synchronously creates the default balance. // The balance is created via the BalancePort interface. +// +//nolint:gocyclo // Validation + creation + metadata + balance orchestration; refactor candidate. func (uc *UseCase) CreateAccount(ctx context.Context, organizationID, ledgerID uuid.UUID, cai *mmodel.CreateAccountInput, token string) (*mmodel.Account, error) { - logger, tracer, requestID, _ := libCommons.NewTrackingFromContext(ctx) + logger, tracer, requestID, _ := libObservability.NewTrackingFromContext(ctx) ctx, span := tracer.Start(ctx, "command.create_account") defer span.End() @@ -253,7 +256,7 @@ func (uc *UseCase) determineStatus(cai *mmodel.CreateAccountInput) mmodel.Status // account types for this ledger. Only runs when validateAccountType is enabled // in the ledger settings. External accounts are always allowed. func (uc *UseCase) applyAccountingValidations(ctx context.Context, organizationID, ledgerID uuid.UUID, accountType string) error { - logger, tracer, _, _ := libCommons.NewTrackingFromContext(ctx) + logger, tracer, _, _ := libObservability.NewTrackingFromContext(ctx) ctx, span := tracer.Start(ctx, "command.apply_accounting_validations") defer span.End() diff --git a/components/ledger/internal/services/command/create_account_type.go b/components/ledger/internal/services/command/create_account_type.go index f4e1d8401..1613b4b3b 100644 --- a/components/ledger/internal/services/command/create_account_type.go +++ b/components/ledger/internal/services/command/create_account_type.go @@ -9,8 +9,9 @@ import ( "time" libCommons "github.com/LerianStudio/lib-commons/v5/commons" - libLog "github.com/LerianStudio/lib-commons/v5/commons/log" - libOpentelemetry "github.com/LerianStudio/lib-commons/v5/commons/opentelemetry" + libObservability "github.com/LerianStudio/lib-observability" + libLog "github.com/LerianStudio/lib-observability/log" + libOpentelemetry "github.com/LerianStudio/lib-observability/tracing" "github.com/LerianStudio/midaz/v3/pkg/constant" "github.com/LerianStudio/midaz/v3/pkg/mmodel" "github.com/google/uuid" @@ -23,7 +24,7 @@ import ( // internal validation config; the type label is broadcast as a string // field on account.* events. func (uc *UseCase) CreateAccountType(ctx context.Context, organizationID, ledgerID uuid.UUID, payload *mmodel.CreateAccountTypeInput) (*mmodel.AccountType, error) { - logger, tracer, _, _ := libCommons.NewTrackingFromContext(ctx) + logger, tracer, _, _ := libObservability.NewTrackingFromContext(ctx) ctx, span := tracer.Start(ctx, "command.create_account_type") defer span.End() diff --git a/components/ledger/internal/services/command/create_asset.go b/components/ledger/internal/services/command/create_asset.go index 08de387ad..d9c8931d4 100644 --- a/components/ledger/internal/services/command/create_asset.go +++ b/components/ledger/internal/services/command/create_asset.go @@ -12,8 +12,9 @@ import ( "time" libCommons "github.com/LerianStudio/lib-commons/v5/commons" - libLog "github.com/LerianStudio/lib-commons/v5/commons/log" - libOpentelemetry "github.com/LerianStudio/lib-commons/v5/commons/opentelemetry" + libObservability "github.com/LerianStudio/lib-observability" + libLog "github.com/LerianStudio/lib-observability/log" + libOpentelemetry "github.com/LerianStudio/lib-observability/tracing" libStreaming "github.com/LerianStudio/lib-streaming" "github.com/LerianStudio/midaz/v3/pkg" "github.com/LerianStudio/midaz/v3/pkg/constant" @@ -30,7 +31,7 @@ import ( // creates the default balance for that account. // The balance is created via the BalancePort interface. func (uc *UseCase) CreateAsset(ctx context.Context, organizationID, ledgerID uuid.UUID, cii *mmodel.CreateAssetInput, token string) (*mmodel.Asset, error) { - logger, tracer, requestID, _ := libCommons.NewTrackingFromContext(ctx) + logger, tracer, requestID, _ := libObservability.NewTrackingFromContext(ctx) ctx, span := tracer.Start(ctx, "command.create_asset") defer span.End() @@ -205,7 +206,7 @@ func (uc *UseCase) CreateAsset(ctx context.Context, organizationID, ledgerID uui // validateAssetCode checks the provided asset code and maps validation errors to business errors. func (uc *UseCase) validateAssetCode(ctx context.Context, code string) error { - logger, tracer, _, _ := libCommons.NewTrackingFromContext(ctx) + logger, tracer, _, _ := libObservability.NewTrackingFromContext(ctx) ctx, span := tracer.Start(ctx, "command.validate_asset_code") defer span.End() diff --git a/components/ledger/internal/services/command/create_assetrate.go b/components/ledger/internal/services/command/create_assetrate.go index 8a6b370a1..08aa325eb 100644 --- a/components/ledger/internal/services/command/create_assetrate.go +++ b/components/ledger/internal/services/command/create_assetrate.go @@ -11,7 +11,8 @@ import ( "time" libCommons "github.com/LerianStudio/lib-commons/v5/commons" - libOpentelemetry "github.com/LerianStudio/lib-commons/v5/commons/opentelemetry" + libObservability "github.com/LerianStudio/lib-observability" + libOpentelemetry "github.com/LerianStudio/lib-observability/tracing" mongodb "github.com/LerianStudio/midaz/v3/components/ledger/internal/adapters/mongodb/transaction" "github.com/LerianStudio/midaz/v3/components/ledger/internal/adapters/postgres/assetrate" "github.com/LerianStudio/midaz/v3/pkg" @@ -19,11 +20,11 @@ import ( "github.com/google/uuid" // CreateOrUpdateAssetRate creates or updates an asset rate. - libLog "github.com/LerianStudio/lib-commons/v5/commons/log" + libLog "github.com/LerianStudio/lib-observability/log" ) func (uc *UseCase) CreateOrUpdateAssetRate(ctx context.Context, organizationID, ledgerID uuid.UUID, cari *assetrate.CreateAssetRateInput) (*assetrate.AssetRate, error) { - logger, tracer, _, _ := libCommons.NewTrackingFromContext(ctx) + logger, tracer, _, _ := libObservability.NewTrackingFromContext(ctx) ctx, span := tracer.Start(ctx, "command.create_or_update_asset_rate") defer span.End() diff --git a/components/ledger/internal/services/command/create_balance.go b/components/ledger/internal/services/command/create_balance.go index 6b72a226e..a3a373c40 100644 --- a/components/ledger/internal/services/command/create_balance.go +++ b/components/ledger/internal/services/command/create_balance.go @@ -9,8 +9,9 @@ import ( "time" libCommons "github.com/LerianStudio/lib-commons/v5/commons" - libLog "github.com/LerianStudio/lib-commons/v5/commons/log" - libOpentelemetry "github.com/LerianStudio/lib-commons/v5/commons/opentelemetry" + libObservability "github.com/LerianStudio/lib-observability" + libLog "github.com/LerianStudio/lib-observability/log" + libOpentelemetry "github.com/LerianStudio/lib-observability/tracing" "github.com/LerianStudio/midaz/v3/pkg" "github.com/LerianStudio/midaz/v3/pkg/constant" "github.com/LerianStudio/midaz/v3/pkg/mmodel" @@ -29,7 +30,7 @@ import ( // CreateAsset; it is not exposed via an HTTP route. The input's Key field // is ignored — the contract is encoded in the function name. func (uc *UseCase) CreateDefaultBalance(ctx context.Context, input mmodel.CreateBalanceInput) (*mmodel.Balance, error) { - logger, tracer, _, _ := libCommons.NewTrackingFromContext(ctx) + logger, tracer, _, _ := libObservability.NewTrackingFromContext(ctx) ctx, span := tracer.Start(ctx, "command.create_default_balance") defer span.End() diff --git a/components/ledger/internal/services/command/create_balance_additional.go b/components/ledger/internal/services/command/create_balance_additional.go index b325c6932..116daec7e 100644 --- a/components/ledger/internal/services/command/create_balance_additional.go +++ b/components/ledger/internal/services/command/create_balance_additional.go @@ -13,8 +13,9 @@ import ( "time" libCommons "github.com/LerianStudio/lib-commons/v5/commons" - libLog "github.com/LerianStudio/lib-commons/v5/commons/log" - libOpentelemetry "github.com/LerianStudio/lib-commons/v5/commons/opentelemetry" + libObservability "github.com/LerianStudio/lib-observability" + libLog "github.com/LerianStudio/lib-observability/log" + libOpentelemetry "github.com/LerianStudio/lib-observability/tracing" libStreaming "github.com/LerianStudio/lib-streaming" "github.com/LerianStudio/midaz/v3/pkg" "github.com/LerianStudio/midaz/v3/pkg/constant" @@ -31,8 +32,9 @@ const ( balanceAliasKeyUniqueIndex = "idx_unique_balance_alias_key" ) +//nolint:gocyclo // Validation + parent lookup + uniqueness + creation; refactor candidate. func (uc *UseCase) CreateAdditionalBalance(ctx context.Context, organizationID, ledgerID, accountID uuid.UUID, cbi *mmodel.CreateAdditionalBalance) (*mmodel.Balance, error) { - logger, tracer, _, _ := libCommons.NewTrackingFromContext(ctx) + logger, tracer, _, _ := libObservability.NewTrackingFromContext(ctx) ctx, span := tracer.Start(ctx, "command.create_additional_balance") defer span.End() diff --git a/components/ledger/internal/services/command/create_balance_transaction_operations_async.go b/components/ledger/internal/services/command/create_balance_transaction_operations_async.go index 40b8ed180..570081626 100644 --- a/components/ledger/internal/services/command/create_balance_transaction_operations_async.go +++ b/components/ledger/internal/services/command/create_balance_transaction_operations_async.go @@ -13,9 +13,9 @@ import ( "strings" "time" - libCommons "github.com/LerianStudio/lib-commons/v5/commons" - libLog "github.com/LerianStudio/lib-commons/v5/commons/log" - libOpentelemetry "github.com/LerianStudio/lib-commons/v5/commons/opentelemetry" + libCommons "github.com/LerianStudio/lib-observability" + libLog "github.com/LerianStudio/lib-observability/log" + libOpentelemetry "github.com/LerianStudio/lib-observability/tracing" mongodb "github.com/LerianStudio/midaz/v3/components/ledger/internal/adapters/mongodb/transaction" "github.com/LerianStudio/midaz/v3/components/ledger/internal/adapters/postgres/operation" "github.com/LerianStudio/midaz/v3/components/ledger/internal/adapters/postgres/transaction" diff --git a/components/ledger/internal/services/command/create_balance_transaction_operations_async_test.go b/components/ledger/internal/services/command/create_balance_transaction_operations_async_test.go index d92fbdcbc..e6def8cc0 100644 --- a/components/ledger/internal/services/command/create_balance_transaction_operations_async_test.go +++ b/components/ledger/internal/services/command/create_balance_transaction_operations_async_test.go @@ -10,7 +10,7 @@ import ( "errors" "testing" - libLog "github.com/LerianStudio/lib-commons/v5/commons/log" + libLog "github.com/LerianStudio/lib-observability/log" mongodb "github.com/LerianStudio/midaz/v3/components/ledger/internal/adapters/mongodb/transaction" "github.com/LerianStudio/midaz/v3/components/ledger/internal/adapters/postgres/balance" "github.com/LerianStudio/midaz/v3/components/ledger/internal/adapters/postgres/operation" diff --git a/components/ledger/internal/services/command/create_bulk_transaction_operations_async.go b/components/ledger/internal/services/command/create_bulk_transaction_operations_async.go index 0cfa6c9d1..e7155acd5 100644 --- a/components/ledger/internal/services/command/create_bulk_transaction_operations_async.go +++ b/components/ledger/internal/services/command/create_bulk_transaction_operations_async.go @@ -13,9 +13,9 @@ import ( "strings" "time" - libCommons "github.com/LerianStudio/lib-commons/v5/commons" - libLog "github.com/LerianStudio/lib-commons/v5/commons/log" - libOpentelemetry "github.com/LerianStudio/lib-commons/v5/commons/opentelemetry" + libCommons "github.com/LerianStudio/lib-observability" + libLog "github.com/LerianStudio/lib-observability/log" + libOpentelemetry "github.com/LerianStudio/lib-observability/tracing" "github.com/LerianStudio/midaz/v3/components/ledger/internal/adapters/postgres/operation" "github.com/LerianStudio/midaz/v3/components/ledger/internal/adapters/postgres/transaction" "github.com/LerianStudio/midaz/v3/pkg/constant" diff --git a/components/ledger/internal/services/command/create_bulk_transaction_operations_async_test.go b/components/ledger/internal/services/command/create_bulk_transaction_operations_async_test.go index df218ae5c..ea155a820 100644 --- a/components/ledger/internal/services/command/create_bulk_transaction_operations_async_test.go +++ b/components/ledger/internal/services/command/create_bulk_transaction_operations_async_test.go @@ -13,7 +13,7 @@ import ( "testing" "time" - libLog "github.com/LerianStudio/lib-commons/v5/commons/log" + libLog "github.com/LerianStudio/lib-observability/log" mongodb "github.com/LerianStudio/midaz/v3/components/ledger/internal/adapters/mongodb/transaction" "github.com/LerianStudio/midaz/v3/components/ledger/internal/adapters/postgres/balance" "github.com/LerianStudio/midaz/v3/components/ledger/internal/adapters/postgres/operation" diff --git a/components/ledger/internal/services/command/create_ledger.go b/components/ledger/internal/services/command/create_ledger.go index eff508076..1553213ef 100644 --- a/components/ledger/internal/services/command/create_ledger.go +++ b/components/ledger/internal/services/command/create_ledger.go @@ -8,9 +8,9 @@ import ( "context" "time" - libCommons "github.com/LerianStudio/lib-commons/v5/commons" - libLog "github.com/LerianStudio/lib-commons/v5/commons/log" - libOpentelemetry "github.com/LerianStudio/lib-commons/v5/commons/opentelemetry" + libCommons "github.com/LerianStudio/lib-observability" + libLog "github.com/LerianStudio/lib-observability/log" + libOpentelemetry "github.com/LerianStudio/lib-observability/tracing" libStreaming "github.com/LerianStudio/lib-streaming" "github.com/LerianStudio/midaz/v3/pkg/constant" "github.com/LerianStudio/midaz/v3/pkg/mmodel" diff --git a/components/ledger/internal/services/command/create_metadata_bulk.go b/components/ledger/internal/services/command/create_metadata_bulk.go index ab2d35a0f..053d2ad91 100644 --- a/components/ledger/internal/services/command/create_metadata_bulk.go +++ b/components/ledger/internal/services/command/create_metadata_bulk.go @@ -11,9 +11,9 @@ import ( "reflect" "time" - libCommons "github.com/LerianStudio/lib-commons/v5/commons" - libLog "github.com/LerianStudio/lib-commons/v5/commons/log" - libOpentelemetry "github.com/LerianStudio/lib-commons/v5/commons/opentelemetry" + libCommons "github.com/LerianStudio/lib-observability" + libLog "github.com/LerianStudio/lib-observability/log" + libOpentelemetry "github.com/LerianStudio/lib-observability/tracing" mongodb "github.com/LerianStudio/midaz/v3/components/ledger/internal/adapters/mongodb/transaction" "github.com/LerianStudio/midaz/v3/components/ledger/internal/adapters/postgres/operation" "github.com/LerianStudio/midaz/v3/components/ledger/internal/adapters/postgres/transaction" diff --git a/components/ledger/internal/services/command/create_metadata_index.go b/components/ledger/internal/services/command/create_metadata_index.go index 51aa83922..89f00a7cc 100644 --- a/components/ledger/internal/services/command/create_metadata_index.go +++ b/components/ledger/internal/services/command/create_metadata_index.go @@ -9,14 +9,14 @@ import ( "fmt" "strings" - libCommons "github.com/LerianStudio/lib-commons/v5/commons" - libOpentelemetry "github.com/LerianStudio/lib-commons/v5/commons/opentelemetry" + libCommons "github.com/LerianStudio/lib-observability" + libOpentelemetry "github.com/LerianStudio/lib-observability/tracing" "github.com/LerianStudio/midaz/v3/pkg" "github.com/LerianStudio/midaz/v3/pkg/constant" "github.com/LerianStudio/midaz/v3/pkg/mmodel" // CreateMetadataIndex creates a new metadata index. - libLog "github.com/LerianStudio/lib-commons/v5/commons/log" + libLog "github.com/LerianStudio/lib-observability/log" ) func (uc *UseCase) CreateMetadataIndex(ctx context.Context, entityName string, input *mmodel.CreateMetadataIndexInput) (*mmodel.MetadataIndex, error) { diff --git a/components/ledger/internal/services/command/create_onboarding_metadata.go b/components/ledger/internal/services/command/create_onboarding_metadata.go index 63a9e96e2..3fd02f632 100644 --- a/components/ledger/internal/services/command/create_onboarding_metadata.go +++ b/components/ledger/internal/services/command/create_onboarding_metadata.go @@ -8,9 +8,9 @@ import ( "context" "time" - libCommons "github.com/LerianStudio/lib-commons/v5/commons" - libLog "github.com/LerianStudio/lib-commons/v5/commons/log" - libOpentelemetry "github.com/LerianStudio/lib-commons/v5/commons/opentelemetry" + libCommons "github.com/LerianStudio/lib-observability" + libLog "github.com/LerianStudio/lib-observability/log" + libOpentelemetry "github.com/LerianStudio/lib-observability/tracing" mongodb "github.com/LerianStudio/midaz/v3/components/ledger/internal/adapters/mongodb/onboarding" ) diff --git a/components/ledger/internal/services/command/create_operation_route.go b/components/ledger/internal/services/command/create_operation_route.go index b32753198..1266fc715 100644 --- a/components/ledger/internal/services/command/create_operation_route.go +++ b/components/ledger/internal/services/command/create_operation_route.go @@ -9,8 +9,9 @@ import ( "time" libCommons "github.com/LerianStudio/lib-commons/v5/commons" - libLog "github.com/LerianStudio/lib-commons/v5/commons/log" - libOpentelemetry "github.com/LerianStudio/lib-commons/v5/commons/opentelemetry" + libObservability "github.com/LerianStudio/lib-observability" + libLog "github.com/LerianStudio/lib-observability/log" + libOpentelemetry "github.com/LerianStudio/lib-observability/tracing" libStreaming "github.com/LerianStudio/lib-streaming" mongodb "github.com/LerianStudio/midaz/v3/components/ledger/internal/adapters/mongodb/transaction" "github.com/LerianStudio/midaz/v3/pkg/constant" @@ -23,7 +24,7 @@ import ( // CreateOperationRoute creates a new operation route. func (uc *UseCase) CreateOperationRoute(ctx context.Context, organizationID, ledgerID uuid.UUID, payload *mmodel.CreateOperationRouteInput) (*mmodel.OperationRoute, error) { - logger, tracer, _, _ := libCommons.NewTrackingFromContext(ctx) + logger, tracer, _, _ := libObservability.NewTrackingFromContext(ctx) ctx, span := tracer.Start(ctx, "command.create_operation_route") defer span.End() @@ -36,7 +37,7 @@ func (uc *UseCase) CreateOperationRoute(ctx context.Context, organizationID, led LedgerID: ledgerID, Title: payload.Title, Description: payload.Description, - Code: payload.Code, + Code: payload.Code, //nolint:staticcheck // legacy Code field persisted for backward compatibility OperationType: payload.OperationType, Account: payload.Account, AccountingEntries: payload.AccountingEntries, diff --git a/components/ledger/internal/services/command/create_organization.go b/components/ledger/internal/services/command/create_organization.go index 2daa5da06..1aa7bc019 100644 --- a/components/ledger/internal/services/command/create_organization.go +++ b/components/ledger/internal/services/command/create_organization.go @@ -9,8 +9,9 @@ import ( "time" libCommons "github.com/LerianStudio/lib-commons/v5/commons" - libLog "github.com/LerianStudio/lib-commons/v5/commons/log" - libOpentelemetry "github.com/LerianStudio/lib-commons/v5/commons/opentelemetry" + libObservability "github.com/LerianStudio/lib-observability" + libLog "github.com/LerianStudio/lib-observability/log" + libOpentelemetry "github.com/LerianStudio/lib-observability/tracing" libStreaming "github.com/LerianStudio/lib-streaming" "github.com/LerianStudio/midaz/v3/pkg" "github.com/LerianStudio/midaz/v3/pkg/constant" @@ -23,7 +24,7 @@ import ( // CreateOrganization creates a new organization and persists it in the repository. func (uc *UseCase) CreateOrganization(ctx context.Context, coi *mmodel.CreateOrganizationInput) (*mmodel.Organization, error) { - logger, tracer, _, _ := libCommons.NewTrackingFromContext(ctx) + logger, tracer, _, _ := libObservability.NewTrackingFromContext(ctx) ctx, span := tracer.Start(ctx, "command.create_organization") defer span.End() diff --git a/components/ledger/internal/services/command/create_portfolio.go b/components/ledger/internal/services/command/create_portfolio.go index b185359df..43e6c3730 100644 --- a/components/ledger/internal/services/command/create_portfolio.go +++ b/components/ledger/internal/services/command/create_portfolio.go @@ -9,8 +9,9 @@ import ( "time" libCommons "github.com/LerianStudio/lib-commons/v5/commons" - libLog "github.com/LerianStudio/lib-commons/v5/commons/log" - libOpentelemetry "github.com/LerianStudio/lib-commons/v5/commons/opentelemetry" + libObservability "github.com/LerianStudio/lib-observability" + libLog "github.com/LerianStudio/lib-observability/log" + libOpentelemetry "github.com/LerianStudio/lib-observability/tracing" libStreaming "github.com/LerianStudio/lib-streaming" "github.com/LerianStudio/midaz/v3/pkg/constant" "github.com/LerianStudio/midaz/v3/pkg/mmodel" @@ -22,7 +23,7 @@ import ( // CreatePortfolio creates a new portfolio and persists it in the repository. func (uc *UseCase) CreatePortfolio(ctx context.Context, organizationID, ledgerID uuid.UUID, cpi *mmodel.CreatePortfolioInput) (*mmodel.Portfolio, error) { - logger, tracer, _, _ := libCommons.NewTrackingFromContext(ctx) + logger, tracer, _, _ := libObservability.NewTrackingFromContext(ctx) ctx, span := tracer.Start(ctx, "command.create_portfolio") defer span.End() diff --git a/components/ledger/internal/services/command/create_segment.go b/components/ledger/internal/services/command/create_segment.go index cc8c99ffb..4b469de4c 100644 --- a/components/ledger/internal/services/command/create_segment.go +++ b/components/ledger/internal/services/command/create_segment.go @@ -9,8 +9,9 @@ import ( "time" libCommons "github.com/LerianStudio/lib-commons/v5/commons" - libLog "github.com/LerianStudio/lib-commons/v5/commons/log" - libOpentelemetry "github.com/LerianStudio/lib-commons/v5/commons/opentelemetry" + libObservability "github.com/LerianStudio/lib-observability" + libLog "github.com/LerianStudio/lib-observability/log" + libOpentelemetry "github.com/LerianStudio/lib-observability/tracing" libStreaming "github.com/LerianStudio/lib-streaming" "github.com/LerianStudio/midaz/v3/pkg/constant" "github.com/LerianStudio/midaz/v3/pkg/mmodel" @@ -22,7 +23,7 @@ import ( // CreateSegment creates a new segment and persists it in the repository. func (uc *UseCase) CreateSegment(ctx context.Context, organizationID, ledgerID uuid.UUID, cpi *mmodel.CreateSegmentInput) (*mmodel.Segment, error) { - logger, tracer, _, _ := libCommons.NewTrackingFromContext(ctx) + logger, tracer, _, _ := libObservability.NewTrackingFromContext(ctx) ctx, span := tracer.Start(ctx, "command.create_segment") defer span.End() diff --git a/components/ledger/internal/services/command/create_transaction_idempotency.go b/components/ledger/internal/services/command/create_transaction_idempotency.go index 4a8f8b9f6..c1003b153 100644 --- a/components/ledger/internal/services/command/create_transaction_idempotency.go +++ b/components/ledger/internal/services/command/create_transaction_idempotency.go @@ -12,8 +12,9 @@ import ( "time" libCommons "github.com/LerianStudio/lib-commons/v5/commons" - libLog "github.com/LerianStudio/lib-commons/v5/commons/log" - libOpentelemetry "github.com/LerianStudio/lib-commons/v5/commons/opentelemetry" + libObservability "github.com/LerianStudio/lib-observability" + libLog "github.com/LerianStudio/lib-observability/log" + libOpentelemetry "github.com/LerianStudio/lib-observability/tracing" "github.com/LerianStudio/midaz/v3/components/ledger/internal/adapters/postgres/transaction" "github.com/LerianStudio/midaz/v3/pkg" "github.com/LerianStudio/midaz/v3/pkg/constant" @@ -41,7 +42,7 @@ type TransactionIdempotencyResult struct { // // InternalKey is always populated so the caller can clean up on error. func (uc *UseCase) CreateOrCheckTransactionIdempotency(ctx context.Context, organizationID, ledgerID uuid.UUID, key, hash string, ttl time.Duration) (*TransactionIdempotencyResult, error) { - logger, tracer, _, _ := libCommons.NewTrackingFromContext(ctx) + logger, tracer, _, _ := libObservability.NewTrackingFromContext(ctx) ctx, span := tracer.Start(ctx, "command.create_idempotency_key") defer span.End() @@ -99,7 +100,7 @@ func (uc *UseCase) CreateOrCheckTransactionIdempotency(ctx context.Context, orga // SetTransactionIdempotencyValue func that set value on idempotency key to return to user. func (uc *UseCase) SetTransactionIdempotencyValue(ctx context.Context, organizationID, ledgerID uuid.UUID, key, hash string, t transaction.Transaction, ttl time.Duration) { - logger, tracer, _, _ := libCommons.NewTrackingFromContext(ctx) + logger, tracer, _, _ := libObservability.NewTrackingFromContext(ctx) ctx, span := tracer.Start(ctx, "command.set_value_idempotency_key") defer span.End() diff --git a/components/ledger/internal/services/command/create_transaction_route.go b/components/ledger/internal/services/command/create_transaction_route.go index 9ac3c2d49..b2f05893b 100644 --- a/components/ledger/internal/services/command/create_transaction_route.go +++ b/components/ledger/internal/services/command/create_transaction_route.go @@ -9,8 +9,9 @@ import ( "time" libCommons "github.com/LerianStudio/lib-commons/v5/commons" - libLog "github.com/LerianStudio/lib-commons/v5/commons/log" - libOpentelemetry "github.com/LerianStudio/lib-commons/v5/commons/opentelemetry" + libObservability "github.com/LerianStudio/lib-observability" + libLog "github.com/LerianStudio/lib-observability/log" + libOpentelemetry "github.com/LerianStudio/lib-observability/tracing" libStreaming "github.com/LerianStudio/lib-streaming" mongodb "github.com/LerianStudio/midaz/v3/components/ledger/internal/adapters/mongodb/transaction" "github.com/LerianStudio/midaz/v3/pkg" @@ -24,7 +25,7 @@ import ( // CreateTransactionRoute creates a new transaction route. func (uc *UseCase) CreateTransactionRoute(ctx context.Context, organizationID, ledgerID uuid.UUID, payload *mmodel.CreateTransactionRouteInput) (*mmodel.TransactionRoute, error) { - logger, tracer, _, _ := libCommons.NewTrackingFromContext(ctx) + logger, tracer, _, _ := libObservability.NewTrackingFromContext(ctx) ctx, span := tracer.Start(ctx, "command.create_transaction_route") defer span.End() diff --git a/components/ledger/internal/services/command/create_transaction_route_cache.go b/components/ledger/internal/services/command/create_transaction_route_cache.go index d1070aa19..da6b2033f 100644 --- a/components/ledger/internal/services/command/create_transaction_route_cache.go +++ b/components/ledger/internal/services/command/create_transaction_route_cache.go @@ -8,8 +8,8 @@ import ( "context" "fmt" - libCommons "github.com/LerianStudio/lib-commons/v5/commons" - libOpentelemetry "github.com/LerianStudio/lib-commons/v5/commons/opentelemetry" + libCommons "github.com/LerianStudio/lib-observability" + libOpentelemetry "github.com/LerianStudio/lib-observability/tracing" "github.com/LerianStudio/midaz/v3/pkg/mmodel" "github.com/LerianStudio/midaz/v3/pkg/utils" @@ -19,7 +19,7 @@ import ( // The operation route ids are the uuids of the operation routes in the transaction route. // The type is the type of the operation route (debit or credit). // The account rule is the account rule of the operation route. - libLog "github.com/LerianStudio/lib-commons/v5/commons/log" + libLog "github.com/LerianStudio/lib-observability/log" ) func (uc *UseCase) CreateAccountingRouteCache(ctx context.Context, route *mmodel.TransactionRoute) error { diff --git a/components/ledger/internal/services/command/create_transaction_route_cache_chaos_test.go b/components/ledger/internal/services/command/create_transaction_route_cache_chaos_test.go index 3ee2d3e8e..f25248126 100644 --- a/components/ledger/internal/services/command/create_transaction_route_cache_chaos_test.go +++ b/components/ledger/internal/services/command/create_transaction_route_cache_chaos_test.go @@ -24,7 +24,7 @@ import ( libCommons "github.com/LerianStudio/lib-commons/v5/commons" libRedis "github.com/LerianStudio/lib-commons/v5/commons/redis" - libZap "github.com/LerianStudio/lib-commons/v5/commons/zap" + libZap "github.com/LerianStudio/lib-observability/zap" redis "github.com/LerianStudio/midaz/v3/components/ledger/internal/adapters/redis/transaction" "github.com/LerianStudio/midaz/v3/pkg/mmodel" "github.com/LerianStudio/midaz/v3/pkg/utils" diff --git a/components/ledger/internal/services/command/create_write_behind_transaction.go b/components/ledger/internal/services/command/create_write_behind_transaction.go index c5aba5473..c0d4a3525 100644 --- a/components/ledger/internal/services/command/create_write_behind_transaction.go +++ b/components/ledger/internal/services/command/create_write_behind_transaction.go @@ -8,9 +8,9 @@ import ( "context" "time" - libCommons "github.com/LerianStudio/lib-commons/v5/commons" - libLog "github.com/LerianStudio/lib-commons/v5/commons/log" - libOpentelemetry "github.com/LerianStudio/lib-commons/v5/commons/opentelemetry" + libCommons "github.com/LerianStudio/lib-observability" + libLog "github.com/LerianStudio/lib-observability/log" + libOpentelemetry "github.com/LerianStudio/lib-observability/tracing" "github.com/LerianStudio/midaz/v3/components/ledger/internal/adapters/postgres/transaction" "github.com/LerianStudio/midaz/v3/pkg/mtransaction" "github.com/LerianStudio/midaz/v3/pkg/utils" diff --git a/components/ledger/internal/services/command/delete_account.go b/components/ledger/internal/services/command/delete_account.go index dd65b0449..d828a87db 100644 --- a/components/ledger/internal/services/command/delete_account.go +++ b/components/ledger/internal/services/command/delete_account.go @@ -9,9 +9,9 @@ import ( "errors" "time" - libCommons "github.com/LerianStudio/lib-commons/v5/commons" - libLog "github.com/LerianStudio/lib-commons/v5/commons/log" - libOpentelemetry "github.com/LerianStudio/lib-commons/v5/commons/opentelemetry" + libCommons "github.com/LerianStudio/lib-observability" + libLog "github.com/LerianStudio/lib-observability/log" + libOpentelemetry "github.com/LerianStudio/lib-observability/tracing" libStreaming "github.com/LerianStudio/lib-streaming" "github.com/LerianStudio/midaz/v3/components/ledger/internal/services" "github.com/LerianStudio/midaz/v3/pkg" diff --git a/components/ledger/internal/services/command/delete_account_type.go b/components/ledger/internal/services/command/delete_account_type.go index 4a5ec9b4e..f4dfdf422 100644 --- a/components/ledger/internal/services/command/delete_account_type.go +++ b/components/ledger/internal/services/command/delete_account_type.go @@ -8,9 +8,9 @@ import ( "context" "errors" - libCommons "github.com/LerianStudio/lib-commons/v5/commons" - libLog "github.com/LerianStudio/lib-commons/v5/commons/log" - libOpentelemetry "github.com/LerianStudio/lib-commons/v5/commons/opentelemetry" + libCommons "github.com/LerianStudio/lib-observability" + libLog "github.com/LerianStudio/lib-observability/log" + libOpentelemetry "github.com/LerianStudio/lib-observability/tracing" "github.com/LerianStudio/midaz/v3/components/ledger/internal/services" "github.com/LerianStudio/midaz/v3/pkg" "github.com/LerianStudio/midaz/v3/pkg/constant" diff --git a/components/ledger/internal/services/command/delete_all_balances_by_account_id.go b/components/ledger/internal/services/command/delete_all_balances_by_account_id.go index db107d8e5..f269b784b 100644 --- a/components/ledger/internal/services/command/delete_all_balances_by_account_id.go +++ b/components/ledger/internal/services/command/delete_all_balances_by_account_id.go @@ -9,9 +9,9 @@ import ( "errors" "fmt" - libCommons "github.com/LerianStudio/lib-commons/v5/commons" - libLog "github.com/LerianStudio/lib-commons/v5/commons/log" - libOpentelemetry "github.com/LerianStudio/lib-commons/v5/commons/opentelemetry" + libCommons "github.com/LerianStudio/lib-observability" + libLog "github.com/LerianStudio/lib-observability/log" + libOpentelemetry "github.com/LerianStudio/lib-observability/tracing" "github.com/LerianStudio/midaz/v3/pkg" "github.com/LerianStudio/midaz/v3/pkg/constant" "github.com/LerianStudio/midaz/v3/pkg/mmodel" diff --git a/components/ledger/internal/services/command/delete_asset.go b/components/ledger/internal/services/command/delete_asset.go index a2a38e6ee..4cb01833b 100644 --- a/components/ledger/internal/services/command/delete_asset.go +++ b/components/ledger/internal/services/command/delete_asset.go @@ -11,9 +11,9 @@ import ( "reflect" "time" - libCommons "github.com/LerianStudio/lib-commons/v5/commons" - libLog "github.com/LerianStudio/lib-commons/v5/commons/log" - libOpentelemetry "github.com/LerianStudio/lib-commons/v5/commons/opentelemetry" + libCommons "github.com/LerianStudio/lib-observability" + libLog "github.com/LerianStudio/lib-observability/log" + libOpentelemetry "github.com/LerianStudio/lib-observability/tracing" libStreaming "github.com/LerianStudio/lib-streaming" "github.com/LerianStudio/midaz/v3/components/ledger/internal/services" "github.com/LerianStudio/midaz/v3/pkg" diff --git a/components/ledger/internal/services/command/delete_balance.go b/components/ledger/internal/services/command/delete_balance.go index eb8ce53ac..f1ab8affc 100644 --- a/components/ledger/internal/services/command/delete_balance.go +++ b/components/ledger/internal/services/command/delete_balance.go @@ -8,9 +8,9 @@ import ( "context" "time" - libCommons "github.com/LerianStudio/lib-commons/v5/commons" - libLog "github.com/LerianStudio/lib-commons/v5/commons/log" - libOpentelemetry "github.com/LerianStudio/lib-commons/v5/commons/opentelemetry" + libCommons "github.com/LerianStudio/lib-observability" + libLog "github.com/LerianStudio/lib-observability/log" + libOpentelemetry "github.com/LerianStudio/lib-observability/tracing" libStreaming "github.com/LerianStudio/lib-streaming" "github.com/LerianStudio/midaz/v3/pkg" "github.com/LerianStudio/midaz/v3/pkg/constant" diff --git a/components/ledger/internal/services/command/delete_ledger.go b/components/ledger/internal/services/command/delete_ledger.go index 7a0c36907..c0afe4198 100644 --- a/components/ledger/internal/services/command/delete_ledger.go +++ b/components/ledger/internal/services/command/delete_ledger.go @@ -9,9 +9,9 @@ import ( "errors" "time" - libCommons "github.com/LerianStudio/lib-commons/v5/commons" - libLog "github.com/LerianStudio/lib-commons/v5/commons/log" - libOpentelemetry "github.com/LerianStudio/lib-commons/v5/commons/opentelemetry" + libCommons "github.com/LerianStudio/lib-observability" + libLog "github.com/LerianStudio/lib-observability/log" + libOpentelemetry "github.com/LerianStudio/lib-observability/tracing" libStreaming "github.com/LerianStudio/lib-streaming" "github.com/LerianStudio/midaz/v3/components/ledger/internal/services" "github.com/LerianStudio/midaz/v3/pkg" diff --git a/components/ledger/internal/services/command/delete_metadata_index.go b/components/ledger/internal/services/command/delete_metadata_index.go index 01315ea22..d5dd4d515 100644 --- a/components/ledger/internal/services/command/delete_metadata_index.go +++ b/components/ledger/internal/services/command/delete_metadata_index.go @@ -9,13 +9,13 @@ import ( "fmt" "strings" - libCommons "github.com/LerianStudio/lib-commons/v5/commons" - libOpentelemetry "github.com/LerianStudio/lib-commons/v5/commons/opentelemetry" + libCommons "github.com/LerianStudio/lib-observability" + libOpentelemetry "github.com/LerianStudio/lib-observability/tracing" "github.com/LerianStudio/midaz/v3/pkg" "github.com/LerianStudio/midaz/v3/pkg/constant" // DeleteMetadataIndex removes a metadata index from a specific entity collection. - libLog "github.com/LerianStudio/lib-commons/v5/commons/log" + libLog "github.com/LerianStudio/lib-observability/log" ) func (uc *UseCase) DeleteMetadataIndex(ctx context.Context, entityName, indexName string) error { diff --git a/components/ledger/internal/services/command/delete_operation_route.go b/components/ledger/internal/services/command/delete_operation_route.go index daf397289..d12aba7d7 100644 --- a/components/ledger/internal/services/command/delete_operation_route.go +++ b/components/ledger/internal/services/command/delete_operation_route.go @@ -9,9 +9,9 @@ import ( "errors" "time" - libCommons "github.com/LerianStudio/lib-commons/v5/commons" - libLog "github.com/LerianStudio/lib-commons/v5/commons/log" - libOpentelemetry "github.com/LerianStudio/lib-commons/v5/commons/opentelemetry" + libCommons "github.com/LerianStudio/lib-observability" + libLog "github.com/LerianStudio/lib-observability/log" + libOpentelemetry "github.com/LerianStudio/lib-observability/tracing" libStreaming "github.com/LerianStudio/lib-streaming" "github.com/LerianStudio/midaz/v3/components/ledger/internal/services" "github.com/LerianStudio/midaz/v3/pkg" diff --git a/components/ledger/internal/services/command/delete_organization.go b/components/ledger/internal/services/command/delete_organization.go index 0d27e05a6..245d41c5f 100644 --- a/components/ledger/internal/services/command/delete_organization.go +++ b/components/ledger/internal/services/command/delete_organization.go @@ -9,9 +9,9 @@ import ( "errors" "time" - libCommons "github.com/LerianStudio/lib-commons/v5/commons" - libLog "github.com/LerianStudio/lib-commons/v5/commons/log" - libOpentelemetry "github.com/LerianStudio/lib-commons/v5/commons/opentelemetry" + libCommons "github.com/LerianStudio/lib-observability" + libLog "github.com/LerianStudio/lib-observability/log" + libOpentelemetry "github.com/LerianStudio/lib-observability/tracing" libStreaming "github.com/LerianStudio/lib-streaming" "github.com/LerianStudio/midaz/v3/components/ledger/internal/services" "github.com/LerianStudio/midaz/v3/pkg" diff --git a/components/ledger/internal/services/command/delete_portfolio.go b/components/ledger/internal/services/command/delete_portfolio.go index 926da4c84..1952ef1a6 100644 --- a/components/ledger/internal/services/command/delete_portfolio.go +++ b/components/ledger/internal/services/command/delete_portfolio.go @@ -9,9 +9,9 @@ import ( "errors" "time" - libCommons "github.com/LerianStudio/lib-commons/v5/commons" - libLog "github.com/LerianStudio/lib-commons/v5/commons/log" - libOpentelemetry "github.com/LerianStudio/lib-commons/v5/commons/opentelemetry" + libCommons "github.com/LerianStudio/lib-observability" + libLog "github.com/LerianStudio/lib-observability/log" + libOpentelemetry "github.com/LerianStudio/lib-observability/tracing" libStreaming "github.com/LerianStudio/lib-streaming" "github.com/LerianStudio/midaz/v3/components/ledger/internal/services" "github.com/LerianStudio/midaz/v3/pkg" diff --git a/components/ledger/internal/services/command/delete_segment.go b/components/ledger/internal/services/command/delete_segment.go index b3bcb8d37..189ac47a8 100644 --- a/components/ledger/internal/services/command/delete_segment.go +++ b/components/ledger/internal/services/command/delete_segment.go @@ -9,9 +9,9 @@ import ( "errors" "time" - libCommons "github.com/LerianStudio/lib-commons/v5/commons" - libLog "github.com/LerianStudio/lib-commons/v5/commons/log" - libOpentelemetry "github.com/LerianStudio/lib-commons/v5/commons/opentelemetry" + libCommons "github.com/LerianStudio/lib-observability" + libLog "github.com/LerianStudio/lib-observability/log" + libOpentelemetry "github.com/LerianStudio/lib-observability/tracing" libStreaming "github.com/LerianStudio/lib-streaming" "github.com/LerianStudio/midaz/v3/components/ledger/internal/services" "github.com/LerianStudio/midaz/v3/pkg" diff --git a/components/ledger/internal/services/command/delete_transaction_route.go b/components/ledger/internal/services/command/delete_transaction_route.go index a83987147..e9b0418d3 100644 --- a/components/ledger/internal/services/command/delete_transaction_route.go +++ b/components/ledger/internal/services/command/delete_transaction_route.go @@ -9,9 +9,9 @@ import ( "errors" "time" - libCommons "github.com/LerianStudio/lib-commons/v5/commons" - libLog "github.com/LerianStudio/lib-commons/v5/commons/log" - libOpentelemetry "github.com/LerianStudio/lib-commons/v5/commons/opentelemetry" + libCommons "github.com/LerianStudio/lib-observability" + libLog "github.com/LerianStudio/lib-observability/log" + libOpentelemetry "github.com/LerianStudio/lib-observability/tracing" libStreaming "github.com/LerianStudio/lib-streaming" "github.com/LerianStudio/midaz/v3/components/ledger/internal/services" "github.com/LerianStudio/midaz/v3/pkg" diff --git a/components/ledger/internal/services/command/delete_transaction_route_cache.go b/components/ledger/internal/services/command/delete_transaction_route_cache.go index 0d18bf354..c8d9cef3c 100644 --- a/components/ledger/internal/services/command/delete_transaction_route_cache.go +++ b/components/ledger/internal/services/command/delete_transaction_route_cache.go @@ -6,24 +6,23 @@ package command import ( "context" - "fmt" - libCommons "github.com/LerianStudio/lib-commons/v5/commons" - libOpentelemetry "github.com/LerianStudio/lib-commons/v5/commons/opentelemetry" + libCommons "github.com/LerianStudio/lib-observability" + libLog "github.com/LerianStudio/lib-observability/log" + libOpentelemetry "github.com/LerianStudio/lib-observability/tracing" "github.com/LerianStudio/midaz/v3/pkg/utils" "github.com/google/uuid" - - // DeleteTransactionRouteCache deletes the cache for a transaction route. - libLog "github.com/LerianStudio/lib-commons/v5/commons/log" ) +// DeleteTransactionRouteCache deletes the cache for a transaction route. func (uc *UseCase) DeleteTransactionRouteCache(ctx context.Context, organizationID, ledgerID, transactionRouteID uuid.UUID) error { logger, tracer, _, _ := libCommons.NewTrackingFromContext(ctx) ctx, span := tracer.Start(ctx, "command.delete_transaction_route_cache") defer span.End() - logger.Log(ctx, libLog.LevelInfo, fmt.Sprintf("Deleting transaction route cache for transaction route with id: %s", transactionRouteID)) + logger.Log(ctx, libLog.LevelInfo, "Deleting transaction route cache", + libLog.String("transaction_route_id", transactionRouteID.String())) internalKey := utils.AccountingRoutesInternalKey(organizationID, ledgerID, transactionRouteID) @@ -31,12 +30,15 @@ func (uc *UseCase) DeleteTransactionRouteCache(ctx context.Context, organization if err != nil { libOpentelemetry.HandleSpanError(span, "Failed to delete transaction route cache", err) - logger.Log(ctx, libLog.LevelError, fmt.Sprintf("Failed to delete transaction route cache: %v", err)) + logger.Log(ctx, libLog.LevelError, "Failed to delete transaction route cache", + libLog.String("transaction_route_id", transactionRouteID.String()), + libLog.Err(err)) return err } - logger.Log(ctx, libLog.LevelInfo, fmt.Sprintf("Successfully deleted transaction route cache for transaction route with id: %s", transactionRouteID)) + logger.Log(ctx, libLog.LevelInfo, "Successfully deleted transaction route cache", + libLog.String("transaction_route_id", transactionRouteID.String())) return nil } diff --git a/components/ledger/internal/services/command/delete_write_behind_transaction.go b/components/ledger/internal/services/command/delete_write_behind_transaction.go index c5d370052..07b2be2b7 100644 --- a/components/ledger/internal/services/command/delete_write_behind_transaction.go +++ b/components/ledger/internal/services/command/delete_write_behind_transaction.go @@ -6,20 +6,18 @@ package command import ( "context" - "fmt" - libCommons "github.com/LerianStudio/lib-commons/v5/commons" - libOpentelemetry "github.com/LerianStudio/lib-commons/v5/commons/opentelemetry" tmcore "github.com/LerianStudio/lib-commons/v5/commons/tenant-manager/core" + libCommons "github.com/LerianStudio/lib-observability" + libLog "github.com/LerianStudio/lib-observability/log" + libOpentelemetry "github.com/LerianStudio/lib-observability/tracing" "github.com/LerianStudio/midaz/v3/pkg/utils" "github.com/google/uuid" - - // DeleteWriteBehindTransaction removes the transaction from the write-behind cache. - // Called by the consumer after successfully persisting the transaction to Postgres. - // Errors are logged but do not block the consumer flow. - libLog "github.com/LerianStudio/lib-commons/v5/commons/log" ) +// DeleteWriteBehindTransaction removes the transaction from the write-behind cache. +// Called by the consumer after successfully persisting the transaction to Postgres. +// Errors are logged but do not block the consumer flow. func (uc *UseCase) DeleteWriteBehindTransaction(ctx context.Context, organizationID, ledgerID uuid.UUID, transactionID string) { logger, tracer, _, _ := libCommons.NewTrackingFromContext(ctx) @@ -30,14 +28,19 @@ func (uc *UseCase) DeleteWriteBehindTransaction(ctx context.Context, organizatio key := utils.WriteBehindTransactionKey(organizationID, ledgerID, transactionID) - logger.Log(ctx, libLog.LevelInfo, fmt.Sprintf("[DEBUG] DeleteWriteBehindTransaction: tenantID=%q raw_key=%s", tenantID, key)) + logger.Log(ctx, libLog.LevelDebug, "DeleteWriteBehindTransaction", + libLog.String("tenant_id", tenantID), + libLog.String("raw_key", key)) if err := uc.TransactionRedisRepo.Del(ctx, key); err != nil { libOpentelemetry.HandleSpanError(span, "Failed to remove transaction from write-behind cache", err) - logger.Log(ctx, libLog.LevelWarn, fmt.Sprintf("Failed to remove transaction from write-behind cache: %v", err)) + logger.Log(ctx, libLog.LevelError, "Failed to remove transaction from write-behind cache", + libLog.String("raw_key", key), + libLog.Err(err)) return } - logger.Log(ctx, libLog.LevelInfo, fmt.Sprintf("Transaction removed from write-behind cache: %s", key)) + logger.Log(ctx, libLog.LevelDebug, "Transaction removed from write-behind cache", + libLog.String("raw_key", key)) } diff --git a/components/ledger/internal/services/command/process_balance_operations.go b/components/ledger/internal/services/command/process_balance_operations.go index ce6b219d2..88e8da774 100644 --- a/components/ledger/internal/services/command/process_balance_operations.go +++ b/components/ledger/internal/services/command/process_balance_operations.go @@ -8,9 +8,9 @@ import ( "context" "fmt" - libCommons "github.com/LerianStudio/lib-commons/v5/commons" - libLog "github.com/LerianStudio/lib-commons/v5/commons/log" - libOpentelemetry "github.com/LerianStudio/lib-commons/v5/commons/opentelemetry" + libCommons "github.com/LerianStudio/lib-observability" + libLog "github.com/LerianStudio/lib-observability/log" + libOpentelemetry "github.com/LerianStudio/lib-observability/tracing" "github.com/google/uuid" "go.opentelemetry.io/otel/attribute" diff --git a/components/ledger/internal/services/command/reload_operation_route_cache.go b/components/ledger/internal/services/command/reload_operation_route_cache.go index 432ef21f5..af21157e9 100644 --- a/components/ledger/internal/services/command/reload_operation_route_cache.go +++ b/components/ledger/internal/services/command/reload_operation_route_cache.go @@ -6,48 +6,58 @@ package command import ( "context" - "fmt" - libCommons "github.com/LerianStudio/lib-commons/v5/commons" - libOpentelemetry "github.com/LerianStudio/lib-commons/v5/commons/opentelemetry" + libCommons "github.com/LerianStudio/lib-observability" + libLog "github.com/LerianStudio/lib-observability/log" + libOpentelemetry "github.com/LerianStudio/lib-observability/tracing" "github.com/google/uuid" - - // ReloadOperationRouteCache reloads the cache for all transaction routes associated with the given operation route. - // It retrieves all transaction routes linked to the operation route and recreates their cache entries. - libLog "github.com/LerianStudio/lib-commons/v5/commons/log" ) +// ReloadOperationRouteCache reloads the cache for all transaction routes associated with the given operation route. +// It retrieves all transaction routes linked to the operation route and recreates their cache entries. func (uc *UseCase) ReloadOperationRouteCache(ctx context.Context, organizationID, ledgerID, id uuid.UUID) error { logger, tracer, _, _ := libCommons.NewTrackingFromContext(ctx) ctx, span := tracer.Start(ctx, "command.reload_operation_route_cache") defer span.End() - logger.Log(ctx, libLog.LevelInfo, fmt.Sprintf("Reloading operation route cache for operation route with id: %s", id)) + operationRouteIDStr := id.String() + + logger.Log(ctx, libLog.LevelInfo, "Reloading operation route cache", + libLog.String("operation_route_id", operationRouteIDStr)) transactionRouteIDs, err := uc.OperationRouteRepo.FindTransactionRouteIDs(ctx, id) if err != nil { libOpentelemetry.HandleSpanError(span, "Failed to find transaction route IDs", err) - logger.Log(ctx, libLog.LevelError, fmt.Sprintf("Failed to find transaction route IDs for operation route %s: %v", id, err)) + logger.Log(ctx, libLog.LevelError, "Failed to find transaction route IDs", + libLog.String("operation_route_id", operationRouteIDStr), + libLog.Err(err)) return err } if len(transactionRouteIDs) == 0 { - logger.Log(ctx, libLog.LevelInfo, fmt.Sprintf("No transaction routes found for operation route %s, no cache reload needed", id)) + logger.Log(ctx, libLog.LevelInfo, "No transaction routes found for operation route, no cache reload needed", + libLog.String("operation_route_id", operationRouteIDStr)) return nil } - logger.Log(ctx, libLog.LevelInfo, fmt.Sprintf("Found %d transaction routes associated with operation route %s", len(transactionRouteIDs), id)) + logger.Log(ctx, libLog.LevelInfo, "Found transaction routes associated with operation route", + libLog.Int("transaction_route_count", len(transactionRouteIDs)), + libLog.String("operation_route_id", operationRouteIDStr)) for _, transactionRouteID := range transactionRouteIDs { + transactionRouteIDStr := transactionRouteID.String() + transactionRoute, err := uc.TransactionRouteRepo.FindByID(ctx, organizationID, ledgerID, transactionRouteID) if err != nil { libOpentelemetry.HandleSpanBusinessErrorEvent(span, "Failed to retrieve transaction route", err) - logger.Log(ctx, libLog.LevelWarn, fmt.Sprintf("Failed to retrieve transaction route %s: %v", transactionRouteID, err)) + logger.Log(ctx, libLog.LevelWarn, "Failed to retrieve transaction route", + libLog.String("transaction_route_id", transactionRouteIDStr), + libLog.Err(err)) continue } @@ -55,15 +65,19 @@ func (uc *UseCase) ReloadOperationRouteCache(ctx context.Context, organizationID if err := uc.CreateAccountingRouteCache(ctx, transactionRoute); err != nil { libOpentelemetry.HandleSpanBusinessErrorEvent(span, "Failed to create cache for transaction route", err) - logger.Log(ctx, libLog.LevelWarn, fmt.Sprintf("Failed to create cache for transaction route %s: %v", transactionRouteID, err)) + logger.Log(ctx, libLog.LevelWarn, "Failed to create cache for transaction route", + libLog.String("transaction_route_id", transactionRouteIDStr), + libLog.Err(err)) continue } - logger.Log(ctx, libLog.LevelInfo, fmt.Sprintf("Successfully reloaded cache for transaction route %s", transactionRouteID)) + logger.Log(ctx, libLog.LevelInfo, "Successfully reloaded cache for transaction route", + libLog.String("transaction_route_id", transactionRouteIDStr)) } - logger.Log(ctx, libLog.LevelInfo, fmt.Sprintf("Successfully completed cache reload for operation route %s", id)) + logger.Log(ctx, libLog.LevelInfo, "Successfully completed cache reload for operation route", + libLog.String("operation_route_id", operationRouteIDStr)) return nil } diff --git a/components/ledger/internal/services/command/reload_operation_route_cache_chaos_test.go b/components/ledger/internal/services/command/reload_operation_route_cache_chaos_test.go index afb5e2bb7..24b2da144 100644 --- a/components/ledger/internal/services/command/reload_operation_route_cache_chaos_test.go +++ b/components/ledger/internal/services/command/reload_operation_route_cache_chaos_test.go @@ -31,7 +31,7 @@ import ( libCommons "github.com/LerianStudio/lib-commons/v5/commons" libPostgres "github.com/LerianStudio/lib-commons/v5/commons/postgres" libRedis "github.com/LerianStudio/lib-commons/v5/commons/redis" - libZap "github.com/LerianStudio/lib-commons/v5/commons/zap" + libZap "github.com/LerianStudio/lib-observability/zap" "github.com/LerianStudio/midaz/v3/components/ledger/internal/adapters/postgres/operationroute" "github.com/LerianStudio/midaz/v3/components/ledger/internal/adapters/postgres/transactionroute" redis "github.com/LerianStudio/midaz/v3/components/ledger/internal/adapters/redis/transaction" diff --git a/components/ledger/internal/services/command/reload_operation_route_cache_integration_test.go b/components/ledger/internal/services/command/reload_operation_route_cache_integration_test.go index 2a1a12aa0..4ce16ca36 100644 --- a/components/ledger/internal/services/command/reload_operation_route_cache_integration_test.go +++ b/components/ledger/internal/services/command/reload_operation_route_cache_integration_test.go @@ -16,7 +16,7 @@ import ( libCommons "github.com/LerianStudio/lib-commons/v5/commons" libPostgres "github.com/LerianStudio/lib-commons/v5/commons/postgres" - libZap "github.com/LerianStudio/lib-commons/v5/commons/zap" + libZap "github.com/LerianStudio/lib-observability/zap" "github.com/LerianStudio/midaz/v3/components/ledger/internal/adapters/postgres/operationroute" "github.com/LerianStudio/midaz/v3/components/ledger/internal/adapters/postgres/transactionroute" redis "github.com/LerianStudio/midaz/v3/components/ledger/internal/adapters/redis/transaction" diff --git a/components/ledger/internal/services/command/send_log_transaction_audit_queue.go b/components/ledger/internal/services/command/send_log_transaction_audit_queue.go index 35bc292ac..639641781 100644 --- a/components/ledger/internal/services/command/send_log_transaction_audit_queue.go +++ b/components/ledger/internal/services/command/send_log_transaction_audit_queue.go @@ -11,8 +11,8 @@ import ( "os" "strings" - libCommons "github.com/LerianStudio/lib-commons/v5/commons" - libOpentelemetry "github.com/LerianStudio/lib-commons/v5/commons/opentelemetry" + libCommons "github.com/LerianStudio/lib-observability" + libOpentelemetry "github.com/LerianStudio/lib-observability/tracing" "github.com/LerianStudio/midaz/v3/components/ledger/internal/adapters/postgres/operation" "github.com/LerianStudio/midaz/v3/pkg/mmodel" "github.com/google/uuid" @@ -23,7 +23,7 @@ import ( // organizationID is the UUID of the associated organization. // ledgerID is the UUID of the ledger linked to the transaction. // transactionID is the UUID of the transaction being logged. - libLog "github.com/LerianStudio/lib-commons/v5/commons/log" + libLog "github.com/LerianStudio/lib-observability/log" ) func (uc *UseCase) SendLogTransactionAuditQueue(ctx context.Context, operations []*operation.Operation, organizationID, ledgerID, transactionID uuid.UUID) { diff --git a/components/ledger/internal/services/command/send_overdraft_events.go b/components/ledger/internal/services/command/send_overdraft_events.go index 16e2c5665..52e73cbcc 100644 --- a/components/ledger/internal/services/command/send_overdraft_events.go +++ b/components/ledger/internal/services/command/send_overdraft_events.go @@ -11,9 +11,9 @@ import ( "strings" "time" - libCommons "github.com/LerianStudio/lib-commons/v5/commons" - libLog "github.com/LerianStudio/lib-commons/v5/commons/log" - libOpentelemetry "github.com/LerianStudio/lib-commons/v5/commons/opentelemetry" + libCommons "github.com/LerianStudio/lib-observability" + libLog "github.com/LerianStudio/lib-observability/log" + libOpentelemetry "github.com/LerianStudio/lib-observability/tracing" libStreaming "github.com/LerianStudio/lib-streaming" "github.com/LerianStudio/midaz/v3/components/ledger/internal/adapters/postgres/operation" "github.com/LerianStudio/midaz/v3/components/ledger/internal/adapters/postgres/transaction" @@ -203,6 +203,7 @@ func buildOverdraftEvents(tran *transaction.Transaction) []overdraftEventItem { return nil } + //nolint:prealloc // contract: return nil (not empty slice) when no operation qualifies; tests assert nil. var items []overdraftEventItem for _, op := range tran.Operations { diff --git a/components/ledger/internal/services/command/send_transaction_events.go b/components/ledger/internal/services/command/send_transaction_events.go index d8129ee54..a159218e7 100644 --- a/components/ledger/internal/services/command/send_transaction_events.go +++ b/components/ledger/internal/services/command/send_transaction_events.go @@ -12,9 +12,9 @@ import ( "strings" "time" - libCommons "github.com/LerianStudio/lib-commons/v5/commons" - libLog "github.com/LerianStudio/lib-commons/v5/commons/log" - libOpentelemetry "github.com/LerianStudio/lib-commons/v5/commons/opentelemetry" + libCommons "github.com/LerianStudio/lib-observability" + libLog "github.com/LerianStudio/lib-observability/log" + libOpentelemetry "github.com/LerianStudio/lib-observability/tracing" libStreaming "github.com/LerianStudio/lib-streaming" "github.com/LerianStudio/midaz/v3/components/ledger/internal/adapters/postgres/transaction" "github.com/LerianStudio/midaz/v3/pkg/constant" @@ -290,7 +290,7 @@ func buildTransactionEventSource(tran *transaction.Transaction) (events.Transact Description: tran.Description, Source: tran.Source, Destination: tran.Destination, - Route: tran.Route, + Route: tran.Route, //nolint:staticcheck // legacy field kept for backward compatibility; RouteID is canonical RouteID: tran.RouteID, Operations: operationsRaw, Metadata: tran.Metadata, diff --git a/components/ledger/internal/services/command/sync_balances_batch.go b/components/ledger/internal/services/command/sync_balances_batch.go index 4534dd69c..4a4265e6f 100644 --- a/components/ledger/internal/services/command/sync_balances_batch.go +++ b/components/ledger/internal/services/command/sync_balances_batch.go @@ -7,9 +7,9 @@ package command import ( "context" - libCommons "github.com/LerianStudio/lib-commons/v5/commons" - libLog "github.com/LerianStudio/lib-commons/v5/commons/log" - libOpentelemetry "github.com/LerianStudio/lib-commons/v5/commons/opentelemetry" + libCommons "github.com/LerianStudio/lib-observability" + libLog "github.com/LerianStudio/lib-observability/log" + libOpentelemetry "github.com/LerianStudio/lib-observability/tracing" redisTransaction "github.com/LerianStudio/midaz/v3/components/ledger/internal/adapters/redis/transaction" redisBalance "github.com/LerianStudio/midaz/v3/components/ledger/internal/adapters/redis/transaction/balance" "github.com/LerianStudio/midaz/v3/pkg/constant" @@ -42,6 +42,8 @@ type SyncBalancesBatchResult struct { // - Missing keys (already expired): skipped in aggregation // - Version conflicts: optimistic locking in DB update // - Partial failures: keys only removed after successful DB write +// +//nolint:gocognit,gocyclo // Will be refactored into smaller helpers; tracked separately. func (uc *UseCase) SyncBalancesBatch(ctx context.Context, organizationID, ledgerID uuid.UUID, keys []redisTransaction.SyncKey) (*SyncBalancesBatchResult, error) { logger, tracer, _, metricFactory := libCommons.NewTrackingFromContext(ctx) diff --git a/components/ledger/internal/services/command/update_account.go b/components/ledger/internal/services/command/update_account.go index 4b8e78665..96b1b65f3 100644 --- a/components/ledger/internal/services/command/update_account.go +++ b/components/ledger/internal/services/command/update_account.go @@ -11,8 +11,9 @@ import ( "time" libCommons "github.com/LerianStudio/lib-commons/v5/commons" - libLog "github.com/LerianStudio/lib-commons/v5/commons/log" - libOpentelemetry "github.com/LerianStudio/lib-commons/v5/commons/opentelemetry" + libObservability "github.com/LerianStudio/lib-observability" + libLog "github.com/LerianStudio/lib-observability/log" + libOpentelemetry "github.com/LerianStudio/lib-observability/tracing" libStreaming "github.com/LerianStudio/lib-streaming" "github.com/LerianStudio/midaz/v3/components/ledger/internal/services" "github.com/LerianStudio/midaz/v3/pkg" @@ -27,7 +28,7 @@ import ( // UpdateAccount updates an account from the repository by the given ID. func (uc *UseCase) UpdateAccount(ctx context.Context, organizationID, ledgerID uuid.UUID, portfolioID *uuid.UUID, id uuid.UUID, uai *mmodel.UpdateAccountInput) (*mmodel.Account, error) { - logger, tracer, _, _ := libCommons.NewTrackingFromContext(ctx) + logger, tracer, _, _ := libObservability.NewTrackingFromContext(ctx) ctx, span := tracer.Start(ctx, "command.update_account") defer span.End() diff --git a/components/ledger/internal/services/command/update_account_type.go b/components/ledger/internal/services/command/update_account_type.go index 2afe5cb57..2fdd5101e 100644 --- a/components/ledger/internal/services/command/update_account_type.go +++ b/components/ledger/internal/services/command/update_account_type.go @@ -8,9 +8,9 @@ import ( "context" "errors" - libCommons "github.com/LerianStudio/lib-commons/v5/commons" - libLog "github.com/LerianStudio/lib-commons/v5/commons/log" - libOpentelemetry "github.com/LerianStudio/lib-commons/v5/commons/opentelemetry" + libCommons "github.com/LerianStudio/lib-observability" + libLog "github.com/LerianStudio/lib-observability/log" + libOpentelemetry "github.com/LerianStudio/lib-observability/tracing" "github.com/LerianStudio/midaz/v3/components/ledger/internal/services" "github.com/LerianStudio/midaz/v3/pkg" "github.com/LerianStudio/midaz/v3/pkg/constant" diff --git a/components/ledger/internal/services/command/update_asset.go b/components/ledger/internal/services/command/update_asset.go index 07a21d4dd..dc73621bc 100644 --- a/components/ledger/internal/services/command/update_asset.go +++ b/components/ledger/internal/services/command/update_asset.go @@ -10,9 +10,9 @@ import ( "fmt" "reflect" - libCommons "github.com/LerianStudio/lib-commons/v5/commons" - libLog "github.com/LerianStudio/lib-commons/v5/commons/log" - libOpentelemetry "github.com/LerianStudio/lib-commons/v5/commons/opentelemetry" + libCommons "github.com/LerianStudio/lib-observability" + libLog "github.com/LerianStudio/lib-observability/log" + libOpentelemetry "github.com/LerianStudio/lib-observability/tracing" libStreaming "github.com/LerianStudio/lib-streaming" "github.com/LerianStudio/midaz/v3/components/ledger/internal/services" "github.com/LerianStudio/midaz/v3/pkg" diff --git a/components/ledger/internal/services/command/update_balance.go b/components/ledger/internal/services/command/update_balance.go index 672dd55a5..be39a42a0 100644 --- a/components/ledger/internal/services/command/update_balance.go +++ b/components/ledger/internal/services/command/update_balance.go @@ -9,9 +9,9 @@ import ( "encoding/json" "fmt" - libCommons "github.com/LerianStudio/lib-commons/v5/commons" - libLog "github.com/LerianStudio/lib-commons/v5/commons/log" - libOpentelemetry "github.com/LerianStudio/lib-commons/v5/commons/opentelemetry" + libCommons "github.com/LerianStudio/lib-observability" + libLog "github.com/LerianStudio/lib-observability/log" + libOpentelemetry "github.com/LerianStudio/lib-observability/tracing" libStreaming "github.com/LerianStudio/lib-streaming" "github.com/LerianStudio/midaz/v3/pkg" "github.com/LerianStudio/midaz/v3/pkg/constant" diff --git a/components/ledger/internal/services/command/update_balance_overdraft.go b/components/ledger/internal/services/command/update_balance_overdraft.go index 08b4d6d91..e630aeb29 100644 --- a/components/ledger/internal/services/command/update_balance_overdraft.go +++ b/components/ledger/internal/services/command/update_balance_overdraft.go @@ -10,8 +10,8 @@ import ( "time" libCommons "github.com/LerianStudio/lib-commons/v5/commons" - libLog "github.com/LerianStudio/lib-commons/v5/commons/log" - libOpentelemetry "github.com/LerianStudio/lib-commons/v5/commons/opentelemetry" + libLog "github.com/LerianStudio/lib-observability/log" + libOpentelemetry "github.com/LerianStudio/lib-observability/tracing" "github.com/LerianStudio/midaz/v3/pkg" "github.com/LerianStudio/midaz/v3/pkg/constant" "github.com/LerianStudio/midaz/v3/pkg/mmodel" diff --git a/components/ledger/internal/services/command/update_ledger.go b/components/ledger/internal/services/command/update_ledger.go index 84c02f737..dee39d4f6 100644 --- a/components/ledger/internal/services/command/update_ledger.go +++ b/components/ledger/internal/services/command/update_ledger.go @@ -8,9 +8,9 @@ import ( "context" "errors" - libCommons "github.com/LerianStudio/lib-commons/v5/commons" - libLog "github.com/LerianStudio/lib-commons/v5/commons/log" - libOpentelemetry "github.com/LerianStudio/lib-commons/v5/commons/opentelemetry" + libCommons "github.com/LerianStudio/lib-observability" + libLog "github.com/LerianStudio/lib-observability/log" + libOpentelemetry "github.com/LerianStudio/lib-observability/tracing" libStreaming "github.com/LerianStudio/lib-streaming" "github.com/LerianStudio/midaz/v3/components/ledger/internal/services" "github.com/LerianStudio/midaz/v3/pkg" diff --git a/components/ledger/internal/services/command/update_ledger_settings.go b/components/ledger/internal/services/command/update_ledger_settings.go index 26781f830..d11fbb09b 100644 --- a/components/ledger/internal/services/command/update_ledger_settings.go +++ b/components/ledger/internal/services/command/update_ledger_settings.go @@ -8,9 +8,9 @@ import ( "context" "fmt" - libCommons "github.com/LerianStudio/lib-commons/v5/commons" - libLog "github.com/LerianStudio/lib-commons/v5/commons/log" - libOpentelemetry "github.com/LerianStudio/lib-commons/v5/commons/opentelemetry" + libCommons "github.com/LerianStudio/lib-observability" + libLog "github.com/LerianStudio/lib-observability/log" + libOpentelemetry "github.com/LerianStudio/lib-observability/tracing" "github.com/LerianStudio/midaz/v3/pkg/mmodel" "github.com/LerianStudio/midaz/v3/pkg/utils" "github.com/google/uuid" diff --git a/components/ledger/internal/services/command/update_onboarding_metadata.go b/components/ledger/internal/services/command/update_onboarding_metadata.go index 4aaa1b2e2..dffbd4572 100644 --- a/components/ledger/internal/services/command/update_onboarding_metadata.go +++ b/components/ledger/internal/services/command/update_onboarding_metadata.go @@ -9,12 +9,13 @@ import ( "fmt" libCommons "github.com/LerianStudio/lib-commons/v5/commons" - libLog "github.com/LerianStudio/lib-commons/v5/commons/log" - libOpentelemetry "github.com/LerianStudio/lib-commons/v5/commons/opentelemetry" + libObservability "github.com/LerianStudio/lib-observability" + libLog "github.com/LerianStudio/lib-observability/log" + libOpentelemetry "github.com/LerianStudio/lib-observability/tracing" ) func (uc *UseCase) UpdateOnboardingMetadata(ctx context.Context, entityName, entityID string, metadata map[string]any) (map[string]any, error) { - logger, tracer, _, _ := libCommons.NewTrackingFromContext(ctx) + logger, tracer, _, _ := libObservability.NewTrackingFromContext(ctx) ctx, span := tracer.Start(ctx, "command.update_metadata") defer span.End() diff --git a/components/ledger/internal/services/command/update_operation.go b/components/ledger/internal/services/command/update_operation.go index ea9f4d6d5..05f70203d 100644 --- a/components/ledger/internal/services/command/update_operation.go +++ b/components/ledger/internal/services/command/update_operation.go @@ -9,8 +9,8 @@ import ( "errors" "fmt" - libCommons "github.com/LerianStudio/lib-commons/v5/commons" - libOpentelemetry "github.com/LerianStudio/lib-commons/v5/commons/opentelemetry" + libCommons "github.com/LerianStudio/lib-observability" + libOpentelemetry "github.com/LerianStudio/lib-observability/tracing" "github.com/LerianStudio/midaz/v3/components/ledger/internal/adapters/postgres/operation" "github.com/LerianStudio/midaz/v3/components/ledger/internal/services" "github.com/LerianStudio/midaz/v3/pkg" @@ -18,7 +18,7 @@ import ( "github.com/google/uuid" // UpdateOperation update an operation from the repository by given id. - libLog "github.com/LerianStudio/lib-commons/v5/commons/log" + libLog "github.com/LerianStudio/lib-observability/log" ) func (uc *UseCase) UpdateOperation(ctx context.Context, organizationID, ledgerID, transactionID, operationID uuid.UUID, uoi *operation.UpdateOperationInput) (*operation.Operation, error) { diff --git a/components/ledger/internal/services/command/update_operation_route.go b/components/ledger/internal/services/command/update_operation_route.go index ea1e5c2c9..40f87cde3 100644 --- a/components/ledger/internal/services/command/update_operation_route.go +++ b/components/ledger/internal/services/command/update_operation_route.go @@ -8,9 +8,9 @@ import ( "context" "errors" - libCommons "github.com/LerianStudio/lib-commons/v5/commons" - libLog "github.com/LerianStudio/lib-commons/v5/commons/log" - libOpentelemetry "github.com/LerianStudio/lib-commons/v5/commons/opentelemetry" + libCommons "github.com/LerianStudio/lib-observability" + libLog "github.com/LerianStudio/lib-observability/log" + libOpentelemetry "github.com/LerianStudio/lib-observability/tracing" libStreaming "github.com/LerianStudio/lib-streaming" "github.com/LerianStudio/midaz/v3/components/ledger/internal/services" "github.com/LerianStudio/midaz/v3/pkg" @@ -32,7 +32,7 @@ func (uc *UseCase) UpdateOperationRoute(ctx context.Context, organizationID, led operationRoute := &mmodel.OperationRoute{ Title: input.Title, Description: input.Description, - Code: input.Code, + Code: input.Code, //nolint:staticcheck // legacy Code field persisted for backward compatibility Account: input.Account, AccountingEntries: input.AccountingEntries, AccountingEntriesRaw: input.AccountingEntriesRaw, diff --git a/components/ledger/internal/services/command/update_organization.go b/components/ledger/internal/services/command/update_organization.go index b4fc0c24c..79b0eb0a1 100644 --- a/components/ledger/internal/services/command/update_organization.go +++ b/components/ledger/internal/services/command/update_organization.go @@ -9,8 +9,9 @@ import ( "errors" libCommons "github.com/LerianStudio/lib-commons/v5/commons" - libLog "github.com/LerianStudio/lib-commons/v5/commons/log" - libOpentelemetry "github.com/LerianStudio/lib-commons/v5/commons/opentelemetry" + libObservability "github.com/LerianStudio/lib-observability" + libLog "github.com/LerianStudio/lib-observability/log" + libOpentelemetry "github.com/LerianStudio/lib-observability/tracing" libStreaming "github.com/LerianStudio/lib-streaming" "github.com/LerianStudio/midaz/v3/components/ledger/internal/services" "github.com/LerianStudio/midaz/v3/pkg" @@ -29,7 +30,7 @@ import ( // country code is valid (when an address is provided). Metadata is updated separately // via MongoDB after the organization record is persisted. func (uc *UseCase) UpdateOrganizationByID(ctx context.Context, id uuid.UUID, uoi *mmodel.UpdateOrganizationInput) (*mmodel.Organization, error) { - logger, tracer, _, _ := libCommons.NewTrackingFromContext(ctx) + logger, tracer, _, _ := libObservability.NewTrackingFromContext(ctx) ctx, span := tracer.Start(ctx, "command.update_organization_by_id") defer span.End() diff --git a/components/ledger/internal/services/command/update_portfolio.go b/components/ledger/internal/services/command/update_portfolio.go index 4ce7dd1b7..427957850 100644 --- a/components/ledger/internal/services/command/update_portfolio.go +++ b/components/ledger/internal/services/command/update_portfolio.go @@ -8,9 +8,9 @@ import ( "context" "errors" - libCommons "github.com/LerianStudio/lib-commons/v5/commons" - libLog "github.com/LerianStudio/lib-commons/v5/commons/log" - libOpentelemetry "github.com/LerianStudio/lib-commons/v5/commons/opentelemetry" + libCommons "github.com/LerianStudio/lib-observability" + libLog "github.com/LerianStudio/lib-observability/log" + libOpentelemetry "github.com/LerianStudio/lib-observability/tracing" libStreaming "github.com/LerianStudio/lib-streaming" "github.com/LerianStudio/midaz/v3/components/ledger/internal/services" "github.com/LerianStudio/midaz/v3/pkg" diff --git a/components/ledger/internal/services/command/update_segment.go b/components/ledger/internal/services/command/update_segment.go index 08b72b02e..d42ec8303 100644 --- a/components/ledger/internal/services/command/update_segment.go +++ b/components/ledger/internal/services/command/update_segment.go @@ -8,9 +8,9 @@ import ( "context" "errors" - libCommons "github.com/LerianStudio/lib-commons/v5/commons" - libLog "github.com/LerianStudio/lib-commons/v5/commons/log" - libOpentelemetry "github.com/LerianStudio/lib-commons/v5/commons/opentelemetry" + libCommons "github.com/LerianStudio/lib-observability" + libLog "github.com/LerianStudio/lib-observability/log" + libOpentelemetry "github.com/LerianStudio/lib-observability/tracing" libStreaming "github.com/LerianStudio/lib-streaming" "github.com/LerianStudio/midaz/v3/components/ledger/internal/services" "github.com/LerianStudio/midaz/v3/pkg" diff --git a/components/ledger/internal/services/command/update_transaction.go b/components/ledger/internal/services/command/update_transaction.go index f51621134..fd8afb7ab 100644 --- a/components/ledger/internal/services/command/update_transaction.go +++ b/components/ledger/internal/services/command/update_transaction.go @@ -9,8 +9,8 @@ import ( "errors" "fmt" - libCommons "github.com/LerianStudio/lib-commons/v5/commons" - libOpentelemetry "github.com/LerianStudio/lib-commons/v5/commons/opentelemetry" + libCommons "github.com/LerianStudio/lib-observability" + libOpentelemetry "github.com/LerianStudio/lib-observability/tracing" "github.com/LerianStudio/midaz/v3/components/ledger/internal/adapters/postgres/transaction" "github.com/LerianStudio/midaz/v3/components/ledger/internal/services" "github.com/LerianStudio/midaz/v3/pkg" @@ -18,7 +18,7 @@ import ( "github.com/google/uuid" // UpdateTransaction update a transaction from the repository by given id. - libLog "github.com/LerianStudio/lib-commons/v5/commons/log" + libLog "github.com/LerianStudio/lib-observability/log" ) func (uc *UseCase) UpdateTransaction(ctx context.Context, organizationID, ledgerID, transactionID uuid.UUID, uti *transaction.UpdateTransactionInput) (*transaction.Transaction, error) { diff --git a/components/ledger/internal/services/command/update_transaction_metadata.go b/components/ledger/internal/services/command/update_transaction_metadata.go index 697c97fd1..f43d78937 100644 --- a/components/ledger/internal/services/command/update_transaction_metadata.go +++ b/components/ledger/internal/services/command/update_transaction_metadata.go @@ -9,12 +9,13 @@ import ( "fmt" libCommons "github.com/LerianStudio/lib-commons/v5/commons" - libLog "github.com/LerianStudio/lib-commons/v5/commons/log" - libOpentelemetry "github.com/LerianStudio/lib-commons/v5/commons/opentelemetry" + libObservability "github.com/LerianStudio/lib-observability" + libLog "github.com/LerianStudio/lib-observability/log" + libOpentelemetry "github.com/LerianStudio/lib-observability/tracing" ) func (uc *UseCase) UpdateTransactionMetadata(ctx context.Context, entityName, entityID string, metadata map[string]any) (map[string]any, error) { - logger, tracer, _, _ := libCommons.NewTrackingFromContext(ctx) + logger, tracer, _, _ := libObservability.NewTrackingFromContext(ctx) ctx, span := tracer.Start(ctx, "command.update_metadata") defer span.End() diff --git a/components/ledger/internal/services/command/update_transaction_route.go b/components/ledger/internal/services/command/update_transaction_route.go index 6f3952e84..5394763cb 100644 --- a/components/ledger/internal/services/command/update_transaction_route.go +++ b/components/ledger/internal/services/command/update_transaction_route.go @@ -8,9 +8,9 @@ import ( "context" "errors" - libCommons "github.com/LerianStudio/lib-commons/v5/commons" - libLog "github.com/LerianStudio/lib-commons/v5/commons/log" - libOpentelemetry "github.com/LerianStudio/lib-commons/v5/commons/opentelemetry" + libCommons "github.com/LerianStudio/lib-observability" + libLog "github.com/LerianStudio/lib-observability/log" + libOpentelemetry "github.com/LerianStudio/lib-observability/tracing" libStreaming "github.com/LerianStudio/lib-streaming" "github.com/LerianStudio/midaz/v3/components/ledger/internal/services" "github.com/LerianStudio/midaz/v3/pkg" diff --git a/components/ledger/internal/services/command/update_write_behind_transaction.go b/components/ledger/internal/services/command/update_write_behind_transaction.go index d240031f7..ae9f88e32 100644 --- a/components/ledger/internal/services/command/update_write_behind_transaction.go +++ b/components/ledger/internal/services/command/update_write_behind_transaction.go @@ -9,8 +9,8 @@ import ( "fmt" "time" - libCommons "github.com/LerianStudio/lib-commons/v5/commons" - libOpentelemetry "github.com/LerianStudio/lib-commons/v5/commons/opentelemetry" + libCommons "github.com/LerianStudio/lib-observability" + libOpentelemetry "github.com/LerianStudio/lib-observability/tracing" "github.com/LerianStudio/midaz/v3/components/ledger/internal/adapters/postgres/transaction" "github.com/LerianStudio/midaz/v3/pkg/utils" "github.com/google/uuid" @@ -19,7 +19,7 @@ import ( // UpdateWriteBehindTransaction re-serializes and updates the transaction in the write-behind cache. // Called after cancel/commit to reflect the updated status and operations. Errors are logged but // do not block the transaction flow. - libLog "github.com/LerianStudio/lib-commons/v5/commons/log" + libLog "github.com/LerianStudio/lib-observability/log" ) func (uc *UseCase) UpdateWriteBehindTransaction(ctx context.Context, organizationID, ledgerID uuid.UUID, tran *transaction.Transaction) { diff --git a/components/ledger/internal/services/command/write_transaction.go b/components/ledger/internal/services/command/write_transaction.go index 423bf9eee..076efa800 100644 --- a/components/ledger/internal/services/command/write_transaction.go +++ b/components/ledger/internal/services/command/write_transaction.go @@ -10,8 +10,8 @@ import ( "os" "strings" - libCommons "github.com/LerianStudio/lib-commons/v5/commons" - libOpentelemetry "github.com/LerianStudio/lib-commons/v5/commons/opentelemetry" + libCommons "github.com/LerianStudio/lib-observability" + libOpentelemetry "github.com/LerianStudio/lib-observability/tracing" "github.com/LerianStudio/midaz/v3/components/ledger/internal/adapters/postgres/transaction" "github.com/LerianStudio/midaz/v3/pkg/mmodel" "github.com/LerianStudio/midaz/v3/pkg/mtransaction" @@ -20,7 +20,7 @@ import ( // WriteTransaction routes the transaction to sync or async execution // based on the RABBITMQ_TRANSACTION_ASYNC environment variable. - libLog "github.com/LerianStudio/lib-commons/v5/commons/log" + libLog "github.com/LerianStudio/lib-observability/log" ) func (uc *UseCase) WriteTransaction(ctx context.Context, organizationID, ledgerID uuid.UUID, transactionInput *mtransaction.Transaction, validate *mtransaction.Responses, blc []*mmodel.Balance, blcAfter []*mmodel.Balance, tran *transaction.Transaction) error { diff --git a/components/ledger/internal/services/query/count_accounts.go b/components/ledger/internal/services/query/count_accounts.go index 67e897619..964fac218 100644 --- a/components/ledger/internal/services/query/count_accounts.go +++ b/components/ledger/internal/services/query/count_accounts.go @@ -10,8 +10,8 @@ import ( "fmt" "reflect" - libCommons "github.com/LerianStudio/lib-commons/v5/commons" - libOpentelemetry "github.com/LerianStudio/lib-commons/v5/commons/opentelemetry" + libCommons "github.com/LerianStudio/lib-observability" + libOpentelemetry "github.com/LerianStudio/lib-observability/tracing" "github.com/LerianStudio/midaz/v3/components/ledger/internal/services" "github.com/LerianStudio/midaz/v3/pkg" "github.com/LerianStudio/midaz/v3/pkg/constant" @@ -19,7 +19,7 @@ import ( "github.com/google/uuid" // CountAccounts returns the number of accounts for the specified organization, ledger and optional portfolio. - libLog "github.com/LerianStudio/lib-commons/v5/commons/log" + libLog "github.com/LerianStudio/lib-observability/log" ) func (uc *UseCase) CountAccounts(ctx context.Context, organizationID, ledgerID uuid.UUID) (int64, error) { diff --git a/components/ledger/internal/services/query/count_assets.go b/components/ledger/internal/services/query/count_assets.go index dc35646f4..c06d62aac 100644 --- a/components/ledger/internal/services/query/count_assets.go +++ b/components/ledger/internal/services/query/count_assets.go @@ -10,9 +10,9 @@ import ( "fmt" "reflect" - libCommons "github.com/LerianStudio/lib-commons/v5/commons" - libLog "github.com/LerianStudio/lib-commons/v5/commons/log" - libOpentelemetry "github.com/LerianStudio/lib-commons/v5/commons/opentelemetry" + libCommons "github.com/LerianStudio/lib-observability" + libLog "github.com/LerianStudio/lib-observability/log" + libOpentelemetry "github.com/LerianStudio/lib-observability/tracing" "github.com/LerianStudio/midaz/v3/components/ledger/internal/services" "github.com/LerianStudio/midaz/v3/pkg" "github.com/LerianStudio/midaz/v3/pkg/constant" diff --git a/components/ledger/internal/services/query/count_ledgers.go b/components/ledger/internal/services/query/count_ledgers.go index bd7d4f890..c64e8674b 100644 --- a/components/ledger/internal/services/query/count_ledgers.go +++ b/components/ledger/internal/services/query/count_ledgers.go @@ -10,9 +10,9 @@ import ( "fmt" "reflect" - libCommons "github.com/LerianStudio/lib-commons/v5/commons" - libLog "github.com/LerianStudio/lib-commons/v5/commons/log" - libOpentelemetry "github.com/LerianStudio/lib-commons/v5/commons/opentelemetry" + libCommons "github.com/LerianStudio/lib-observability" + libLog "github.com/LerianStudio/lib-observability/log" + libOpentelemetry "github.com/LerianStudio/lib-observability/tracing" "github.com/LerianStudio/midaz/v3/components/ledger/internal/services" "github.com/LerianStudio/midaz/v3/pkg" "github.com/LerianStudio/midaz/v3/pkg/constant" diff --git a/components/ledger/internal/services/query/count_organizations.go b/components/ledger/internal/services/query/count_organizations.go index 0893f3003..73815fab8 100644 --- a/components/ledger/internal/services/query/count_organizations.go +++ b/components/ledger/internal/services/query/count_organizations.go @@ -10,15 +10,15 @@ import ( "fmt" "reflect" - libCommons "github.com/LerianStudio/lib-commons/v5/commons" - libOpentelemetry "github.com/LerianStudio/lib-commons/v5/commons/opentelemetry" + libCommons "github.com/LerianStudio/lib-observability" + libOpentelemetry "github.com/LerianStudio/lib-observability/tracing" "github.com/LerianStudio/midaz/v3/components/ledger/internal/services" "github.com/LerianStudio/midaz/v3/pkg" "github.com/LerianStudio/midaz/v3/pkg/constant" "github.com/LerianStudio/midaz/v3/pkg/mmodel" // CountOrganizations returns the total count of organizations - libLog "github.com/LerianStudio/lib-commons/v5/commons/log" + libLog "github.com/LerianStudio/lib-observability/log" ) func (uc *UseCase) CountOrganizations(ctx context.Context) (int64, error) { diff --git a/components/ledger/internal/services/query/count_portfolios.go b/components/ledger/internal/services/query/count_portfolios.go index cd5665e02..f20eb79b3 100644 --- a/components/ledger/internal/services/query/count_portfolios.go +++ b/components/ledger/internal/services/query/count_portfolios.go @@ -10,8 +10,8 @@ import ( "fmt" "reflect" - libCommons "github.com/LerianStudio/lib-commons/v5/commons" - libOpentelemetry "github.com/LerianStudio/lib-commons/v5/commons/opentelemetry" + libCommons "github.com/LerianStudio/lib-observability" + libOpentelemetry "github.com/LerianStudio/lib-observability/tracing" "github.com/LerianStudio/midaz/v3/components/ledger/internal/services" "github.com/LerianStudio/midaz/v3/pkg" "github.com/LerianStudio/midaz/v3/pkg/constant" @@ -19,7 +19,7 @@ import ( "github.com/google/uuid" // CountPortfolios returns the number of portfolios for the specified organization and ledger. - libLog "github.com/LerianStudio/lib-commons/v5/commons/log" + libLog "github.com/LerianStudio/lib-observability/log" ) func (uc *UseCase) CountPortfolios(ctx context.Context, organizationID, ledgerID uuid.UUID) (int64, error) { diff --git a/components/ledger/internal/services/query/count_segments.go b/components/ledger/internal/services/query/count_segments.go index fd9f891c3..b64c80b1e 100644 --- a/components/ledger/internal/services/query/count_segments.go +++ b/components/ledger/internal/services/query/count_segments.go @@ -9,9 +9,9 @@ import ( "errors" "fmt" - libCommons "github.com/LerianStudio/lib-commons/v5/commons" - libLog "github.com/LerianStudio/lib-commons/v5/commons/log" - libOpentelemetry "github.com/LerianStudio/lib-commons/v5/commons/opentelemetry" + libCommons "github.com/LerianStudio/lib-observability" + libLog "github.com/LerianStudio/lib-observability/log" + libOpentelemetry "github.com/LerianStudio/lib-observability/tracing" "github.com/LerianStudio/midaz/v3/components/ledger/internal/services" "github.com/LerianStudio/midaz/v3/pkg" "github.com/LerianStudio/midaz/v3/pkg/constant" diff --git a/components/ledger/internal/services/query/count_transactions_by_filters.go b/components/ledger/internal/services/query/count_transactions_by_filters.go index 94b65298d..56c8aa92a 100644 --- a/components/ledger/internal/services/query/count_transactions_by_filters.go +++ b/components/ledger/internal/services/query/count_transactions_by_filters.go @@ -8,9 +8,9 @@ import ( "context" "fmt" - libCommons "github.com/LerianStudio/lib-commons/v5/commons" - libLog "github.com/LerianStudio/lib-commons/v5/commons/log" - libOpentelemetry "github.com/LerianStudio/lib-commons/v5/commons/opentelemetry" + libCommons "github.com/LerianStudio/lib-observability" + libLog "github.com/LerianStudio/lib-observability/log" + libOpentelemetry "github.com/LerianStudio/lib-observability/tracing" "github.com/LerianStudio/midaz/v3/components/ledger/internal/adapters/postgres/transaction" "github.com/google/uuid" ) diff --git a/components/ledger/internal/services/query/enrich_transaction_routes.go b/components/ledger/internal/services/query/enrich_transaction_routes.go index 04d779758..91ee125c6 100644 --- a/components/ledger/internal/services/query/enrich_transaction_routes.go +++ b/components/ledger/internal/services/query/enrich_transaction_routes.go @@ -8,9 +8,9 @@ import ( "context" "fmt" - libCommons "github.com/LerianStudio/lib-commons/v5/commons" - libLog "github.com/LerianStudio/lib-commons/v5/commons/log" - libOpentelemetry "github.com/LerianStudio/lib-commons/v5/commons/opentelemetry" + libCommons "github.com/LerianStudio/lib-observability" + libLog "github.com/LerianStudio/lib-observability/log" + libOpentelemetry "github.com/LerianStudio/lib-observability/tracing" "github.com/LerianStudio/midaz/v3/pkg/mmodel" "github.com/google/uuid" ) diff --git a/components/ledger/internal/services/query/get_account_balances_at_timestamp.go b/components/ledger/internal/services/query/get_account_balances_at_timestamp.go index b92b8c0b6..995d5d07e 100644 --- a/components/ledger/internal/services/query/get_account_balances_at_timestamp.go +++ b/components/ledger/internal/services/query/get_account_balances_at_timestamp.go @@ -9,8 +9,8 @@ import ( "fmt" "time" - libCommons "github.com/LerianStudio/lib-commons/v5/commons" - libOpentelemetry "github.com/LerianStudio/lib-commons/v5/commons/opentelemetry" + libCommons "github.com/LerianStudio/lib-observability" + libOpentelemetry "github.com/LerianStudio/lib-observability/tracing" "github.com/LerianStudio/midaz/v3/pkg" "github.com/LerianStudio/midaz/v3/pkg/constant" "github.com/LerianStudio/midaz/v3/pkg/mmodel" @@ -19,7 +19,7 @@ import ( // GetAccountBalancesAtTimestamp retrieves all balance states for an account at a specific point in time. // It uses a single optimized query with LEFT JOIN to fetch balance states, avoiding multiple round-trips. // Balances without operations at the timestamp are returned with zero values (initial state). - libLog "github.com/LerianStudio/lib-commons/v5/commons/log" + libLog "github.com/LerianStudio/lib-observability/log" ) func (uc *UseCase) GetAccountBalancesAtTimestamp(ctx context.Context, organizationID, ledgerID, accountID uuid.UUID, timestamp time.Time) ([]*mmodel.Balance, error) { diff --git a/components/ledger/internal/services/query/get_alias_account.go b/components/ledger/internal/services/query/get_alias_account.go index 4204fa552..a770c5924 100644 --- a/components/ledger/internal/services/query/get_alias_account.go +++ b/components/ledger/internal/services/query/get_alias_account.go @@ -10,9 +10,9 @@ import ( "fmt" "reflect" - libCommons "github.com/LerianStudio/lib-commons/v5/commons" - libLog "github.com/LerianStudio/lib-commons/v5/commons/log" - libOpentelemetry "github.com/LerianStudio/lib-commons/v5/commons/opentelemetry" + libCommons "github.com/LerianStudio/lib-observability" + libLog "github.com/LerianStudio/lib-observability/log" + libOpentelemetry "github.com/LerianStudio/lib-observability/tracing" "github.com/LerianStudio/midaz/v3/components/ledger/internal/services" "github.com/LerianStudio/midaz/v3/pkg" "github.com/LerianStudio/midaz/v3/pkg/constant" diff --git a/components/ledger/internal/services/query/get_alias_accounts.go b/components/ledger/internal/services/query/get_alias_accounts.go index 7a7385f4d..91ec814c3 100644 --- a/components/ledger/internal/services/query/get_alias_accounts.go +++ b/components/ledger/internal/services/query/get_alias_accounts.go @@ -10,9 +10,9 @@ import ( "fmt" "reflect" - libCommons "github.com/LerianStudio/lib-commons/v5/commons" - libLog "github.com/LerianStudio/lib-commons/v5/commons/log" - libOpentelemetry "github.com/LerianStudio/lib-commons/v5/commons/opentelemetry" + libCommons "github.com/LerianStudio/lib-observability" + libLog "github.com/LerianStudio/lib-observability/log" + libOpentelemetry "github.com/LerianStudio/lib-observability/tracing" "github.com/LerianStudio/midaz/v3/components/ledger/internal/services" "github.com/LerianStudio/midaz/v3/pkg" "github.com/LerianStudio/midaz/v3/pkg/constant" diff --git a/components/ledger/internal/services/query/get_all_account_type.go b/components/ledger/internal/services/query/get_all_account_type.go index fd5f5bd3f..948402e5a 100644 --- a/components/ledger/internal/services/query/get_all_account_type.go +++ b/components/ledger/internal/services/query/get_all_account_type.go @@ -9,10 +9,10 @@ import ( "errors" "fmt" - libCommons "github.com/LerianStudio/lib-commons/v5/commons" - libLog "github.com/LerianStudio/lib-commons/v5/commons/log" + libCommons "github.com/LerianStudio/lib-observability" + libLog "github.com/LerianStudio/lib-observability/log" libHTTP "github.com/LerianStudio/lib-commons/v5/commons/net/http" - libOpentelemetry "github.com/LerianStudio/lib-commons/v5/commons/opentelemetry" + libOpentelemetry "github.com/LerianStudio/lib-observability/tracing" "github.com/LerianStudio/midaz/v3/components/ledger/internal/services" "github.com/LerianStudio/midaz/v3/pkg" "github.com/LerianStudio/midaz/v3/pkg/constant" diff --git a/components/ledger/internal/services/query/get_all_accounts.go b/components/ledger/internal/services/query/get_all_accounts.go index 0447a3c63..1dc14cd85 100644 --- a/components/ledger/internal/services/query/get_all_accounts.go +++ b/components/ledger/internal/services/query/get_all_accounts.go @@ -10,9 +10,9 @@ import ( "fmt" "reflect" - libCommons "github.com/LerianStudio/lib-commons/v5/commons" - libLog "github.com/LerianStudio/lib-commons/v5/commons/log" - libOpentelemetry "github.com/LerianStudio/lib-commons/v5/commons/opentelemetry" + libCommons "github.com/LerianStudio/lib-observability" + libLog "github.com/LerianStudio/lib-observability/log" + libOpentelemetry "github.com/LerianStudio/lib-observability/tracing" "github.com/LerianStudio/midaz/v3/components/ledger/internal/services" "github.com/LerianStudio/midaz/v3/pkg" "github.com/LerianStudio/midaz/v3/pkg/constant" diff --git a/components/ledger/internal/services/query/get_all_asset.go b/components/ledger/internal/services/query/get_all_asset.go index a9d7a35f2..913c4388b 100644 --- a/components/ledger/internal/services/query/get_all_asset.go +++ b/components/ledger/internal/services/query/get_all_asset.go @@ -10,9 +10,9 @@ import ( "fmt" "reflect" - libCommons "github.com/LerianStudio/lib-commons/v5/commons" - libLog "github.com/LerianStudio/lib-commons/v5/commons/log" - libOpentelemetry "github.com/LerianStudio/lib-commons/v5/commons/opentelemetry" + libCommons "github.com/LerianStudio/lib-observability" + libLog "github.com/LerianStudio/lib-observability/log" + libOpentelemetry "github.com/LerianStudio/lib-observability/tracing" "github.com/LerianStudio/midaz/v3/components/ledger/internal/services" "github.com/LerianStudio/midaz/v3/pkg" "github.com/LerianStudio/midaz/v3/pkg/constant" diff --git a/components/ledger/internal/services/query/get_all_assetrates_assetcode.go b/components/ledger/internal/services/query/get_all_assetrates_assetcode.go index 048a01c96..606110658 100644 --- a/components/ledger/internal/services/query/get_all_assetrates_assetcode.go +++ b/components/ledger/internal/services/query/get_all_assetrates_assetcode.go @@ -9,9 +9,9 @@ import ( "fmt" "reflect" - libCommons "github.com/LerianStudio/lib-commons/v5/commons" + libCommons "github.com/LerianStudio/lib-observability" libHTTP "github.com/LerianStudio/lib-commons/v5/commons/net/http" - libOpentelemetry "github.com/LerianStudio/lib-commons/v5/commons/opentelemetry" + libOpentelemetry "github.com/LerianStudio/lib-observability/tracing" "github.com/LerianStudio/midaz/v3/components/ledger/internal/adapters/postgres/assetrate" "github.com/LerianStudio/midaz/v3/pkg" "github.com/LerianStudio/midaz/v3/pkg/net/http" @@ -19,7 +19,7 @@ import ( "github.com/google/uuid" // GetAllAssetRatesByAssetCode returns all asset rates by asset codes. - libLog "github.com/LerianStudio/lib-commons/v5/commons/log" + libLog "github.com/LerianStudio/lib-observability/log" ) func (uc *UseCase) GetAllAssetRatesByAssetCode(ctx context.Context, organizationID, ledgerID uuid.UUID, fromAssetCode string, filter http.QueryHeader) ([]*assetrate.AssetRate, libHTTP.CursorPagination, error) { diff --git a/components/ledger/internal/services/query/get_all_balances.go b/components/ledger/internal/services/query/get_all_balances.go index 3827a63ee..15b3ce594 100644 --- a/components/ledger/internal/services/query/get_all_balances.go +++ b/components/ledger/internal/services/query/get_all_balances.go @@ -9,9 +9,9 @@ import ( "encoding/json" "fmt" - libCommons "github.com/LerianStudio/lib-commons/v5/commons" + libCommons "github.com/LerianStudio/lib-observability" libHTTP "github.com/LerianStudio/lib-commons/v5/commons/net/http" - libOpentelemetry "github.com/LerianStudio/lib-commons/v5/commons/opentelemetry" + libOpentelemetry "github.com/LerianStudio/lib-observability/tracing" "github.com/LerianStudio/midaz/v3/pkg/mmodel" "github.com/LerianStudio/midaz/v3/pkg/net/http" "github.com/LerianStudio/midaz/v3/pkg/utils" @@ -20,7 +20,7 @@ import ( // GetAllBalances methods responsible to get all balances from a database. // This method is used to get all balances from a database and return them in a cursor pagination format. // It also validates if the balance is currently in the redis cache and if so, it uses the cached values instead of the database values. - libLog "github.com/LerianStudio/lib-commons/v5/commons/log" + libLog "github.com/LerianStudio/lib-observability/log" ) func (uc *UseCase) GetAllBalances(ctx context.Context, organizationID, ledgerID uuid.UUID, filter http.QueryHeader) ([]*mmodel.Balance, libHTTP.CursorPagination, error) { diff --git a/components/ledger/internal/services/query/get_all_balances_account.go b/components/ledger/internal/services/query/get_all_balances_account.go index 9f5c1e551..935844aee 100644 --- a/components/ledger/internal/services/query/get_all_balances_account.go +++ b/components/ledger/internal/services/query/get_all_balances_account.go @@ -9,9 +9,9 @@ import ( "encoding/json" "fmt" - libCommons "github.com/LerianStudio/lib-commons/v5/commons" + libCommons "github.com/LerianStudio/lib-observability" libHTTP "github.com/LerianStudio/lib-commons/v5/commons/net/http" - libOpentelemetry "github.com/LerianStudio/lib-commons/v5/commons/opentelemetry" + libOpentelemetry "github.com/LerianStudio/lib-observability/tracing" "github.com/LerianStudio/midaz/v3/pkg/mmodel" "github.com/LerianStudio/midaz/v3/pkg/net/http" "github.com/LerianStudio/midaz/v3/pkg/utils" @@ -20,7 +20,7 @@ import ( // GetAllBalancesByAccountID methods responsible to get all balances by account id from a database. // This method is used to get all balances by account id from a database and return them in a cursor pagination format. // It also validates if the balance is currently in the redis cache and if so, it uses the cached values instead of the database values. - libLog "github.com/LerianStudio/lib-commons/v5/commons/log" + libLog "github.com/LerianStudio/lib-observability/log" ) func (uc *UseCase) GetAllBalancesByAccountID(ctx context.Context, organizationID, ledgerID, accountID uuid.UUID, filter http.QueryHeader) ([]*mmodel.Balance, libHTTP.CursorPagination, error) { diff --git a/components/ledger/internal/services/query/get_all_ledgers.go b/components/ledger/internal/services/query/get_all_ledgers.go index 0e3a6aa82..8ad1cf46f 100644 --- a/components/ledger/internal/services/query/get_all_ledgers.go +++ b/components/ledger/internal/services/query/get_all_ledgers.go @@ -9,9 +9,9 @@ import ( "errors" "reflect" - libCommons "github.com/LerianStudio/lib-commons/v5/commons" - libLog "github.com/LerianStudio/lib-commons/v5/commons/log" - libOpentelemetry "github.com/LerianStudio/lib-commons/v5/commons/opentelemetry" + libCommons "github.com/LerianStudio/lib-observability" + libLog "github.com/LerianStudio/lib-observability/log" + libOpentelemetry "github.com/LerianStudio/lib-observability/tracing" "github.com/LerianStudio/midaz/v3/components/ledger/internal/services" "github.com/LerianStudio/midaz/v3/pkg" "github.com/LerianStudio/midaz/v3/pkg/constant" diff --git a/components/ledger/internal/services/query/get_all_metadata_account_type.go b/components/ledger/internal/services/query/get_all_metadata_account_type.go index fb69e9125..90ed152d1 100644 --- a/components/ledger/internal/services/query/get_all_metadata_account_type.go +++ b/components/ledger/internal/services/query/get_all_metadata_account_type.go @@ -8,9 +8,9 @@ import ( "context" "errors" - libCommons "github.com/LerianStudio/lib-commons/v5/commons" + libCommons "github.com/LerianStudio/lib-observability" libHTTP "github.com/LerianStudio/lib-commons/v5/commons/net/http" - libOpentelemetry "github.com/LerianStudio/lib-commons/v5/commons/opentelemetry" + libOpentelemetry "github.com/LerianStudio/lib-observability/tracing" "github.com/LerianStudio/midaz/v3/components/ledger/internal/services" "github.com/LerianStudio/midaz/v3/pkg" "github.com/LerianStudio/midaz/v3/pkg/constant" @@ -19,7 +19,7 @@ import ( "github.com/google/uuid" // GetAllMetadataAccountType fetch all Account Types from the repository filtered by metadata - libLog "github.com/LerianStudio/lib-commons/v5/commons/log" + libLog "github.com/LerianStudio/lib-observability/log" ) func (uc *UseCase) GetAllMetadataAccountType(ctx context.Context, organizationID, ledgerID uuid.UUID, filter http.QueryHeader) ([]*mmodel.AccountType, libHTTP.CursorPagination, error) { diff --git a/components/ledger/internal/services/query/get_all_metadata_accounts.go b/components/ledger/internal/services/query/get_all_metadata_accounts.go index 9a1e165fc..745720211 100644 --- a/components/ledger/internal/services/query/get_all_metadata_accounts.go +++ b/components/ledger/internal/services/query/get_all_metadata_accounts.go @@ -9,9 +9,9 @@ import ( "errors" "reflect" - libCommons "github.com/LerianStudio/lib-commons/v5/commons" - libLog "github.com/LerianStudio/lib-commons/v5/commons/log" - libOpentelemetry "github.com/LerianStudio/lib-commons/v5/commons/opentelemetry" + libCommons "github.com/LerianStudio/lib-observability" + libLog "github.com/LerianStudio/lib-observability/log" + libOpentelemetry "github.com/LerianStudio/lib-observability/tracing" "github.com/LerianStudio/midaz/v3/components/ledger/internal/services" "github.com/LerianStudio/midaz/v3/pkg" "github.com/LerianStudio/midaz/v3/pkg/constant" diff --git a/components/ledger/internal/services/query/get_all_metadata_asset.go b/components/ledger/internal/services/query/get_all_metadata_asset.go index cd6cafd86..bb04e351a 100644 --- a/components/ledger/internal/services/query/get_all_metadata_asset.go +++ b/components/ledger/internal/services/query/get_all_metadata_asset.go @@ -9,9 +9,9 @@ import ( "errors" "reflect" - libCommons "github.com/LerianStudio/lib-commons/v5/commons" - libLog "github.com/LerianStudio/lib-commons/v5/commons/log" - libOpentelemetry "github.com/LerianStudio/lib-commons/v5/commons/opentelemetry" + libCommons "github.com/LerianStudio/lib-observability" + libLog "github.com/LerianStudio/lib-observability/log" + libOpentelemetry "github.com/LerianStudio/lib-observability/tracing" "github.com/LerianStudio/midaz/v3/components/ledger/internal/services" "github.com/LerianStudio/midaz/v3/pkg" "github.com/LerianStudio/midaz/v3/pkg/constant" diff --git a/components/ledger/internal/services/query/get_all_metadata_index.go b/components/ledger/internal/services/query/get_all_metadata_index.go index 5bac6b122..351c3fc89 100644 --- a/components/ledger/internal/services/query/get_all_metadata_index.go +++ b/components/ledger/internal/services/query/get_all_metadata_index.go @@ -8,15 +8,15 @@ import ( "context" "fmt" - libCommons "github.com/LerianStudio/lib-commons/v5/commons" - libOpentelemetry "github.com/LerianStudio/lib-commons/v5/commons/opentelemetry" + libCommons "github.com/LerianStudio/lib-observability" + libOpentelemetry "github.com/LerianStudio/lib-observability/tracing" "github.com/LerianStudio/midaz/v3/pkg" "github.com/LerianStudio/midaz/v3/pkg/constant" "github.com/LerianStudio/midaz/v3/pkg/mmodel" "github.com/LerianStudio/midaz/v3/pkg/net/http" // GetAllMetadataIndexes returns all metadata indexes, optionally filtered by entity name - libLog "github.com/LerianStudio/lib-commons/v5/commons/log" + libLog "github.com/LerianStudio/lib-observability/log" ) func (uc *UseCase) GetAllMetadataIndexes(ctx context.Context, filter http.QueryHeader) ([]*mmodel.MetadataIndex, error) { diff --git a/components/ledger/internal/services/query/get_all_metadata_ledgers.go b/components/ledger/internal/services/query/get_all_metadata_ledgers.go index d69622f74..824568518 100644 --- a/components/ledger/internal/services/query/get_all_metadata_ledgers.go +++ b/components/ledger/internal/services/query/get_all_metadata_ledgers.go @@ -9,9 +9,9 @@ import ( "errors" "reflect" - libCommons "github.com/LerianStudio/lib-commons/v5/commons" - libLog "github.com/LerianStudio/lib-commons/v5/commons/log" - libOpentelemetry "github.com/LerianStudio/lib-commons/v5/commons/opentelemetry" + libCommons "github.com/LerianStudio/lib-observability" + libLog "github.com/LerianStudio/lib-observability/log" + libOpentelemetry "github.com/LerianStudio/lib-observability/tracing" "github.com/LerianStudio/midaz/v3/components/ledger/internal/services" "github.com/LerianStudio/midaz/v3/pkg" "github.com/LerianStudio/midaz/v3/pkg/constant" diff --git a/components/ledger/internal/services/query/get_all_metadata_operation_routes.go b/components/ledger/internal/services/query/get_all_metadata_operation_routes.go index 7a53d2f26..42acef427 100644 --- a/components/ledger/internal/services/query/get_all_metadata_operation_routes.go +++ b/components/ledger/internal/services/query/get_all_metadata_operation_routes.go @@ -9,9 +9,9 @@ import ( "errors" "fmt" - libCommons "github.com/LerianStudio/lib-commons/v5/commons" + libCommons "github.com/LerianStudio/lib-observability" libHTTP "github.com/LerianStudio/lib-commons/v5/commons/net/http" - libOpentelemetry "github.com/LerianStudio/lib-commons/v5/commons/opentelemetry" + libOpentelemetry "github.com/LerianStudio/lib-observability/tracing" "github.com/LerianStudio/midaz/v3/components/ledger/internal/services" "github.com/LerianStudio/midaz/v3/pkg" "github.com/LerianStudio/midaz/v3/pkg/constant" @@ -20,7 +20,7 @@ import ( "github.com/google/uuid" // GetAllMetadataOperationRoutes fetch all Operation Routes from the repository filtered by metadata - libLog "github.com/LerianStudio/lib-commons/v5/commons/log" + libLog "github.com/LerianStudio/lib-observability/log" ) func (uc *UseCase) GetAllMetadataOperationRoutes(ctx context.Context, organizationID, ledgerID uuid.UUID, filter http.QueryHeader) ([]*mmodel.OperationRoute, libHTTP.CursorPagination, error) { diff --git a/components/ledger/internal/services/query/get_all_metadata_operations.go b/components/ledger/internal/services/query/get_all_metadata_operations.go index 4140317de..85309120d 100644 --- a/components/ledger/internal/services/query/get_all_metadata_operations.go +++ b/components/ledger/internal/services/query/get_all_metadata_operations.go @@ -9,9 +9,9 @@ import ( "errors" "fmt" - libCommons "github.com/LerianStudio/lib-commons/v5/commons" + libCommons "github.com/LerianStudio/lib-observability" libHTTP "github.com/LerianStudio/lib-commons/v5/commons/net/http" - libOpentelemetry "github.com/LerianStudio/lib-commons/v5/commons/opentelemetry" + libOpentelemetry "github.com/LerianStudio/lib-observability/tracing" "github.com/LerianStudio/midaz/v3/components/ledger/internal/adapters/postgres/operation" "github.com/LerianStudio/midaz/v3/components/ledger/internal/services" "github.com/LerianStudio/midaz/v3/pkg" @@ -20,7 +20,7 @@ import ( "github.com/google/uuid" // GetAllMetadataOperations fetch all Operations from the repository - libLog "github.com/LerianStudio/lib-commons/v5/commons/log" + libLog "github.com/LerianStudio/lib-observability/log" ) func (uc *UseCase) GetAllMetadataOperations(ctx context.Context, organizationID, ledgerID, accountID uuid.UUID, filter http.QueryHeader) ([]*operation.Operation, libHTTP.CursorPagination, error) { diff --git a/components/ledger/internal/services/query/get_all_metadata_organizations.go b/components/ledger/internal/services/query/get_all_metadata_organizations.go index 2d0ab6118..2e15345ad 100644 --- a/components/ledger/internal/services/query/get_all_metadata_organizations.go +++ b/components/ledger/internal/services/query/get_all_metadata_organizations.go @@ -9,9 +9,9 @@ import ( "errors" "reflect" - libCommons "github.com/LerianStudio/lib-commons/v5/commons" - libLog "github.com/LerianStudio/lib-commons/v5/commons/log" - libOpentelemetry "github.com/LerianStudio/lib-commons/v5/commons/opentelemetry" + libCommons "github.com/LerianStudio/lib-observability" + libLog "github.com/LerianStudio/lib-observability/log" + libOpentelemetry "github.com/LerianStudio/lib-observability/tracing" "github.com/LerianStudio/midaz/v3/components/ledger/internal/services" "github.com/LerianStudio/midaz/v3/pkg" "github.com/LerianStudio/midaz/v3/pkg/constant" diff --git a/components/ledger/internal/services/query/get_all_metadata_portfolios.go b/components/ledger/internal/services/query/get_all_metadata_portfolios.go index de68a983e..16347f1c1 100644 --- a/components/ledger/internal/services/query/get_all_metadata_portfolios.go +++ b/components/ledger/internal/services/query/get_all_metadata_portfolios.go @@ -9,9 +9,9 @@ import ( "errors" "reflect" - libCommons "github.com/LerianStudio/lib-commons/v5/commons" - libLog "github.com/LerianStudio/lib-commons/v5/commons/log" - libOpentelemetry "github.com/LerianStudio/lib-commons/v5/commons/opentelemetry" + libCommons "github.com/LerianStudio/lib-observability" + libLog "github.com/LerianStudio/lib-observability/log" + libOpentelemetry "github.com/LerianStudio/lib-observability/tracing" "github.com/LerianStudio/midaz/v3/components/ledger/internal/services" "github.com/LerianStudio/midaz/v3/pkg" "github.com/LerianStudio/midaz/v3/pkg/constant" diff --git a/components/ledger/internal/services/query/get_all_metadata_segment.go b/components/ledger/internal/services/query/get_all_metadata_segment.go index e7ff1169a..98164b43e 100644 --- a/components/ledger/internal/services/query/get_all_metadata_segment.go +++ b/components/ledger/internal/services/query/get_all_metadata_segment.go @@ -8,9 +8,9 @@ import ( "context" "errors" - libCommons "github.com/LerianStudio/lib-commons/v5/commons" - libLog "github.com/LerianStudio/lib-commons/v5/commons/log" - libOpentelemetry "github.com/LerianStudio/lib-commons/v5/commons/opentelemetry" + libCommons "github.com/LerianStudio/lib-observability" + libLog "github.com/LerianStudio/lib-observability/log" + libOpentelemetry "github.com/LerianStudio/lib-observability/tracing" "github.com/LerianStudio/midaz/v3/components/ledger/internal/services" "github.com/LerianStudio/midaz/v3/pkg" "github.com/LerianStudio/midaz/v3/pkg/constant" diff --git a/components/ledger/internal/services/query/get_all_metadata_transaction_routes.go b/components/ledger/internal/services/query/get_all_metadata_transaction_routes.go index 84cde3594..c710cb908 100644 --- a/components/ledger/internal/services/query/get_all_metadata_transaction_routes.go +++ b/components/ledger/internal/services/query/get_all_metadata_transaction_routes.go @@ -9,9 +9,9 @@ import ( "errors" "fmt" - libCommons "github.com/LerianStudio/lib-commons/v5/commons" + libCommons "github.com/LerianStudio/lib-observability" libHTTP "github.com/LerianStudio/lib-commons/v5/commons/net/http" - libOpentelemetry "github.com/LerianStudio/lib-commons/v5/commons/opentelemetry" + libOpentelemetry "github.com/LerianStudio/lib-observability/tracing" "github.com/LerianStudio/midaz/v3/components/ledger/internal/services" "github.com/LerianStudio/midaz/v3/pkg" "github.com/LerianStudio/midaz/v3/pkg/constant" @@ -20,7 +20,7 @@ import ( "github.com/google/uuid" // GetAllMetadataTransactionRoutes fetch all Transaction Routes from the repository filtered by metadata - libLog "github.com/LerianStudio/lib-commons/v5/commons/log" + libLog "github.com/LerianStudio/lib-observability/log" ) func (uc *UseCase) GetAllMetadataTransactionRoutes(ctx context.Context, organizationID, ledgerID uuid.UUID, filter http.QueryHeader) ([]*mmodel.TransactionRoute, libHTTP.CursorPagination, error) { diff --git a/components/ledger/internal/services/query/get_all_metadata_transactions.go b/components/ledger/internal/services/query/get_all_metadata_transactions.go index ff3b9d8c8..62ac15f05 100644 --- a/components/ledger/internal/services/query/get_all_metadata_transactions.go +++ b/components/ledger/internal/services/query/get_all_metadata_transactions.go @@ -11,8 +11,8 @@ import ( libHTTP "github.com/LerianStudio/lib-commons/v5/commons/net/http" - libCommons "github.com/LerianStudio/lib-commons/v5/commons" - libOpentelemetry "github.com/LerianStudio/lib-commons/v5/commons/opentelemetry" + libCommons "github.com/LerianStudio/lib-observability" + libOpentelemetry "github.com/LerianStudio/lib-observability/tracing" "github.com/LerianStudio/midaz/v3/components/ledger/internal/adapters/postgres/transaction" "github.com/LerianStudio/midaz/v3/components/ledger/internal/services" "github.com/LerianStudio/midaz/v3/pkg" @@ -21,7 +21,7 @@ import ( "github.com/google/uuid" // GetAllMetadataTransactions fetch all Transactions from the repository - libLog "github.com/LerianStudio/lib-commons/v5/commons/log" + libLog "github.com/LerianStudio/lib-observability/log" ) func (uc *UseCase) GetAllMetadataTransactions(ctx context.Context, organizationID, ledgerID uuid.UUID, filter http.QueryHeader) ([]*transaction.Transaction, libHTTP.CursorPagination, error) { diff --git a/components/ledger/internal/services/query/get_all_operation_routes.go b/components/ledger/internal/services/query/get_all_operation_routes.go index 2c2e83430..235f4a186 100644 --- a/components/ledger/internal/services/query/get_all_operation_routes.go +++ b/components/ledger/internal/services/query/get_all_operation_routes.go @@ -9,9 +9,9 @@ import ( "errors" "fmt" - libCommons "github.com/LerianStudio/lib-commons/v5/commons" + libCommons "github.com/LerianStudio/lib-observability" libHTTP "github.com/LerianStudio/lib-commons/v5/commons/net/http" - libOpentelemetry "github.com/LerianStudio/lib-commons/v5/commons/opentelemetry" + libOpentelemetry "github.com/LerianStudio/lib-observability/tracing" "github.com/LerianStudio/midaz/v3/components/ledger/internal/services" "github.com/LerianStudio/midaz/v3/pkg" "github.com/LerianStudio/midaz/v3/pkg/constant" @@ -21,7 +21,7 @@ import ( "go.mongodb.org/mongo-driver/bson" // GetAllOperationRoutes fetch all Operation Routes from the repository - libLog "github.com/LerianStudio/lib-commons/v5/commons/log" + libLog "github.com/LerianStudio/lib-observability/log" ) func (uc *UseCase) GetAllOperationRoutes(ctx context.Context, organizationID, ledgerID uuid.UUID, filter http.QueryHeader) ([]*mmodel.OperationRoute, libHTTP.CursorPagination, error) { diff --git a/components/ledger/internal/services/query/get_all_operations.go b/components/ledger/internal/services/query/get_all_operations.go index 4eb0d672e..7cff5085a 100644 --- a/components/ledger/internal/services/query/get_all_operations.go +++ b/components/ledger/internal/services/query/get_all_operations.go @@ -9,10 +9,10 @@ import ( "errors" "fmt" - libCommons "github.com/LerianStudio/lib-commons/v5/commons" - libLog "github.com/LerianStudio/lib-commons/v5/commons/log" + libCommons "github.com/LerianStudio/lib-observability" + libLog "github.com/LerianStudio/lib-observability/log" libHTTP "github.com/LerianStudio/lib-commons/v5/commons/net/http" - libOpentelemetry "github.com/LerianStudio/lib-commons/v5/commons/opentelemetry" + libOpentelemetry "github.com/LerianStudio/lib-observability/tracing" "github.com/LerianStudio/midaz/v3/components/ledger/internal/adapters/postgres/operation" "github.com/LerianStudio/midaz/v3/components/ledger/internal/services" "github.com/LerianStudio/midaz/v3/pkg" diff --git a/components/ledger/internal/services/query/get_all_operations_account.go b/components/ledger/internal/services/query/get_all_operations_account.go index 398ae6ce8..1706c89c2 100644 --- a/components/ledger/internal/services/query/get_all_operations_account.go +++ b/components/ledger/internal/services/query/get_all_operations_account.go @@ -9,10 +9,10 @@ import ( "errors" "fmt" - libCommons "github.com/LerianStudio/lib-commons/v5/commons" - libLog "github.com/LerianStudio/lib-commons/v5/commons/log" + libCommons "github.com/LerianStudio/lib-observability" + libLog "github.com/LerianStudio/lib-observability/log" libHTTP "github.com/LerianStudio/lib-commons/v5/commons/net/http" - libOpentelemetry "github.com/LerianStudio/lib-commons/v5/commons/opentelemetry" + libOpentelemetry "github.com/LerianStudio/lib-observability/tracing" "github.com/LerianStudio/midaz/v3/components/ledger/internal/adapters/postgres/operation" "github.com/LerianStudio/midaz/v3/components/ledger/internal/services" "github.com/LerianStudio/midaz/v3/pkg" diff --git a/components/ledger/internal/services/query/get_all_organizations.go b/components/ledger/internal/services/query/get_all_organizations.go index 288abf3ed..6a5e8d289 100644 --- a/components/ledger/internal/services/query/get_all_organizations.go +++ b/components/ledger/internal/services/query/get_all_organizations.go @@ -10,8 +10,8 @@ import ( "fmt" "reflect" - libCommons "github.com/LerianStudio/lib-commons/v5/commons" - libOpentelemetry "github.com/LerianStudio/lib-commons/v5/commons/opentelemetry" + libCommons "github.com/LerianStudio/lib-observability" + libOpentelemetry "github.com/LerianStudio/lib-observability/tracing" "github.com/LerianStudio/midaz/v3/components/ledger/internal/services" "github.com/LerianStudio/midaz/v3/pkg" "github.com/LerianStudio/midaz/v3/pkg/constant" @@ -19,7 +19,7 @@ import ( "github.com/LerianStudio/midaz/v3/pkg/net/http" // GetAllOrganizations fetch all Organizations from the repository - libLog "github.com/LerianStudio/lib-commons/v5/commons/log" + libLog "github.com/LerianStudio/lib-observability/log" ) func (uc *UseCase) GetAllOrganizations(ctx context.Context, filter http.QueryHeader) ([]*mmodel.Organization, error) { diff --git a/components/ledger/internal/services/query/get_all_portfolios.go b/components/ledger/internal/services/query/get_all_portfolios.go index 4ff75b6d6..d104bb990 100644 --- a/components/ledger/internal/services/query/get_all_portfolios.go +++ b/components/ledger/internal/services/query/get_all_portfolios.go @@ -10,8 +10,8 @@ import ( "fmt" "reflect" - libCommons "github.com/LerianStudio/lib-commons/v5/commons" - libOpentelemetry "github.com/LerianStudio/lib-commons/v5/commons/opentelemetry" + libCommons "github.com/LerianStudio/lib-observability" + libOpentelemetry "github.com/LerianStudio/lib-observability/tracing" "github.com/LerianStudio/midaz/v3/components/ledger/internal/services" "github.com/LerianStudio/midaz/v3/pkg" "github.com/LerianStudio/midaz/v3/pkg/constant" @@ -20,7 +20,7 @@ import ( "github.com/google/uuid" // GetAllPortfolio fetch all Portfolio from the repository - libLog "github.com/LerianStudio/lib-commons/v5/commons/log" + libLog "github.com/LerianStudio/lib-observability/log" ) func (uc *UseCase) GetAllPortfolio(ctx context.Context, organizationID, ledgerID uuid.UUID, filter http.QueryHeader) ([]*mmodel.Portfolio, error) { diff --git a/components/ledger/internal/services/query/get_all_segment.go b/components/ledger/internal/services/query/get_all_segment.go index 99386d2ac..8050b1980 100644 --- a/components/ledger/internal/services/query/get_all_segment.go +++ b/components/ledger/internal/services/query/get_all_segment.go @@ -9,9 +9,9 @@ import ( "errors" "fmt" - libCommons "github.com/LerianStudio/lib-commons/v5/commons" - libLog "github.com/LerianStudio/lib-commons/v5/commons/log" - libOpentelemetry "github.com/LerianStudio/lib-commons/v5/commons/opentelemetry" + libCommons "github.com/LerianStudio/lib-observability" + libLog "github.com/LerianStudio/lib-observability/log" + libOpentelemetry "github.com/LerianStudio/lib-observability/tracing" "github.com/LerianStudio/midaz/v3/components/ledger/internal/services" "github.com/LerianStudio/midaz/v3/pkg" "github.com/LerianStudio/midaz/v3/pkg/constant" diff --git a/components/ledger/internal/services/query/get_all_transaction_routes.go b/components/ledger/internal/services/query/get_all_transaction_routes.go index 0afb55ee4..e0e1b2c18 100644 --- a/components/ledger/internal/services/query/get_all_transaction_routes.go +++ b/components/ledger/internal/services/query/get_all_transaction_routes.go @@ -9,9 +9,9 @@ import ( "errors" "fmt" - libCommons "github.com/LerianStudio/lib-commons/v5/commons" + libCommons "github.com/LerianStudio/lib-observability" libHTTP "github.com/LerianStudio/lib-commons/v5/commons/net/http" - libOpentelemetry "github.com/LerianStudio/lib-commons/v5/commons/opentelemetry" + libOpentelemetry "github.com/LerianStudio/lib-observability/tracing" "github.com/LerianStudio/midaz/v3/components/ledger/internal/services" "github.com/LerianStudio/midaz/v3/pkg" "github.com/LerianStudio/midaz/v3/pkg/constant" @@ -21,7 +21,7 @@ import ( "go.mongodb.org/mongo-driver/bson" // GetAllTransactionRoutes fetch all Transaction Routes from the repository - libLog "github.com/LerianStudio/lib-commons/v5/commons/log" + libLog "github.com/LerianStudio/lib-observability/log" ) func (uc *UseCase) GetAllTransactionRoutes(ctx context.Context, organizationID, ledgerID uuid.UUID, filter http.QueryHeader) ([]*mmodel.TransactionRoute, libHTTP.CursorPagination, error) { diff --git a/components/ledger/internal/services/query/get_all_transactions.go b/components/ledger/internal/services/query/get_all_transactions.go index f5d38affb..16f3ea2f7 100644 --- a/components/ledger/internal/services/query/get_all_transactions.go +++ b/components/ledger/internal/services/query/get_all_transactions.go @@ -9,9 +9,9 @@ import ( "errors" "fmt" - libCommons "github.com/LerianStudio/lib-commons/v5/commons" + libCommons "github.com/LerianStudio/lib-observability" libHTTP "github.com/LerianStudio/lib-commons/v5/commons/net/http" - libOpentelemetry "github.com/LerianStudio/lib-commons/v5/commons/opentelemetry" + libOpentelemetry "github.com/LerianStudio/lib-observability/tracing" "github.com/LerianStudio/midaz/v3/components/ledger/internal/adapters/postgres/operation" "github.com/LerianStudio/midaz/v3/components/ledger/internal/adapters/postgres/transaction" "github.com/LerianStudio/midaz/v3/components/ledger/internal/services" @@ -21,7 +21,7 @@ import ( "github.com/google/uuid" // GetAllTransactions fetch all Transactions from the repository - libLog "github.com/LerianStudio/lib-commons/v5/commons/log" + libLog "github.com/LerianStudio/lib-observability/log" ) func (uc *UseCase) GetAllTransactions(ctx context.Context, organizationID, ledgerID uuid.UUID, filter http.QueryHeader) ([]*transaction.Transaction, libHTTP.CursorPagination, error) { diff --git a/components/ledger/internal/services/query/get_balance_at_timestamp.go b/components/ledger/internal/services/query/get_balance_at_timestamp.go index 620e6d812..66095d24c 100644 --- a/components/ledger/internal/services/query/get_balance_at_timestamp.go +++ b/components/ledger/internal/services/query/get_balance_at_timestamp.go @@ -9,8 +9,8 @@ import ( "fmt" "time" - libCommons "github.com/LerianStudio/lib-commons/v5/commons" - libOpentelemetry "github.com/LerianStudio/lib-commons/v5/commons/opentelemetry" + libCommons "github.com/LerianStudio/lib-observability" + libOpentelemetry "github.com/LerianStudio/lib-observability/tracing" "github.com/LerianStudio/midaz/v3/pkg" "github.com/LerianStudio/midaz/v3/pkg/constant" "github.com/LerianStudio/midaz/v3/pkg/mmodel" @@ -19,7 +19,7 @@ import ( // GetBalanceAtTimestamp retrieves the balance state at a specific point in time. // It finds the last operation before the given timestamp and returns the balance state after that operation. - libLog "github.com/LerianStudio/lib-commons/v5/commons/log" + libLog "github.com/LerianStudio/lib-observability/log" ) func (uc *UseCase) GetBalanceAtTimestamp(ctx context.Context, organizationID, ledgerID, balanceID uuid.UUID, timestamp time.Time) (*mmodel.Balance, error) { diff --git a/components/ledger/internal/services/query/get_balances.go b/components/ledger/internal/services/query/get_balances.go index e1d7116d7..3d4fd3da7 100644 --- a/components/ledger/internal/services/query/get_balances.go +++ b/components/ledger/internal/services/query/get_balances.go @@ -10,8 +10,9 @@ import ( "strings" libCommons "github.com/LerianStudio/lib-commons/v5/commons" - libLog "github.com/LerianStudio/lib-commons/v5/commons/log" - libOpentelemetry "github.com/LerianStudio/lib-commons/v5/commons/opentelemetry" + libObservability "github.com/LerianStudio/lib-observability" + libLog "github.com/LerianStudio/lib-observability/log" + libOpentelemetry "github.com/LerianStudio/lib-observability/tracing" "github.com/google/uuid" "github.com/shopspring/decimal" @@ -24,7 +25,7 @@ import ( // pattern: checks Redis first, falls back to PostgreSQL for cache misses. // This is a pure read -- it does not mutate balances or execute any Lua scripts. func (uc *UseCase) GetBalances(ctx context.Context, organizationID, ledgerID uuid.UUID, aliases []string) ([]*mmodel.Balance, error) { - logger, tracer, _, _ := libCommons.NewTrackingFromContext(ctx) + logger, tracer, _, _ := libObservability.NewTrackingFromContext(ctx) ctx, span := tracer.Start(ctx, "query.get_balances") defer span.End() @@ -50,7 +51,7 @@ func (uc *UseCase) GetBalances(ctx context.Context, organizationID, ledgerID uui // the balances found in cache, and the aliases that were not found (cache misses) // which need to be fetched from the database. func (uc *UseCase) getBalancesFromCache(ctx context.Context, organizationID, ledgerID uuid.UUID, aliases []string) ([]*mmodel.Balance, []string) { - logger, tracer, _, _ := libCommons.NewTrackingFromContext(ctx) + logger, tracer, _, _ := libObservability.NewTrackingFromContext(ctx) ctx, span := tracer.Start(ctx, "query.get_balances.cache_read") defer span.End() diff --git a/components/ledger/internal/services/query/get_external_id_assetrate.go b/components/ledger/internal/services/query/get_external_id_assetrate.go index d29695ec5..ec2b80306 100644 --- a/components/ledger/internal/services/query/get_external_id_assetrate.go +++ b/components/ledger/internal/services/query/get_external_id_assetrate.go @@ -9,13 +9,13 @@ import ( "fmt" "reflect" - libCommons "github.com/LerianStudio/lib-commons/v5/commons" - libOpentelemetry "github.com/LerianStudio/lib-commons/v5/commons/opentelemetry" + libCommons "github.com/LerianStudio/lib-observability" + libOpentelemetry "github.com/LerianStudio/lib-observability/tracing" "github.com/LerianStudio/midaz/v3/components/ledger/internal/adapters/postgres/assetrate" "github.com/google/uuid" // GetAssetRateByExternalID gets data in the repository. - libLog "github.com/LerianStudio/lib-commons/v5/commons/log" + libLog "github.com/LerianStudio/lib-observability/log" ) func (uc *UseCase) GetAssetRateByExternalID(ctx context.Context, organizationID, ledgerID, externalID uuid.UUID) (*assetrate.AssetRate, error) { diff --git a/components/ledger/internal/services/query/get_id_account.go b/components/ledger/internal/services/query/get_id_account.go index 47319ad41..f824fdcd0 100644 --- a/components/ledger/internal/services/query/get_id_account.go +++ b/components/ledger/internal/services/query/get_id_account.go @@ -10,7 +10,7 @@ import ( "fmt" "reflect" - libCommons "github.com/LerianStudio/lib-commons/v5/commons" + libCommons "github.com/LerianStudio/lib-observability" "github.com/LerianStudio/midaz/v3/components/ledger/internal/services" "github.com/LerianStudio/midaz/v3/pkg" "github.com/LerianStudio/midaz/v3/pkg/constant" @@ -18,7 +18,7 @@ import ( "github.com/google/uuid" // GetAccountByID get an Account from the repository by given id. - libLog "github.com/LerianStudio/lib-commons/v5/commons/log" + libLog "github.com/LerianStudio/lib-observability/log" ) func (uc *UseCase) GetAccountByID(ctx context.Context, organizationID, ledgerID uuid.UUID, portfolioID *uuid.UUID, id uuid.UUID) (*mmodel.Account, error) { @@ -33,8 +33,6 @@ func (uc *UseCase) GetAccountByID(ctx context.Context, organizationID, ledgerID if err != nil { logger.Log(ctx, libLog.LevelError, fmt.Sprintf("Error getting account on repo by id: %v", err)) - logger.Log(ctx, libLog.LevelError, fmt.Sprintf("Error getting account on repo by id: %v", err)) - if errors.Is(err, services.ErrDatabaseItemNotFound) { return nil, pkg.ValidateBusinessError(constant.ErrAccountIDNotFound, reflect.TypeOf(mmodel.Account{}).Name()) } @@ -47,8 +45,6 @@ func (uc *UseCase) GetAccountByID(ctx context.Context, organizationID, ledgerID if err != nil { logger.Log(ctx, libLog.LevelError, fmt.Sprintf("Error get metadata on mongodb account: %v", err)) - logger.Log(ctx, libLog.LevelError, fmt.Sprintf("Error get metadata on mongodb account: %v", err)) - return nil, err } diff --git a/components/ledger/internal/services/query/get_id_account_type.go b/components/ledger/internal/services/query/get_id_account_type.go index 568c4ea2a..839ba63fc 100644 --- a/components/ledger/internal/services/query/get_id_account_type.go +++ b/components/ledger/internal/services/query/get_id_account_type.go @@ -9,8 +9,8 @@ import ( "errors" "fmt" - libCommons "github.com/LerianStudio/lib-commons/v5/commons" - libOpentelemetry "github.com/LerianStudio/lib-commons/v5/commons/opentelemetry" + libCommons "github.com/LerianStudio/lib-observability" + libOpentelemetry "github.com/LerianStudio/lib-observability/tracing" "github.com/LerianStudio/midaz/v3/components/ledger/internal/services" "github.com/LerianStudio/midaz/v3/pkg" "github.com/LerianStudio/midaz/v3/pkg/constant" @@ -18,7 +18,7 @@ import ( "github.com/google/uuid" // GetAccountTypeByID get an Account Type from the repository by given id. - libLog "github.com/LerianStudio/lib-commons/v5/commons/log" + libLog "github.com/LerianStudio/lib-observability/log" ) func (uc *UseCase) GetAccountTypeByID(ctx context.Context, organizationID, ledgerID, id uuid.UUID) (*mmodel.AccountType, error) { diff --git a/components/ledger/internal/services/query/get_id_account_with_deleted.go b/components/ledger/internal/services/query/get_id_account_with_deleted.go index 6a832351e..8ba96b971 100644 --- a/components/ledger/internal/services/query/get_id_account_with_deleted.go +++ b/components/ledger/internal/services/query/get_id_account_with_deleted.go @@ -10,8 +10,8 @@ import ( "fmt" "reflect" - libCommons "github.com/LerianStudio/lib-commons/v5/commons" - libOpentelemetry "github.com/LerianStudio/lib-commons/v5/commons/opentelemetry" + libCommons "github.com/LerianStudio/lib-observability" + libOpentelemetry "github.com/LerianStudio/lib-observability/tracing" "github.com/LerianStudio/midaz/v3/components/ledger/internal/services" "github.com/LerianStudio/midaz/v3/pkg" "github.com/LerianStudio/midaz/v3/pkg/constant" @@ -19,7 +19,7 @@ import ( "github.com/google/uuid" // GetAccountByIDWithDeleted get an Account from the repository by given id (including soft-deleted ones). - libLog "github.com/LerianStudio/lib-commons/v5/commons/log" + libLog "github.com/LerianStudio/lib-observability/log" ) func (uc *UseCase) GetAccountByIDWithDeleted(ctx context.Context, organizationID, ledgerID uuid.UUID, portfolioID *uuid.UUID, id uuid.UUID) (*mmodel.Account, error) { diff --git a/components/ledger/internal/services/query/get_id_asset.go b/components/ledger/internal/services/query/get_id_asset.go index 95f804ade..a0bc68c08 100644 --- a/components/ledger/internal/services/query/get_id_asset.go +++ b/components/ledger/internal/services/query/get_id_asset.go @@ -10,8 +10,8 @@ import ( "fmt" "reflect" - libCommons "github.com/LerianStudio/lib-commons/v5/commons" - libOpentelemetry "github.com/LerianStudio/lib-commons/v5/commons/opentelemetry" + libCommons "github.com/LerianStudio/lib-observability" + libOpentelemetry "github.com/LerianStudio/lib-observability/tracing" "github.com/LerianStudio/midaz/v3/components/ledger/internal/services" "github.com/LerianStudio/midaz/v3/pkg" "github.com/LerianStudio/midaz/v3/pkg/constant" @@ -19,7 +19,7 @@ import ( "github.com/google/uuid" // GetAssetByID get an Asset from the repository by given id. - libLog "github.com/LerianStudio/lib-commons/v5/commons/log" + libLog "github.com/LerianStudio/lib-observability/log" ) func (uc *UseCase) GetAssetByID(ctx context.Context, organizationID, ledgerID, id uuid.UUID) (*mmodel.Asset, error) { diff --git a/components/ledger/internal/services/query/get_id_balance.go b/components/ledger/internal/services/query/get_id_balance.go index ed85e395b..41aa2500c 100644 --- a/components/ledger/internal/services/query/get_id_balance.go +++ b/components/ledger/internal/services/query/get_id_balance.go @@ -9,8 +9,8 @@ import ( "encoding/json" "fmt" - libCommons "github.com/LerianStudio/lib-commons/v5/commons" - libOpentelemetry "github.com/LerianStudio/lib-commons/v5/commons/opentelemetry" + libCommons "github.com/LerianStudio/lib-observability" + libOpentelemetry "github.com/LerianStudio/lib-observability/tracing" "github.com/LerianStudio/midaz/v3/pkg" "github.com/LerianStudio/midaz/v3/pkg/constant" "github.com/LerianStudio/midaz/v3/pkg/mmodel" @@ -18,7 +18,7 @@ import ( "github.com/google/uuid" // GetBalanceByID gets data in the repository. - libLog "github.com/LerianStudio/lib-commons/v5/commons/log" + libLog "github.com/LerianStudio/lib-observability/log" ) func (uc *UseCase) GetBalanceByID(ctx context.Context, organizationID, ledgerID, balanceID uuid.UUID) (*mmodel.Balance, error) { diff --git a/components/ledger/internal/services/query/get_id_ledger.go b/components/ledger/internal/services/query/get_id_ledger.go index 3b302716b..97e41ef45 100644 --- a/components/ledger/internal/services/query/get_id_ledger.go +++ b/components/ledger/internal/services/query/get_id_ledger.go @@ -10,8 +10,8 @@ import ( "fmt" "reflect" - libCommons "github.com/LerianStudio/lib-commons/v5/commons" - libOpentelemetry "github.com/LerianStudio/lib-commons/v5/commons/opentelemetry" + libCommons "github.com/LerianStudio/lib-observability" + libOpentelemetry "github.com/LerianStudio/lib-observability/tracing" "github.com/LerianStudio/midaz/v3/components/ledger/internal/services" "github.com/LerianStudio/midaz/v3/pkg" "github.com/LerianStudio/midaz/v3/pkg/constant" @@ -19,7 +19,7 @@ import ( "github.com/google/uuid" // GetLedgerByID Get a ledger from the repository by given id. - libLog "github.com/LerianStudio/lib-commons/v5/commons/log" + libLog "github.com/LerianStudio/lib-observability/log" ) func (uc *UseCase) GetLedgerByID(ctx context.Context, organizationID, id uuid.UUID) (*mmodel.Ledger, error) { diff --git a/components/ledger/internal/services/query/get_id_operation.go b/components/ledger/internal/services/query/get_id_operation.go index 30d9f99fc..7812c8faa 100644 --- a/components/ledger/internal/services/query/get_id_operation.go +++ b/components/ledger/internal/services/query/get_id_operation.go @@ -8,14 +8,14 @@ import ( "context" "fmt" - libCommons "github.com/LerianStudio/lib-commons/v5/commons" - libOpentelemetry "github.com/LerianStudio/lib-commons/v5/commons/opentelemetry" + libCommons "github.com/LerianStudio/lib-observability" + libOpentelemetry "github.com/LerianStudio/lib-observability/tracing" "github.com/LerianStudio/midaz/v3/components/ledger/internal/adapters/postgres/operation" "github.com/LerianStudio/midaz/v3/pkg/constant" "github.com/google/uuid" // GetOperationByID gets data in the repository. - libLog "github.com/LerianStudio/lib-commons/v5/commons/log" + libLog "github.com/LerianStudio/lib-observability/log" ) func (uc *UseCase) GetOperationByID(ctx context.Context, organizationID, ledgerID, transactionID, operationID uuid.UUID) (*operation.Operation, error) { diff --git a/components/ledger/internal/services/query/get_id_operation_account.go b/components/ledger/internal/services/query/get_id_operation_account.go index ff4e4bdf2..0c5437916 100644 --- a/components/ledger/internal/services/query/get_id_operation_account.go +++ b/components/ledger/internal/services/query/get_id_operation_account.go @@ -9,9 +9,9 @@ import ( "errors" "fmt" - libCommons "github.com/LerianStudio/lib-commons/v5/commons" - libLog "github.com/LerianStudio/lib-commons/v5/commons/log" - libOpentelemetry "github.com/LerianStudio/lib-commons/v5/commons/opentelemetry" + libCommons "github.com/LerianStudio/lib-observability" + libLog "github.com/LerianStudio/lib-observability/log" + libOpentelemetry "github.com/LerianStudio/lib-observability/tracing" "github.com/LerianStudio/midaz/v3/components/ledger/internal/adapters/postgres/operation" "github.com/LerianStudio/midaz/v3/components/ledger/internal/services" "github.com/LerianStudio/midaz/v3/pkg" diff --git a/components/ledger/internal/services/query/get_id_operation_route.go b/components/ledger/internal/services/query/get_id_operation_route.go index 63581746d..a5cdf46b5 100644 --- a/components/ledger/internal/services/query/get_id_operation_route.go +++ b/components/ledger/internal/services/query/get_id_operation_route.go @@ -9,8 +9,8 @@ import ( "errors" "fmt" - libCommons "github.com/LerianStudio/lib-commons/v5/commons" - libOpentelemetry "github.com/LerianStudio/lib-commons/v5/commons/opentelemetry" + libCommons "github.com/LerianStudio/lib-observability" + libOpentelemetry "github.com/LerianStudio/lib-observability/tracing" "github.com/LerianStudio/midaz/v3/components/ledger/internal/services" "github.com/LerianStudio/midaz/v3/pkg" "github.com/LerianStudio/midaz/v3/pkg/constant" @@ -19,7 +19,7 @@ import ( // GetOperationRouteByID retrieves an operation route by its ID. // It returns the operation route if found, otherwise it returns an error. - libLog "github.com/LerianStudio/lib-commons/v5/commons/log" + libLog "github.com/LerianStudio/lib-observability/log" ) func (uc *UseCase) GetOperationRouteByID(ctx context.Context, organizationID, ledgerID uuid.UUID, portfolioID *uuid.UUID, id uuid.UUID) (*mmodel.OperationRoute, error) { diff --git a/components/ledger/internal/services/query/get_id_organization.go b/components/ledger/internal/services/query/get_id_organization.go index adb65f936..e2802025b 100644 --- a/components/ledger/internal/services/query/get_id_organization.go +++ b/components/ledger/internal/services/query/get_id_organization.go @@ -10,8 +10,8 @@ import ( "fmt" "reflect" - libCommons "github.com/LerianStudio/lib-commons/v5/commons" - libOpentelemetry "github.com/LerianStudio/lib-commons/v5/commons/opentelemetry" + libCommons "github.com/LerianStudio/lib-observability" + libOpentelemetry "github.com/LerianStudio/lib-observability/tracing" "github.com/LerianStudio/midaz/v3/components/ledger/internal/services" "github.com/LerianStudio/midaz/v3/pkg" "github.com/LerianStudio/midaz/v3/pkg/constant" @@ -19,7 +19,7 @@ import ( "github.com/google/uuid" // GetOrganizationByID fetch a new organization from the repository - libLog "github.com/LerianStudio/lib-commons/v5/commons/log" + libLog "github.com/LerianStudio/lib-observability/log" ) func (uc *UseCase) GetOrganizationByID(ctx context.Context, id uuid.UUID) (*mmodel.Organization, error) { diff --git a/components/ledger/internal/services/query/get_id_portfolio.go b/components/ledger/internal/services/query/get_id_portfolio.go index 7f8072983..bda202b3b 100644 --- a/components/ledger/internal/services/query/get_id_portfolio.go +++ b/components/ledger/internal/services/query/get_id_portfolio.go @@ -10,8 +10,8 @@ import ( "fmt" "reflect" - libCommons "github.com/LerianStudio/lib-commons/v5/commons" - libOpentelemetry "github.com/LerianStudio/lib-commons/v5/commons/opentelemetry" + libCommons "github.com/LerianStudio/lib-observability" + libOpentelemetry "github.com/LerianStudio/lib-observability/tracing" "github.com/LerianStudio/midaz/v3/components/ledger/internal/services" "github.com/LerianStudio/midaz/v3/pkg" "github.com/LerianStudio/midaz/v3/pkg/constant" @@ -19,7 +19,7 @@ import ( "github.com/google/uuid" // GetPortfolioByID get a Portfolio from the repository by given id. - libLog "github.com/LerianStudio/lib-commons/v5/commons/log" + libLog "github.com/LerianStudio/lib-observability/log" ) func (uc *UseCase) GetPortfolioByID(ctx context.Context, organizationID, ledgerID, id uuid.UUID) (*mmodel.Portfolio, error) { diff --git a/components/ledger/internal/services/query/get_id_segment.go b/components/ledger/internal/services/query/get_id_segment.go index 5c5112c8f..0a20ec04c 100644 --- a/components/ledger/internal/services/query/get_id_segment.go +++ b/components/ledger/internal/services/query/get_id_segment.go @@ -9,9 +9,9 @@ import ( "errors" "fmt" - libCommons "github.com/LerianStudio/lib-commons/v5/commons" - libLog "github.com/LerianStudio/lib-commons/v5/commons/log" - libOpentelemetry "github.com/LerianStudio/lib-commons/v5/commons/opentelemetry" + libCommons "github.com/LerianStudio/lib-observability" + libLog "github.com/LerianStudio/lib-observability/log" + libOpentelemetry "github.com/LerianStudio/lib-observability/tracing" "github.com/LerianStudio/midaz/v3/components/ledger/internal/services" "github.com/LerianStudio/midaz/v3/pkg" "github.com/LerianStudio/midaz/v3/pkg/constant" diff --git a/components/ledger/internal/services/query/get_id_transaction.go b/components/ledger/internal/services/query/get_id_transaction.go index 6ff79af26..f594fea2f 100644 --- a/components/ledger/internal/services/query/get_id_transaction.go +++ b/components/ledger/internal/services/query/get_id_transaction.go @@ -8,14 +8,14 @@ import ( "context" "fmt" - libCommons "github.com/LerianStudio/lib-commons/v5/commons" - libOpentelemetry "github.com/LerianStudio/lib-commons/v5/commons/opentelemetry" + libCommons "github.com/LerianStudio/lib-observability" + libOpentelemetry "github.com/LerianStudio/lib-observability/tracing" "github.com/LerianStudio/midaz/v3/components/ledger/internal/adapters/postgres/transaction" "github.com/LerianStudio/midaz/v3/pkg/constant" "github.com/google/uuid" // GetTransactionByID gets data in the repository. - libLog "github.com/LerianStudio/lib-commons/v5/commons/log" + libLog "github.com/LerianStudio/lib-observability/log" ) func (uc *UseCase) GetTransactionByID(ctx context.Context, organizationID, ledgerID, transactionID uuid.UUID) (*transaction.Transaction, error) { diff --git a/components/ledger/internal/services/query/get_id_transaction_route.go b/components/ledger/internal/services/query/get_id_transaction_route.go index b1d0ba81e..4a5e3890d 100644 --- a/components/ledger/internal/services/query/get_id_transaction_route.go +++ b/components/ledger/internal/services/query/get_id_transaction_route.go @@ -9,8 +9,8 @@ import ( "errors" "fmt" - libCommons "github.com/LerianStudio/lib-commons/v5/commons" - libOpentelemetry "github.com/LerianStudio/lib-commons/v5/commons/opentelemetry" + libCommons "github.com/LerianStudio/lib-observability" + libOpentelemetry "github.com/LerianStudio/lib-observability/tracing" "github.com/LerianStudio/midaz/v3/components/ledger/internal/services" "github.com/LerianStudio/midaz/v3/pkg" "github.com/LerianStudio/midaz/v3/pkg/constant" @@ -19,7 +19,7 @@ import ( // GetTransactionRouteByID retrieves a transaction route by its ID. // It returns the transaction route if found, otherwise it returns an error. - libLog "github.com/LerianStudio/lib-commons/v5/commons/log" + libLog "github.com/LerianStudio/lib-observability/log" ) func (uc *UseCase) GetTransactionRouteByID(ctx context.Context, organizationID, ledgerID uuid.UUID, id uuid.UUID) (*mmodel.TransactionRoute, error) { diff --git a/components/ledger/internal/services/query/get_ids_accounts.go b/components/ledger/internal/services/query/get_ids_accounts.go index e1f923776..7d6cdbc5d 100644 --- a/components/ledger/internal/services/query/get_ids_accounts.go +++ b/components/ledger/internal/services/query/get_ids_accounts.go @@ -10,8 +10,8 @@ import ( "fmt" "reflect" - libCommons "github.com/LerianStudio/lib-commons/v5/commons" - libOpentelemetry "github.com/LerianStudio/lib-commons/v5/commons/opentelemetry" + libCommons "github.com/LerianStudio/lib-observability" + libOpentelemetry "github.com/LerianStudio/lib-observability/tracing" "github.com/LerianStudio/midaz/v3/components/ledger/internal/services" "github.com/LerianStudio/midaz/v3/pkg" "github.com/LerianStudio/midaz/v3/pkg/constant" @@ -19,7 +19,7 @@ import ( "github.com/google/uuid" // ListAccountsByIDs get Accounts from the repository by given ids. - libLog "github.com/LerianStudio/lib-commons/v5/commons/log" + libLog "github.com/LerianStudio/lib-observability/log" ) func (uc *UseCase) ListAccountsByIDs(ctx context.Context, organizationID, ledgerID uuid.UUID, ids []uuid.UUID) ([]*mmodel.Account, error) { diff --git a/components/ledger/internal/services/query/get_ledger_settings.go b/components/ledger/internal/services/query/get_ledger_settings.go index 7b8ba1e6a..4f260b60d 100644 --- a/components/ledger/internal/services/query/get_ledger_settings.go +++ b/components/ledger/internal/services/query/get_ledger_settings.go @@ -9,9 +9,9 @@ import ( "encoding/json" "time" - libCommons "github.com/LerianStudio/lib-commons/v5/commons" - libLog "github.com/LerianStudio/lib-commons/v5/commons/log" - libOpentelemetry "github.com/LerianStudio/lib-commons/v5/commons/opentelemetry" + libCommons "github.com/LerianStudio/lib-observability" + libLog "github.com/LerianStudio/lib-observability/log" + libOpentelemetry "github.com/LerianStudio/lib-observability/tracing" "github.com/google/uuid" "go.opentelemetry.io/otel/trace" diff --git a/components/ledger/internal/services/query/get_ledger_settings_parsed.go b/components/ledger/internal/services/query/get_ledger_settings_parsed.go index faef43caf..e02a3ba95 100644 --- a/components/ledger/internal/services/query/get_ledger_settings_parsed.go +++ b/components/ledger/internal/services/query/get_ledger_settings_parsed.go @@ -7,9 +7,9 @@ package query import ( "context" - libCommons "github.com/LerianStudio/lib-commons/v5/commons" - libLog "github.com/LerianStudio/lib-commons/v5/commons/log" - libOpentelemetry "github.com/LerianStudio/lib-commons/v5/commons/opentelemetry" + libCommons "github.com/LerianStudio/lib-observability" + libLog "github.com/LerianStudio/lib-observability/log" + libOpentelemetry "github.com/LerianStudio/lib-observability/tracing" "github.com/LerianStudio/midaz/v3/pkg/mmodel" "github.com/google/uuid" ) diff --git a/components/ledger/internal/services/query/get_or_create_transaction_route_cache.go b/components/ledger/internal/services/query/get_or_create_transaction_route_cache.go index 064645ad3..d172d1efa 100644 --- a/components/ledger/internal/services/query/get_or_create_transaction_route_cache.go +++ b/components/ledger/internal/services/query/get_or_create_transaction_route_cache.go @@ -11,8 +11,8 @@ import ( "fmt" "time" - libCommons "github.com/LerianStudio/lib-commons/v5/commons" - libOpentelemetry "github.com/LerianStudio/lib-commons/v5/commons/opentelemetry" + libCommons "github.com/LerianStudio/lib-observability" + libOpentelemetry "github.com/LerianStudio/lib-observability/tracing" "github.com/LerianStudio/midaz/v3/components/ledger/internal/services" pkg "github.com/LerianStudio/midaz/v3/pkg" "github.com/LerianStudio/midaz/v3/pkg/mmodel" @@ -24,7 +24,7 @@ import ( // If the transaction route cache exists in Redis, it returns the cached data as TransactionRouteCache. // If not found in cache, it fetches the transaction route from database and creates the cache for future use. // The cache is persistent (no TTL) and stores the msgpack-encoded binary representation of the transaction route cache structure. - libLog "github.com/LerianStudio/lib-commons/v5/commons/log" + libLog "github.com/LerianStudio/lib-observability/log" ) // cacheNotFoundSentinel is the sentinel value stored in Redis when a transaction route is not found in the database. diff --git a/components/ledger/internal/services/query/get_or_create_transaction_route_cache_chaos_test.go b/components/ledger/internal/services/query/get_or_create_transaction_route_cache_chaos_test.go index 7ca0d4835..be7354897 100644 --- a/components/ledger/internal/services/query/get_or_create_transaction_route_cache_chaos_test.go +++ b/components/ledger/internal/services/query/get_or_create_transaction_route_cache_chaos_test.go @@ -29,7 +29,7 @@ import ( libCommons "github.com/LerianStudio/lib-commons/v5/commons" libPostgres "github.com/LerianStudio/lib-commons/v5/commons/postgres" libRedis "github.com/LerianStudio/lib-commons/v5/commons/redis" - libZap "github.com/LerianStudio/lib-commons/v5/commons/zap" + libZap "github.com/LerianStudio/lib-observability/zap" "github.com/LerianStudio/midaz/v3/components/ledger/internal/adapters/postgres/transactionroute" redis "github.com/LerianStudio/midaz/v3/components/ledger/internal/adapters/redis/transaction" "github.com/LerianStudio/midaz/v3/tests/utils/chaos" diff --git a/components/ledger/internal/services/query/get_or_create_transaction_route_cache_integration_test.go b/components/ledger/internal/services/query/get_or_create_transaction_route_cache_integration_test.go index 31e0c12ef..9edbf6f1f 100644 --- a/components/ledger/internal/services/query/get_or_create_transaction_route_cache_integration_test.go +++ b/components/ledger/internal/services/query/get_or_create_transaction_route_cache_integration_test.go @@ -18,7 +18,7 @@ import ( libCommons "github.com/LerianStudio/lib-commons/v5/commons" libPostgres "github.com/LerianStudio/lib-commons/v5/commons/postgres" - libZap "github.com/LerianStudio/lib-commons/v5/commons/zap" + libZap "github.com/LerianStudio/lib-observability/zap" "github.com/LerianStudio/midaz/v3/components/ledger/internal/adapters/postgres/transactionroute" redis "github.com/LerianStudio/midaz/v3/components/ledger/internal/adapters/redis/transaction" "github.com/LerianStudio/midaz/v3/components/ledger/internal/services" diff --git a/components/ledger/internal/services/query/get_parent_id_transaction.go b/components/ledger/internal/services/query/get_parent_id_transaction.go index 134f2c4d6..7e0cf61dc 100644 --- a/components/ledger/internal/services/query/get_parent_id_transaction.go +++ b/components/ledger/internal/services/query/get_parent_id_transaction.go @@ -8,14 +8,14 @@ import ( "context" "fmt" - libCommons "github.com/LerianStudio/lib-commons/v5/commons" - libOpentelemetry "github.com/LerianStudio/lib-commons/v5/commons/opentelemetry" + libCommons "github.com/LerianStudio/lib-observability" + libOpentelemetry "github.com/LerianStudio/lib-observability/tracing" "github.com/LerianStudio/midaz/v3/components/ledger/internal/adapters/postgres/transaction" "github.com/LerianStudio/midaz/v3/pkg/constant" "github.com/google/uuid" // GetParentByTransactionID gets data in the repository. - libLog "github.com/LerianStudio/lib-commons/v5/commons/log" + libLog "github.com/LerianStudio/lib-observability/log" ) func (uc *UseCase) GetParentByTransactionID(ctx context.Context, organizationID, ledgerID, parentID uuid.UUID) (*transaction.Transaction, error) { diff --git a/components/ledger/internal/services/query/get_write_behind_transaction.go b/components/ledger/internal/services/query/get_write_behind_transaction.go index 5514fb2d2..5acff46e1 100644 --- a/components/ledger/internal/services/query/get_write_behind_transaction.go +++ b/components/ledger/internal/services/query/get_write_behind_transaction.go @@ -8,8 +8,8 @@ import ( "context" "fmt" - libCommons "github.com/LerianStudio/lib-commons/v5/commons" - libOpentelemetry "github.com/LerianStudio/lib-commons/v5/commons/opentelemetry" + libCommons "github.com/LerianStudio/lib-observability" + libOpentelemetry "github.com/LerianStudio/lib-observability/tracing" "github.com/LerianStudio/midaz/v3/components/ledger/internal/adapters/postgres/transaction" "github.com/LerianStudio/midaz/v3/pkg/utils" "github.com/google/uuid" @@ -18,7 +18,7 @@ import ( // GetWriteBehindTransaction retrieves a transaction from the write-behind cache in Redis. // Returns the deserialized transaction with Body and Operations already populated. // Returns (nil, err) on cache miss or deserialization failure. - libLog "github.com/LerianStudio/lib-commons/v5/commons/log" + libLog "github.com/LerianStudio/lib-observability/log" ) func (uc *UseCase) GetWriteBehindTransaction(ctx context.Context, organizationID, ledgerID, transactionID uuid.UUID) (*transaction.Transaction, error) { diff --git a/components/ledger/internal/services/query/validate_accounting_routes.go b/components/ledger/internal/services/query/validate_accounting_routes.go index 0f5455374..5d3ee2660 100644 --- a/components/ledger/internal/services/query/validate_accounting_routes.go +++ b/components/ledger/internal/services/query/validate_accounting_routes.go @@ -10,8 +10,9 @@ import ( "strings" libCommons "github.com/LerianStudio/lib-commons/v5/commons" - libLog "github.com/LerianStudio/lib-commons/v5/commons/log" - libOpentelemetry "github.com/LerianStudio/lib-commons/v5/commons/opentelemetry" + libObservability "github.com/LerianStudio/lib-observability" + libLog "github.com/LerianStudio/lib-observability/log" + libOpentelemetry "github.com/LerianStudio/lib-observability/tracing" "github.com/google/uuid" "github.com/LerianStudio/midaz/v3/pkg" @@ -60,7 +61,7 @@ import ( // route entries. Before reaching this point, the handler (RevertTransaction) pre-validates // that all operation routes are bidirectional — a requirement for reversals. func (uc *UseCase) ValidateAccountingRules(ctx context.Context, organizationID, ledgerID uuid.UUID, operations []mmodel.BalanceOperation, validate *mtransaction.Responses, action string) (*mmodel.TransactionRouteCache, error) { - logger, tracer, _, _ := libCommons.NewTrackingFromContext(ctx) + logger, tracer, _, _ := libObservability.NewTrackingFromContext(ctx) ctx, span := tracer.Start(ctx, "usecase.validate_accounting_rules") defer span.End() @@ -290,7 +291,7 @@ func resolveTransactionRouteID(validate *mtransaction.Responses) (uuid.UUID, err // Route existence, direction matching, and account rules (alias/account_type) are // always enforced when validateRoutes is active. func validateAccountRules(ctx context.Context, sourceRoutes, destinationRoutes, bidirectionalRoutes map[string]mmodel.OperationRouteCache, validate *mtransaction.Responses, operations []mmodel.BalanceOperation) error { - logger, tracer, _, _ := libCommons.NewTrackingFromContext(ctx) + logger, tracer, _, _ := libObservability.NewTrackingFromContext(ctx) _, span := tracer.Start(ctx, "usecase.validate_account_rules") defer span.End() diff --git a/go.mod b/go.mod index 7de86caa3..a5f7a4d11 100644 --- a/go.mod +++ b/go.mod @@ -1,11 +1,9 @@ module github.com/LerianStudio/midaz/v3 -go 1.26.2 - -toolchain go1.26.3 +go 1.26.3 require ( - github.com/LerianStudio/lib-auth/v2 v2.7.0 + github.com/LerianStudio/lib-auth/v2 v2.8.0 github.com/Masterminds/squirrel v1.5.4 github.com/antlr4-go/antlr/v4 v4.13.1 github.com/go-playground/locales v0.14.1 @@ -14,7 +12,7 @@ require ( github.com/jackc/pgx/v5 v5.9.2 github.com/lib/pq v1.12.3 github.com/rabbitmq/amqp091-go v1.11.0 - github.com/redis/go-redis/v9 v9.19.0 + github.com/redis/go-redis/v9 v9.20.0 github.com/shopspring/decimal v1.4.0 github.com/stretchr/testify v1.11.1 github.com/swaggo/fiber-swagger v1.3.0 @@ -22,11 +20,11 @@ require ( github.com/testcontainers/testcontainers-go v0.42.0 github.com/vmihailenco/msgpack/v5 v5.4.1 go.mongodb.org/mongo-driver v1.17.9 - go.opentelemetry.io/otel v1.43.0 - go.opentelemetry.io/otel/trace v1.43.0 + go.opentelemetry.io/otel v1.44.0 + go.opentelemetry.io/otel/trace v1.44.0 go.uber.org/mock v0.6.0 go.uber.org/zap v1.28.0 // indirect - google.golang.org/grpc v1.81.0 // indirect + google.golang.org/grpc v1.81.1 // indirect google.golang.org/protobuf v1.36.11 // indirect ) @@ -34,7 +32,7 @@ require ( cloud.google.com/go/auth v0.20.0 // indirect cloud.google.com/go/auth/oauth2adapt v0.2.8 // indirect cloud.google.com/go/compute/metadata v0.9.0 // indirect - cloud.google.com/go/iam v1.9.0 // indirect + cloud.google.com/go/iam v1.11.0 // indirect github.com/KyleBanks/depth v1.2.1 // indirect github.com/bxcodec/dbresolver/v2 v2.2.1 github.com/cenkalti/backoff/v5 v5.0.3 // indirect @@ -58,7 +56,7 @@ require ( github.com/golang-jwt/jwt/v5 v5.3.1 github.com/golang-migrate/migrate/v4 v4.19.1 // indirect github.com/google/s2a-go v0.1.9 // indirect - github.com/googleapis/enterprise-certificate-proxy v0.3.15 // indirect + github.com/googleapis/enterprise-certificate-proxy v0.3.16 // indirect github.com/googleapis/gax-go/v2 v2.22.0 // indirect github.com/grpc-ecosystem/grpc-gateway/v2 v2.29.0 // indirect github.com/jackc/puddle/v2 v2.2.2 // indirect @@ -68,53 +66,53 @@ require ( github.com/shirou/gopsutil v3.21.11+incompatible // indirect github.com/sony/gobreaker v1.0.0 // indirect github.com/swaggo/files v1.0.1 // indirect - github.com/tklauser/go-sysconf v0.3.16 // indirect - github.com/tklauser/numcpus v0.11.0 // indirect + github.com/tklauser/go-sysconf v0.4.0 // indirect + github.com/tklauser/numcpus v0.12.0 // indirect github.com/vmihailenco/tagparser/v2 v2.0.0 // indirect github.com/yusufpapurcu/wmi v1.2.4 // indirect go.opentelemetry.io/auto/sdk v1.2.1 // indirect - go.opentelemetry.io/contrib/bridges/otelzap v0.18.0 // indirect - go.opentelemetry.io/contrib/instrumentation/google.golang.org/grpc/otelgrpc v0.68.0 // indirect - go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp v0.68.0 // indirect - go.opentelemetry.io/otel/exporters/otlp/otlplog/otlploggrpc v0.19.0 // indirect - go.opentelemetry.io/otel/exporters/otlp/otlpmetric/otlpmetricgrpc v1.43.0 // indirect - go.opentelemetry.io/otel/exporters/otlp/otlptrace v1.43.0 // indirect - go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracegrpc v1.43.0 // indirect - go.opentelemetry.io/otel/log v0.19.0 // indirect - go.opentelemetry.io/otel/metric v1.43.0 // indirect - go.opentelemetry.io/otel/sdk v1.43.0 // indirect - go.opentelemetry.io/otel/sdk/log v0.19.0 // indirect - go.opentelemetry.io/otel/sdk/metric v1.43.0 + go.opentelemetry.io/contrib/bridges/otelzap v0.19.0 // indirect + go.opentelemetry.io/contrib/instrumentation/google.golang.org/grpc/otelgrpc v0.69.0 // indirect + go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp v0.69.0 // indirect + go.opentelemetry.io/otel/exporters/otlp/otlplog/otlploggrpc v0.20.0 // indirect + go.opentelemetry.io/otel/exporters/otlp/otlpmetric/otlpmetricgrpc v1.44.0 // indirect + go.opentelemetry.io/otel/exporters/otlp/otlptrace v1.44.0 // indirect + go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracegrpc v1.44.0 // indirect + go.opentelemetry.io/otel/log v0.20.0 // indirect + go.opentelemetry.io/otel/metric v1.44.0 // indirect + go.opentelemetry.io/otel/sdk v1.44.0 // indirect + go.opentelemetry.io/otel/sdk/log v0.20.0 // indirect + go.opentelemetry.io/otel/sdk/metric v1.44.0 go.opentelemetry.io/proto/otlp v1.10.0 // indirect go.yaml.in/yaml/v3 v3.0.4 // indirect - golang.org/x/mod v0.35.0 // indirect - golang.org/x/net v0.53.0 // indirect + golang.org/x/mod v0.36.0 // indirect + golang.org/x/net v0.55.0 // indirect golang.org/x/oauth2 v0.36.0 // indirect - golang.org/x/text v0.36.0 // indirect + golang.org/x/text v0.37.0 // indirect golang.org/x/time v0.15.0 // indirect - golang.org/x/tools v0.44.0 // indirect - google.golang.org/api v0.276.0 // indirect - google.golang.org/genproto/googleapis/api v0.0.0-20260427160629-7cedc36a6bc4 // indirect - google.golang.org/genproto/googleapis/rpc v0.0.0-20260427160629-7cedc36a6bc4 // indirect + golang.org/x/tools v0.45.0 // indirect + google.golang.org/api v0.282.0 // indirect + google.golang.org/genproto/googleapis/api v0.0.0-20260526163538-3dc84a4a5aaa // indirect + google.golang.org/genproto/googleapis/rpc v0.0.0-20260526163538-3dc84a4a5aaa // indirect gopkg.in/go-playground/assert.v1 v1.2.1 // indirect ) require ( - github.com/LerianStudio/lib-commons/v5 v5.2.0-beta.11 - github.com/LerianStudio/lib-streaming v1.2.0 + github.com/LerianStudio/lib-commons/v5 v5.2.0-beta.12 + github.com/LerianStudio/lib-observability v1.0.1 + github.com/LerianStudio/lib-streaming v1.4.0 github.com/Shopify/toxiproxy/v2 v2.12.0 github.com/docker/go-connections v0.7.0 - github.com/moby/moby/api v1.54.1 - github.com/moby/moby/client v0.4.0 + github.com/moby/moby/api v1.54.2 + github.com/moby/moby/client v0.4.1 github.com/testcontainers/testcontainers-go/modules/toxiproxy v0.42.0 - github.com/twmb/franz-go v1.21.0 + github.com/twmb/franz-go v1.21.2 go.uber.org/goleak v1.3.0 ) require ( dario.cat/mergo v1.0.2 // indirect github.com/Azure/go-ansiterm v0.0.0-20250102033503-faa5f7b0171c // indirect - github.com/LerianStudio/lib-observability v1.0.0 // indirect github.com/Microsoft/go-winio v0.6.2 // indirect github.com/cenkalti/backoff/v4 v4.3.0 // indirect github.com/containerd/errdefs v1.0.0 // indirect @@ -134,7 +132,7 @@ require ( github.com/jackc/pgpassfile v1.0.0 // indirect github.com/jackc/pgservicefile v0.0.0-20240606120523-5a60cdf6a761 // indirect github.com/leodido/go-urn v1.4.0 // indirect - github.com/lufia/plan9stats v0.0.0-20211012122336-39d0f177ccd0 // indirect + github.com/lufia/plan9stats v0.0.0-20260330125221-c963978e514e // indirect github.com/magiconair/properties v1.8.10 // indirect github.com/moby/docker-image-spec v1.3.1 // indirect github.com/moby/go-archive v0.2.0 // indirect @@ -148,7 +146,7 @@ require ( github.com/opencontainers/image-spec v1.1.1 // indirect github.com/pierrec/lz4/v4 v4.1.26 // indirect github.com/power-devops/perfstat v0.0.0-20240221224432-82ca36839d55 // indirect - github.com/shirou/gopsutil/v4 v4.26.3 // indirect + github.com/shirou/gopsutil/v4 v4.26.4 // indirect github.com/sirupsen/logrus v1.9.4 // indirect github.com/twmb/franz-go/pkg/kmsg v1.13.1 // indirect github.com/xdg-go/pbkdf2 v1.0.0 // indirect @@ -157,8 +155,8 @@ require ( github.com/youmark/pkcs8 v0.0.0-20240726163527-a2c0da244d78 // indirect go.uber.org/atomic v1.11.0 // indirect go.uber.org/multierr v1.11.0 // indirect - golang.org/x/crypto v0.50.0 // indirect - golang.org/x/exp v0.0.0-20260410095643-746e56fc9e2f // indirect + golang.org/x/crypto v0.52.0 // indirect + golang.org/x/exp v0.0.0-20260527015227-08cc5374adb3 // indirect golang.org/x/sync v0.20.0 // indirect gopkg.in/yaml.v3 v3.0.1 // indirect ) @@ -168,13 +166,13 @@ require ( github.com/go-playground/validator v9.31.0+incompatible github.com/google/uuid v1.6.0 github.com/iancoleman/strcase v0.3.0 - github.com/klauspost/compress v1.18.5 // indirect + github.com/klauspost/compress v1.18.6 // indirect github.com/mattn/go-colorable v0.1.14 // indirect github.com/mattn/go-isatty v0.0.22 // indirect github.com/mattn/go-runewidth v0.0.23 // indirect github.com/pmezard/go-difflib v1.0.1-0.20181226105442-5d4384ee4fb2 // indirect github.com/valyala/bytebufferpool v1.0.0 // indirect - github.com/valyala/fasthttp v1.70.0 // indirect - golang.org/x/sys v0.43.0 // indirect + github.com/valyala/fasthttp v1.71.0 // indirect + golang.org/x/sys v0.45.0 // indirect gopkg.in/go-playground/validator.v9 v9.31.0 ) diff --git a/go.sum b/go.sum index 9faf9ba9e..4d8f5ed93 100644 --- a/go.sum +++ b/go.sum @@ -4,8 +4,8 @@ cloud.google.com/go/auth/oauth2adapt v0.2.8 h1:keo8NaayQZ6wimpNSmW5OPc283g65QNIi cloud.google.com/go/auth/oauth2adapt v0.2.8/go.mod h1:XQ9y31RkqZCcwJWNSx2Xvric3RrU88hAYYbjDWYDL+c= cloud.google.com/go/compute/metadata v0.9.0 h1:pDUj4QMoPejqq20dK0Pg2N4yG9zIkYGdBtwLoEkH9Zs= cloud.google.com/go/compute/metadata v0.9.0/go.mod h1:E0bWwX5wTnLPedCKqk3pJmVgCBSM6qQI1yTBdEb3C10= -cloud.google.com/go/iam v1.9.0 h1:89wyjxT6DL4b5rk/Nk8eBC9DHqf+JiMstrn5IEYxFw4= -cloud.google.com/go/iam v1.9.0/go.mod h1:KP+nKGugNJW4LcLx1uEZcq1ok5sQHFaQehQNl4QDgV4= +cloud.google.com/go/iam v1.11.0 h1:KieQ9Pb+LLPak1O3Rv3GgCxhnmkYf7Xyh0P5HfF1jFM= +cloud.google.com/go/iam v1.11.0/go.mod h1:KP+nKGugNJW4LcLx1uEZcq1ok5sQHFaQehQNl4QDgV4= dario.cat/mergo v1.0.2 h1:85+piFYR1tMbRrLcDwR18y4UKJ3aH1Tbzi24VRW1TK8= dario.cat/mergo v1.0.2/go.mod h1:E/hbnu0NxMFBjpMIE34DRGLWqDy0g5FuKDhCb31ngxA= github.com/AdaLogics/go-fuzz-headers v0.0.0-20240806141605-e8a1dd7889d6 h1:He8afgbRMd7mFxO99hRNu+6tazq8nFF9lIwo9JFroBk= @@ -17,14 +17,14 @@ github.com/DATA-DOG/go-sqlmock v1.5.2 h1:OcvFkGmslmlZibjAjaHm3L//6LiuBgolP7Oputl github.com/DATA-DOG/go-sqlmock v1.5.2/go.mod h1:88MAG/4G7SMwSE3CeA0ZKzrT5CiOU3OJ+JlNzwDqpNU= github.com/KyleBanks/depth v1.2.1 h1:5h8fQADFrWtarTdtDudMmGsC7GPbOAu6RVB3ffsVFHc= github.com/KyleBanks/depth v1.2.1/go.mod h1:jzSb9d0L43HxTQfT+oSA1EEp2q+ne2uh6XgeJcm8brE= -github.com/LerianStudio/lib-auth/v2 v2.7.0 h1:y8S89ilWfU1qnag66QluXIsFkavK4JnvGqaPB0a2lZU= -github.com/LerianStudio/lib-auth/v2 v2.7.0/go.mod h1:KQHyqkKGDneetVsVOpb4oX6rjHSr8gaOUI1eqM48RDY= -github.com/LerianStudio/lib-commons/v5 v5.2.0-beta.11 h1:LBWJqIa5+/IV18jetVteZXPQShCbOn4IP3sjnCipHXk= -github.com/LerianStudio/lib-commons/v5 v5.2.0-beta.11/go.mod h1:Nocl3Iz9wJie/dxW01DmQ0BpmF+ViE1Gby1xiMsEXzA= -github.com/LerianStudio/lib-observability v1.0.0 h1:Ty9rlU8OJZoAmQ9lXYaXcDIBSiZOn6Aq1ofNzhwHq88= -github.com/LerianStudio/lib-observability v1.0.0/go.mod h1:kGZvqUqgFVTv5TkqqVqAtJ9GHEr0WMK2MfnjoQAyrp4= -github.com/LerianStudio/lib-streaming v1.2.0 h1:1d3buhDqLkMcjMb9MGOxpshkwNdehJ1fM8pDSpKbO8I= -github.com/LerianStudio/lib-streaming v1.2.0/go.mod h1:F6IqQqc7i1J2jh5pNohuEciS5Qc0lgFzXnF/6Lplyyc= +github.com/LerianStudio/lib-auth/v2 v2.8.0 h1:bm98H7CPkCAmhnQY5dtFtLLqJ1g9aXi8E30OD/t3l1g= +github.com/LerianStudio/lib-auth/v2 v2.8.0/go.mod h1:xj4dn4A2aZtGEqEX/wXBOChB7rs8OQuwKFUR6yheUzU= +github.com/LerianStudio/lib-commons/v5 v5.2.0-beta.12 h1:+wQQ/V4BwI8WhGvtuyT+sp0RvGK294DBkOa/+RBQ73k= +github.com/LerianStudio/lib-commons/v5 v5.2.0-beta.12/go.mod h1:WyyOgyFshvAHMTZc1dnRGRQ9qA9J2dWZluzJbSWlTtk= +github.com/LerianStudio/lib-observability v1.0.1 h1:Nz5U+dzhkTEu+86rQBXAkxB09OQE7/mxFZbZgZPFejo= +github.com/LerianStudio/lib-observability v1.0.1/go.mod h1:kGZvqUqgFVTv5TkqqVqAtJ9GHEr0WMK2MfnjoQAyrp4= +github.com/LerianStudio/lib-streaming v1.4.0 h1:kGyqppd6Iwr9wAOCc+fei/HKFjedBah4ns2kAOclTRU= +github.com/LerianStudio/lib-streaming v1.4.0/go.mod h1:WYo++PfwtquJh/6hBX2mRjZHPC7b8cNgdfCkGlw0sCg= github.com/Masterminds/squirrel v1.5.4 h1:uUcX/aBc8O7Fg9kaISIUsHXdKuqehiXAMQTYX8afzqM= github.com/Masterminds/squirrel v1.5.4/go.mod h1:NNaOrjSoIDfDA40n7sr2tPNZRfjzjA400rg+riTZj10= github.com/Microsoft/go-winio v0.6.2 h1:F2VQgta7ecxGYO8k3ZZz3RS8fVIXVxONVUPlNERoyfY= @@ -173,7 +173,6 @@ github.com/golang/snappy v1.0.0 h1:Oy607GVXHs7RtbggtPBnr2RmDArIsAefDwvrdWvRhGs= github.com/golang/snappy v1.0.0/go.mod h1:/XxbfmMg8lxefKM7IXC3fBNl/7bRcc72aCRzEWrmP2Q= github.com/gomodule/redigo v1.9.3 h1:dNPSXeXv6HCq2jdyWfjgmhBdqnR6PRO3m/G05nvpPC8= github.com/gomodule/redigo v1.9.3/go.mod h1:KsU3hiK/Ay8U42qpaJk+kuNa3C+spxapWpM+ywhcgtw= -github.com/google/go-cmp v0.5.6/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= github.com/google/go-cmp v0.7.0 h1:wk8382ETsv4JYUZwIsn6YpYiWiBsYLSJiTsyBybVuN8= github.com/google/go-cmp v0.7.0/go.mod h1:pXiqmnSA92OHEEa9HXL2W4E7lf9JzCmGVUdgjX3N/iU= github.com/google/gofuzz v1.2.0 h1:xRy4A+RhZaiKjJ1bPfwQ8sedCA+YS2YcCHW6ec7JMi0= @@ -182,8 +181,8 @@ github.com/google/s2a-go v0.1.9 h1:LGD7gtMgezd8a/Xak7mEWL0PjoTQFvpRudN895yqKW0= github.com/google/s2a-go v0.1.9/go.mod h1:YA0Ei2ZQL3acow2O62kdp9UlnvMmU7kA6Eutn0dXayM= github.com/google/uuid v1.6.0 h1:NIvaJDMOsjHA8n1jAhLSgzrAzy1Hgr+hNrb57e+94F0= github.com/google/uuid v1.6.0/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo= -github.com/googleapis/enterprise-certificate-proxy v0.3.15 h1:xolVQTEXusUcAA5UgtyRLjelpFFHWlPQ4XfWGc7MBas= -github.com/googleapis/enterprise-certificate-proxy v0.3.15/go.mod h1:vqVt9yG9480NtzREnTlmGSBmFrA+bzb0yl0TxoBQXOg= +github.com/googleapis/enterprise-certificate-proxy v0.3.16 h1:F/VPrx0YPBdksZJQdCAp0WUsqnNmZpUZszzfYt0M5Dw= +github.com/googleapis/enterprise-certificate-proxy v0.3.16/go.mod h1:9Yb0eAkH/Xqhvv3zbeKf/+wMJqCeocWc6KIhDvEAuYE= github.com/googleapis/gax-go/v2 v2.22.0 h1:PjIWBpgGIVKGoCXuiCoP64altEJCj3/Ei+kSU5vlZD4= github.com/googleapis/gax-go/v2 v2.22.0/go.mod h1:irWBbALSr0Sk3qlqb9SyJ1h68WjgeFuiOzI4Rqw5+aY= github.com/gopherjs/gopherjs v0.0.0-20181017120253-0766667cb4d1/go.mod h1:wJfORRmW1u3UXTncJ5qlYoELFm8eSnnEO6hX4iZ3EWY= @@ -211,8 +210,8 @@ github.com/json-iterator/go v1.1.12 h1:PV8peI4a0ysnczrg+LtxykD8LfKY9ML6u2jnxaEnr github.com/json-iterator/go v1.1.12/go.mod h1:e30LSqwooZae/UwlEbR2852Gd8hjQvJoHmT4TnhNGBo= github.com/jtolds/gls v4.20.0+incompatible/go.mod h1:QJZ7F/aHp+rZTRtaJ1ow/lLfFfVYBRgL+9YlvaHOwJU= github.com/klauspost/compress v1.15.0/go.mod h1:/3/Vjq9QcHkK5uEr5lBEmyoZ1iFhe47etQ6QUkpK6sk= -github.com/klauspost/compress v1.18.5 h1:/h1gH5Ce+VWNLSWqPzOVn6XBO+vJbCNGvjoaGBFW2IE= -github.com/klauspost/compress v1.18.5/go.mod h1:cwPg85FWrGar70rWktvGQj8/hthj3wpl0PGDogxkrSQ= +github.com/klauspost/compress v1.18.6 h1:2jupLlAwFm95+YDR+NwD2MEfFO9d4z4Prjl1XXDjuao= +github.com/klauspost/compress v1.18.6/go.mod h1:cwPg85FWrGar70rWktvGQj8/hthj3wpl0PGDogxkrSQ= github.com/klauspost/cpuid/v2 v2.2.10 h1:tBs3QSyvjDyFTq3uoc/9xFpCuOsJQFNPiAhYdw2skhE= github.com/klauspost/cpuid/v2 v2.2.10/go.mod h1:hqwkgyIinND0mEev00jJYCxPNVRVXFQeu1XKlok6oO0= github.com/kr/pretty v0.1.0/go.mod h1:dAy3ld7l9f0ibDNOQOHHMYYIIbhfbHSm3C4ZsoJORNo= @@ -230,8 +229,8 @@ github.com/leodido/go-urn v1.4.0 h1:WT9HwE9SGECu3lg4d/dIA+jxlljEa1/ffXKmRjqdmIQ= github.com/leodido/go-urn v1.4.0/go.mod h1:bvxc+MVxLKB4z00jd1z+Dvzr47oO32F/QSNjSBOlFxI= github.com/lib/pq v1.12.3 h1:tTWxr2YLKwIvK90ZXEw8GP7UFHtcbTtty8zsI+YjrfQ= github.com/lib/pq v1.12.3/go.mod h1:/p+8NSbOcwzAEI7wiMXFlgydTwcgTr3OSKMsD2BitpA= -github.com/lufia/plan9stats v0.0.0-20211012122336-39d0f177ccd0 h1:6E+4a0GO5zZEnZ81pIr0yLvtUWk2if982qA3F3QD6H4= -github.com/lufia/plan9stats v0.0.0-20211012122336-39d0f177ccd0/go.mod h1:zJYVVT2jmtg6P3p1VtQj7WsuWi/y4VnjVBn7F8KPB3I= +github.com/lufia/plan9stats v0.0.0-20260330125221-c963978e514e h1:Q6MvJtQK/iRcRtzAscm/zF23XxJlbECiGPyRicsX+Ak= +github.com/lufia/plan9stats v0.0.0-20260330125221-c963978e514e/go.mod h1:autxFIvghDt3jPTLoqZ9OZ7s9qTGNAWmYCjVFWPX/zg= github.com/magiconair/properties v1.8.10 h1:s31yESBquKXCV9a/ScB3ESkOjUYYv+X0rg8SYxI99mE= github.com/magiconair/properties v1.8.10/go.mod h1:Dhd985XPs7jluiymwWYZ0G4Z61jb3vdS329zhj2hYo0= github.com/mailru/easyjson v0.0.0-20190614124828-94de47d64c63/go.mod h1:C1wdFJiN94OJF2b5HbByQZoLdCWB1Yqtg26g4irojpc= @@ -249,10 +248,10 @@ github.com/moby/docker-image-spec v1.3.1 h1:jMKff3w6PgbfSa69GfNg+zN/XLhfXJGnEx3N github.com/moby/docker-image-spec v1.3.1/go.mod h1:eKmb5VW8vQEh/BAr2yvVNvuiJuY6UIocYsFu/DxxRpo= github.com/moby/go-archive v0.2.0 h1:zg5QDUM2mi0JIM9fdQZWC7U8+2ZfixfTYoHL7rWUcP8= github.com/moby/go-archive v0.2.0/go.mod h1:mNeivT14o8xU+5q1YnNrkQVpK+dnNe/K6fHqnTg4qPU= -github.com/moby/moby/api v1.54.1 h1:TqVzuJkOLsgLDDwNLmYqACUuTehOHRGKiPhvH8V3Nn4= -github.com/moby/moby/api v1.54.1/go.mod h1:+RQ6wluLwtYaTd1WnPLykIDPekkuyD/ROWQClE83pzs= -github.com/moby/moby/client v0.4.0 h1:S+2XegzHQrrvTCvF6s5HFzcrywWQmuVnhOXe2kiWjIw= -github.com/moby/moby/client v0.4.0/go.mod h1:QWPbvWchQbxBNdaLSpoKpCdf5E+WxFAgNHogCWDoa7g= +github.com/moby/moby/api v1.54.2 h1:wiat9QAhnDQjA7wk1kh/TqHz2I1uUA7M7t9SAl/JNXg= +github.com/moby/moby/api v1.54.2/go.mod h1:+RQ6wluLwtYaTd1WnPLykIDPekkuyD/ROWQClE83pzs= +github.com/moby/moby/client v0.4.1 h1:DMQgisVoMkmMs7fp3ROSdiBnoAu8+vo3GggFl06M/wY= +github.com/moby/moby/client v0.4.1/go.mod h1:z52C9O2POPOsnxZAy//WtKcQ32P+jT/NGeXu/7nfjGQ= github.com/moby/patternmatcher v0.6.1 h1:qlhtafmr6kgMIJjKJMDmMWq7WLkKIo23hsrpR3x084U= github.com/moby/patternmatcher v0.6.1/go.mod h1:hDPoyOpDY7OrrMDLaYoY3hf52gNCR/YOUYxkhApJIxc= github.com/moby/sys/sequential v0.6.0 h1:qrx7XFUd/5DxtqcoH1h438hF5TmOvzC/lspjy7zgvCU= @@ -294,8 +293,8 @@ github.com/power-devops/perfstat v0.0.0-20240221224432-82ca36839d55 h1:o4JXh1EVt github.com/power-devops/perfstat v0.0.0-20240221224432-82ca36839d55/go.mod h1:OmDBASR4679mdNQnz2pUhc2G8CO2JrUAVFDRBDP/hJE= github.com/rabbitmq/amqp091-go v1.11.0 h1:HxIctVm9Gid/Vtn706necmZ7Wj6pgGI2eqplRbEY8O8= github.com/rabbitmq/amqp091-go v1.11.0/go.mod h1:Hy4jKW5kQART1u+JkDTF9YYOQUHXqMuhrgxOEeS7G4o= -github.com/redis/go-redis/v9 v9.19.0 h1:XPVaaPSnG6RhYf7p+rmSa9zZfeVAnWsH5h3lxthOm/k= -github.com/redis/go-redis/v9 v9.19.0/go.mod h1:v/M13XI1PVCDcm01VtPFOADfZtHf8YW3baQf57KlIkA= +github.com/redis/go-redis/v9 v9.20.0 h1:WnQYxLkgO2xiXTCJY0ldIiI8dNqCDlQAG+AtaH7a2a0= +github.com/redis/go-redis/v9 v9.20.0/go.mod h1:v/M13XI1PVCDcm01VtPFOADfZtHf8YW3baQf57KlIkA= github.com/redis/rueidis v1.0.71 h1:pODtnAR5GAB7j4ekhldZ29HKOxe4Hph0GTDGk1ayEQY= github.com/redis/rueidis v1.0.71/go.mod h1:lfdcZzJ1oKGKL37vh9fO3ymwt+0TdjkkUCJxbgpmcgQ= github.com/redis/rueidis/rueidiscompat v1.0.71 h1:wNZ//kEjMZgBM0KCk7ncOX8KmAgROU2kDdDNpwheG4w= @@ -305,8 +304,8 @@ github.com/rogpeppe/go-internal v1.14.1/go.mod h1:MaRKkUm5W0goXpeCfT7UZI6fk/L7L7 github.com/russross/blackfriday/v2 v2.0.1/go.mod h1:+Rmxgy9KzJVeS9/2gXHxylqXiyQDYRxCVz55jmeOWTM= github.com/shirou/gopsutil v3.21.11+incompatible h1:+1+c1VGhc88SSonWP6foOcLhvnKlUeu/erjjvaPEYiI= github.com/shirou/gopsutil v3.21.11+incompatible/go.mod h1:5b4v6he4MtMOwMlS0TUMTu2PcXUg8+E1lC7eC3UO/RA= -github.com/shirou/gopsutil/v4 v4.26.3 h1:2ESdQt90yU3oXF/CdOlRCJxrP+Am1aBYubTMTfxJ1qc= -github.com/shirou/gopsutil/v4 v4.26.3/go.mod h1:LZ6ewCSkBqUpvSOf+LsTGnRinC6iaNUNMGBtDkJBaLQ= +github.com/shirou/gopsutil/v4 v4.26.4 h1:B4SXVbcwTyrocPHEmWBC4uCYr4Xcu3MK1TXqbprAOWY= +github.com/shirou/gopsutil/v4 v4.26.4/go.mod h1:LZ6ewCSkBqUpvSOf+LsTGnRinC6iaNUNMGBtDkJBaLQ= github.com/shopspring/decimal v1.4.0 h1:bxl37RwXBklmTi0C79JfXCEBD1cqqHt0bbgBAGFp81k= github.com/shopspring/decimal v1.4.0/go.mod h1:gawqmDU56v4yIKSwfBSFip1HdCCXN8/+DMd9qYNcwME= github.com/shurcooL/sanitized_anchor_name v1.0.0/go.mod h1:1NzhyTcUVG4SuEtjjoZeVRXNmyL/1OwPU0+IJeTBvfc= @@ -349,12 +348,12 @@ github.com/testcontainers/testcontainers-go/modules/redpanda v0.42.0 h1:mcPLvf3r github.com/testcontainers/testcontainers-go/modules/redpanda v0.42.0/go.mod h1:Yq0WrUIIsMkJoZ2DadCJ1Zq4RFhjPPpSNYHpjRrGfDU= github.com/testcontainers/testcontainers-go/modules/toxiproxy v0.42.0 h1:BW/+geTayECivCdk5HvO5otFEG0gWtuy2eaxBbPcHxk= github.com/testcontainers/testcontainers-go/modules/toxiproxy v0.42.0/go.mod h1:ki/eZfOboEaeeLg15TV07Mk/QY8Nwf582IujDSp3KSk= -github.com/tklauser/go-sysconf v0.3.16 h1:frioLaCQSsF5Cy1jgRBrzr6t502KIIwQ0MArYICU0nA= -github.com/tklauser/go-sysconf v0.3.16/go.mod h1:/qNL9xxDhc7tx3HSRsLWNnuzbVfh3e7gh/BmM179nYI= -github.com/tklauser/numcpus v0.11.0 h1:nSTwhKH5e1dMNsCdVBukSZrURJRoHbSEQjdEbY+9RXw= -github.com/tklauser/numcpus v0.11.0/go.mod h1:z+LwcLq54uWZTX0u/bGobaV34u6V7KNlTZejzM6/3MQ= -github.com/twmb/franz-go v1.21.0 h1:J3uB/poWgHD6VIilER2uCPFAZHDRXVFT+11pBgRKod4= -github.com/twmb/franz-go v1.21.0/go.mod h1:1o+jj5oRbItsIMoE+DGpfJIcPcPtDdtkcNFPj4bWNwU= +github.com/tklauser/go-sysconf v0.4.0 h1:7H0uAN+7RkwWRaxhYXDLqa5V3LPrJeV8wmD9dRUgPQU= +github.com/tklauser/go-sysconf v0.4.0/go.mod h1:8mTNWyog7H+MpKijp4VmKJAd2bbYQ2zuUwkYRbUArPI= +github.com/tklauser/numcpus v0.12.0 h1:NR85qdvHA9pFse3x3weVZ0r0ST8R6l5RHbZrlRaqob4= +github.com/tklauser/numcpus v0.12.0/go.mod h1:ABHeXzJnr/qqwguhClkZKT1/8VABcYrsyUiUGobwWJg= +github.com/twmb/franz-go v1.21.2 h1:WrvV/spF48JzcRylqDQy02Vm6V6W4lhtD9Y4BOYNMu4= +github.com/twmb/franz-go v1.21.2/go.mod h1:rfoMTnVk7107fhTGxfEKIHP/e7tPe6oyij/ywzO0czk= github.com/twmb/franz-go/pkg/kadm v1.18.0 h1:WRf/LZmDdcDXwX7WMbtDU++v+b3NzYh2bCGoPMmzirw= github.com/twmb/franz-go/pkg/kadm v1.18.0/go.mod h1:XeLhGoLXLFzK8/ryv5FfpxPxGwj4oFEGpPJMB/x6KDE= github.com/twmb/franz-go/pkg/kfake v0.0.0-20260427145746-f3fd99a8f2b8 h1:Cv1o64JH8wwcsVH6nSPach4CXqkL+fFSpV5U44kogMU= @@ -366,8 +365,8 @@ github.com/valyala/bytebufferpool v1.0.0 h1:GqA5TC/0021Y/b9FG4Oi9Mr3q7XYx6Kllzaw github.com/valyala/bytebufferpool v1.0.0/go.mod h1:6bBcMArwyJ5K/AmCkWv1jt77kVWyCJ6HpOuEn7z0Csc= github.com/valyala/fasthttp v1.35.0/go.mod h1:t/G+3rLek+CyY9bnIE+YlMRddxVAAGjhxndDB4i4C0I= github.com/valyala/fasthttp v1.36.0/go.mod h1:t/G+3rLek+CyY9bnIE+YlMRddxVAAGjhxndDB4i4C0I= -github.com/valyala/fasthttp v1.70.0 h1:LAhMGcWk13QZWm85+eg8ZBNbrq5mnkWFGbHMUJHIdXA= -github.com/valyala/fasthttp v1.70.0/go.mod h1:oDZEHHkJ/Buyklg6uURmYs19442zFSnCIfX3j1FY3pE= +github.com/valyala/fasthttp v1.71.0 h1:tepR7H+Guh9VUqxxcPggYi8R3lGUu2Rsdh+z7/FCY3k= +github.com/valyala/fasthttp v1.71.0/go.mod h1:z1sDUvOShhXq/C9mwH/fSm1Vb71tUJwmQdgkBrBNwnA= github.com/valyala/tcplisten v1.0.0/go.mod h1:T0xQ8SeCZGxckz9qRXTfG43PvQ/mcWh7FwZEA7Ioqkc= github.com/vmihailenco/msgpack/v5 v5.4.1 h1:cQriyiUvjTwOHg8QZaPihLWeRAAVoCpE00IUPn0Bjt8= github.com/vmihailenco/msgpack/v5 v5.4.1/go.mod h1:GaZTsDaehaPpQVyxrf5mtQlH+pc21PIudVV/E3rRQok= @@ -395,38 +394,40 @@ go.mongodb.org/mongo-driver v1.17.9 h1:IexDdCuuNJ3BHrELgBlyaH9p60JXAvdzWR128q+U5 go.mongodb.org/mongo-driver v1.17.9/go.mod h1:LlOhpH5NUEfhxcAwG0UEkMqwYcc4JU18gtCdGudk/tQ= go.opentelemetry.io/auto/sdk v1.2.1 h1:jXsnJ4Lmnqd11kwkBV2LgLoFMZKizbCi5fNZ/ipaZ64= go.opentelemetry.io/auto/sdk v1.2.1/go.mod h1:KRTj+aOaElaLi+wW1kO/DZRXwkF4C5xPbEe3ZiIhN7Y= -go.opentelemetry.io/contrib/bridges/otelzap v0.18.0 h1:EkWTww6Nqs2P29r01NeuNsG7qNJtoWWaT1fx/CKode8= -go.opentelemetry.io/contrib/bridges/otelzap v0.18.0/go.mod h1:lj3bgA/c7nJy0NhxqyvWJFC30aTgB+G0RKDdLbvJ4QM= -go.opentelemetry.io/contrib/instrumentation/google.golang.org/grpc/otelgrpc v0.68.0 h1:0Qx7VGBacMm9ZENQ7TnNObTYI4ShC+lHI16seduaxZo= -go.opentelemetry.io/contrib/instrumentation/google.golang.org/grpc/otelgrpc v0.68.0/go.mod h1:Sje3i3MjSPKTSPvVWCaL8ugBzJwik3u4smCjUeuupqg= -go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp v0.68.0 h1:CqXxU8VOmDefoh0+ztfGaymYbhdB/tT3zs79QaZTNGY= -go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp v0.68.0/go.mod h1:BuhAPThV8PBHBvg8ZzZ/Ok3idOdhWIodywz2xEcRbJo= -go.opentelemetry.io/otel v1.43.0 h1:mYIM03dnh5zfN7HautFE4ieIig9amkNANT+xcVxAj9I= -go.opentelemetry.io/otel v1.43.0/go.mod h1:JuG+u74mvjvcm8vj8pI5XiHy1zDeoCS2LB1spIq7Ay0= -go.opentelemetry.io/otel/exporters/otlp/otlplog/otlploggrpc v0.19.0 h1:Dn8rkudDzY6KV9dr/D/bTUuWgqDf9xe0rr4G2elrn0Y= -go.opentelemetry.io/otel/exporters/otlp/otlplog/otlploggrpc v0.19.0/go.mod h1:gMk9F0xDgyN9M/3Ed5Y1wKcx/9mlU91NXY2SNq7RQuU= -go.opentelemetry.io/otel/exporters/otlp/otlpmetric/otlpmetricgrpc v1.43.0 h1:8UQVDcZxOJLtX6gxtDt3vY2WTgvZqMQRzjsqiIHQdkc= -go.opentelemetry.io/otel/exporters/otlp/otlpmetric/otlpmetricgrpc v1.43.0/go.mod h1:2lmweYCiHYpEjQ/lSJBYhj9jP1zvCvQW4BqL9dnT7FQ= -go.opentelemetry.io/otel/exporters/otlp/otlptrace v1.43.0 h1:88Y4s2C8oTui1LGM6bTWkw0ICGcOLCAI5l6zsD1j20k= -go.opentelemetry.io/otel/exporters/otlp/otlptrace v1.43.0/go.mod h1:Vl1/iaggsuRlrHf/hfPJPvVag77kKyvrLeD10kpMl+A= -go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracegrpc v1.43.0 h1:RAE+JPfvEmvy+0LzyUA25/SGawPwIUbZ6u0Wug54sLc= -go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracegrpc v1.43.0/go.mod h1:AGmbycVGEsRx9mXMZ75CsOyhSP6MFIcj/6dnG+vhVjk= -go.opentelemetry.io/otel/log v0.19.0 h1:KUZs/GOsw79TBBMfDWsXS+KZ4g2Ckzksd1ymzsIEbo4= -go.opentelemetry.io/otel/log v0.19.0/go.mod h1:5DQYeGmxVIr4n0/BcJvF4upsraHjg6vudJJpnkL6Ipk= -go.opentelemetry.io/otel/log/logtest v0.19.0 h1:HdSsl4ndTK15LtJGLWBfMsSlLrCgSeE3VMzwOrLYiYs= -go.opentelemetry.io/otel/log/logtest v0.19.0/go.mod h1:c1sH1nOHTwfMCWhhQTdWGqxgDjZhtkbkzAqGGyj0Ijs= -go.opentelemetry.io/otel/metric v1.43.0 h1:d7638QeInOnuwOONPp4JAOGfbCEpYb+K6DVWvdxGzgM= -go.opentelemetry.io/otel/metric v1.43.0/go.mod h1:RDnPtIxvqlgO8GRW18W6Z/4P462ldprJtfxHxyKd2PY= -go.opentelemetry.io/otel/sdk v1.43.0 h1:pi5mE86i5rTeLXqoF/hhiBtUNcrAGHLKQdhg4h4V9Dg= -go.opentelemetry.io/otel/sdk v1.43.0/go.mod h1:P+IkVU3iWukmiit/Yf9AWvpyRDlUeBaRg6Y+C58QHzg= -go.opentelemetry.io/otel/sdk/log v0.19.0 h1:scYVLqT22D2gqXItnWiocLUKGH9yvkkeql5dBDiXyko= -go.opentelemetry.io/otel/sdk/log v0.19.0/go.mod h1:vFBowwXGLlW9AvpuF7bMgnNI95LiW10szrOdvzBHlAg= -go.opentelemetry.io/otel/sdk/log/logtest v0.19.0 h1:BEbF7ZBB6qQloV/Ub1+3NQoOUnVtcGkU3XX4Ws3GQfk= -go.opentelemetry.io/otel/sdk/log/logtest v0.19.0/go.mod h1:Lua81/3yM0wOmoHTokLj9y9ADeA02v1naRrVrkAZuKk= -go.opentelemetry.io/otel/sdk/metric v1.43.0 h1:S88dyqXjJkuBNLeMcVPRFXpRw2fuwdvfCGLEo89fDkw= -go.opentelemetry.io/otel/sdk/metric v1.43.0/go.mod h1:C/RJtwSEJ5hzTiUz5pXF1kILHStzb9zFlIEe85bhj6A= -go.opentelemetry.io/otel/trace v1.43.0 h1:BkNrHpup+4k4w+ZZ86CZoHHEkohws8AY+WTX09nk+3A= -go.opentelemetry.io/otel/trace v1.43.0/go.mod h1:/QJhyVBUUswCphDVxq+8mld+AvhXZLhe+8WVFxiFff0= +go.opentelemetry.io/contrib/bridges/otelzap v0.19.0 h1:48Eq3xxFx2KlL/tF7lnl42kKJBDlhNTLRzv0h154JnM= +go.opentelemetry.io/contrib/bridges/otelzap v0.19.0/go.mod h1:cQbV77F0u6HmtZPiQD9oxp2esaOEb4uLqIta6OFIKOk= +go.opentelemetry.io/contrib/instrumentation/google.golang.org/grpc/otelgrpc v0.69.0 h1:2yEATaop1/a1I4psnSLgWVPLWwCzkqWakgJy7xTDVy0= +go.opentelemetry.io/contrib/instrumentation/google.golang.org/grpc/otelgrpc v0.69.0/go.mod h1:D7J12YRapIekYyPWgGPlA/23pRmpSEZC5xJC/TTLI9U= +go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp v0.69.0 h1:8tvICD4vSTOOsNrsI4Ljf6C+6UKvpTEH5XY3JMoyPoo= +go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp v0.69.0/go.mod h1:z9+yiacE0IHRqM4qFfkbt/JYlmYXgss8GY/jXoNuPJI= +go.opentelemetry.io/otel v1.44.0 h1:JjwHmHpA4iZ3wBxluu2fbbE7j4kqlE8jXyAyPXH7HqU= +go.opentelemetry.io/otel v1.44.0/go.mod h1:BMgjTHL9WPRlRjL2oZCBTL4whCGtXch2H4BhOPIAyYc= +go.opentelemetry.io/otel/exporters/otlp/otlplog/otlploggrpc v0.20.0 h1:rydZ9sxbcFdm/oWrVyfLTjHIygMgv0bEeMd+3B/BvoM= +go.opentelemetry.io/otel/exporters/otlp/otlplog/otlploggrpc v0.20.0/go.mod h1:earQ25dooT0Hhspq59DZ8YCC50jWfOlFEeWoxy/P444= +go.opentelemetry.io/otel/exporters/otlp/otlpmetric/otlpmetricgrpc v1.44.0 h1:SUplec5dp06reu1zaXmOXdvqH398taqrDXqUl99jxSc= +go.opentelemetry.io/otel/exporters/otlp/otlpmetric/otlpmetricgrpc v1.44.0/go.mod h1:ho2g4N+ane+swq5I/VBkKWnRDY4kUINH3FuqyZqX/Ug= +go.opentelemetry.io/otel/exporters/otlp/otlptrace v1.44.0 h1:4YsVu3B8+3qtWYYrsUYgn0OG78pN0rnNPRGX4SbokQI= +go.opentelemetry.io/otel/exporters/otlp/otlptrace v1.44.0/go.mod h1:+wnlSn0mD1ADVMe3v9Z/WIaiz6q6gL2J/ejaAmdmv80= +go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracegrpc v1.44.0 h1:qazEJlUOQzhCpzQpFETGby7EdqjI1wsd0W+6Gg1SCTU= +go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracegrpc v1.44.0/go.mod h1:fOD2Yefuxixkx3ahVNf0O/PERb6r4OlbxfATVnYvzCo= +go.opentelemetry.io/otel/log v0.20.0 h1:/5i0vuHxCLWUfChWG41K9wkM0jafruPw9NU1/RCJirs= +go.opentelemetry.io/otel/log v0.20.0/go.mod h1:wOcMcjsZpG8x7Bak7IhSi/lg8wscV2C1VdrKCLPlt0E= +go.opentelemetry.io/otel/log/logtest v0.20.0 h1:+tsZVE15N+RWyN9lUzsRyw7hMZXNMepGu105Eim82/k= +go.opentelemetry.io/otel/log/logtest v0.20.0/go.mod h1:zS9Ryx9RrEAG2tgapMBSvacwhVSSOGSaSiWWgW3NPlQ= +go.opentelemetry.io/otel/metric v1.44.0 h1:1w0gILTcHdr3YI+ixLyjemwrVnsMURbTZFrSYCdDdmc= +go.opentelemetry.io/otel/metric v1.44.0/go.mod h1:8O7hanEPBNgEMmybD3s2VBKcgWOCsA6tzHBPODAiquo= +go.opentelemetry.io/otel/metric/x v0.66.0 h1:YkCrx1zLOChi9ZcZ6euupOcsgzbVlec7D/xoEU1+cTA= +go.opentelemetry.io/otel/metric/x v0.66.0/go.mod h1:d1+BDj9t96do0/1LoU1ayfCv79ZgNE41qbhBvnMOBZk= +go.opentelemetry.io/otel/sdk v1.44.0 h1:nHYwb9lK+fJPU/dnT6s7W7Z8itMWyqrnVfbheVYrZ58= +go.opentelemetry.io/otel/sdk v1.44.0/go.mod h1:Osuydd3Se74nqjAKxid74N5eC+jfEqfTegHRnq58oK0= +go.opentelemetry.io/otel/sdk/log v0.20.0 h1:vM3xI7TQgKPiSghe6urZtAkyFY7SodrSpC83CffDFuY= +go.opentelemetry.io/otel/sdk/log v0.20.0/go.mod h1:Knej2nmsTUzN79T2eeXdRsjjPcoxoq2pUyUHz9TFyyU= +go.opentelemetry.io/otel/sdk/log/logtest v0.20.0 h1:OqdRZ1guyzamK3M6LlRsmGqRrjkHWw6WZOKKli5ELpg= +go.opentelemetry.io/otel/sdk/log/logtest v0.20.0/go.mod h1:PuMIlm7zAt7c3z8zfOI5ox4iT1Z87We+PF6YoINux/M= +go.opentelemetry.io/otel/sdk/metric v1.44.0 h1:3LlKgI+VjbVsjNRFZJZAJ30WjXC5VkNRks6si09iEfI= +go.opentelemetry.io/otel/sdk/metric v1.44.0/go.mod h1:5B5pMARnXxKhltooO4xUuCBorl65a4EpnTalObqOigA= +go.opentelemetry.io/otel/trace v1.44.0 h1:jxF5CsGYCe74MCRx2X4g7WsY/VBKRqqpNvXlX/6gtIk= +go.opentelemetry.io/otel/trace v1.44.0/go.mod h1:oLl1jrMQAVo6v3GAggN+1VH9VIz9iUSvW53sW1Q8PIE= go.opentelemetry.io/proto/otlp v1.10.0 h1:IQRWgT5srOCYfiWnpqUYz9CVmbO8bFmKcwYxpuCSL2g= go.opentelemetry.io/proto/otlp v1.10.0/go.mod h1:/CV4QoCR/S9yaPj8utp3lvQPoqMtxXdzn7ozvvozVqk= go.uber.org/atomic v1.11.0 h1:ZvwS0R+56ePWxUNi+Atn9dWONBPp/AUETXlHW0DxSjE= @@ -445,14 +446,14 @@ golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACk golang.org/x/crypto v0.0.0-20191011191535-87dc89f01550/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI= golang.org/x/crypto v0.0.0-20210921155107-089bfa567519/go.mod h1:GvvjBRRGRdwPK5ydBHafDWAxML/pGHZbMvKqRZ5+Abc= golang.org/x/crypto v0.0.0-20220214200702-86341886e292/go.mod h1:IxCIyHEi3zRg3s0A5j5BB6A9Jmi73HwBIUl50j+osU4= -golang.org/x/crypto v0.50.0 h1:zO47/JPrL6vsNkINmLoo/PH1gcxpls50DNogFvB5ZGI= -golang.org/x/crypto v0.50.0/go.mod h1:3muZ7vA7PBCE6xgPX7nkzzjiUq87kRItoJQM1Yo8S+Q= -golang.org/x/exp v0.0.0-20260410095643-746e56fc9e2f h1:W3F4c+6OLc6H2lb//N1q4WpJkhzJCK5J6kUi1NTVXfM= -golang.org/x/exp v0.0.0-20260410095643-746e56fc9e2f/go.mod h1:J1xhfL/vlindoeF/aINzNzt2Bket5bjo9sdOYzOsU80= +golang.org/x/crypto v0.52.0 h1:RMs7fP2rXdep0CftQlK8Uf+kibLm7qkCcradZWYz988= +golang.org/x/crypto v0.52.0/go.mod h1:1QgfPxDqh0T2M/elOJtp9RvuR95kVjir0e6/BvEmGbc= +golang.org/x/exp v0.0.0-20260527015227-08cc5374adb3 h1:VHEvKbpgPXcPXn40t9cDTGK3JZwMikIEyF/CTrFfu7k= +golang.org/x/exp v0.0.0-20260527015227-08cc5374adb3/go.mod h1:d2fgXJLVs4dYDHUk5lwMIfzRzSrWCfGZb0ZqeLa/Vcw= golang.org/x/mod v0.4.2/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA= golang.org/x/mod v0.6.0-dev.0.20220419223038-86c51ed26bb4/go.mod h1:jJ57K6gSWd91VN4djpZkiMVwK6gcyfeH4XE8wZrZaV4= -golang.org/x/mod v0.35.0 h1:Ww1D637e6Pg+Zb2KrWfHQUnH2dQRLBQyAtpr/haaJeM= -golang.org/x/mod v0.35.0/go.mod h1:+GwiRhIInF8wPm+4AoT6L0FA1QWAad3OMdTRx4tFYlU= +golang.org/x/mod v0.36.0 h1:JJjpVx6myfUsUdAzZuOSTTmRE0PfZeNWzzvKrP7amb4= +golang.org/x/mod v0.36.0/go.mod h1:moc6ELqsWcOw5Ef3xVprK5ul/MvtVvkIXLziUOICjUQ= golang.org/x/net v0.0.0-20190311183353-d8887717615a/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg= golang.org/x/net v0.0.0-20190404232315-eb5bcb51f2a3/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg= golang.org/x/net v0.0.0-20190620200207-3b0461eec859/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= @@ -463,8 +464,8 @@ golang.org/x/net v0.0.0-20211112202133-69e39bad7dc2/go.mod h1:9nx3DQGgdP8bBQD5qx golang.org/x/net v0.0.0-20220225172249-27dd8689420f/go.mod h1:CfG3xpIq0wQ8r1q4Su4UZFWDARRcnwPjda9FqA0JpMk= golang.org/x/net v0.0.0-20220722155237-a158d28d115b/go.mod h1:XRhObCWvk6IyKnWLug+ECip1KBveYUHfp+8e9klMJ9c= golang.org/x/net v0.7.0/go.mod h1:2Tu9+aMcznHK/AK1HMvgo6xiTLG5rD5rZLDS+rp2Bjs= -golang.org/x/net v0.53.0 h1:d+qAbo5L0orcWAr0a9JweQpjXF19LMXJE8Ey7hwOdUA= -golang.org/x/net v0.53.0/go.mod h1:JvMuJH7rrdiCfbeHoo3fCQU24Lf5JJwT9W3sJFulfgs= +golang.org/x/net v0.55.0 h1:bcvxaJn3e1U6InsFWt1JUq1aSjnRxLzT2rtD2KfkDF8= +golang.org/x/net v0.55.0/go.mod h1:L5U2KuzuOe1lY7Z+aWVIKK6qEeJXnXV9yzGA+WCHJww= golang.org/x/oauth2 v0.36.0 h1:peZ/1z27fi9hUOFCAZaHyrpWG5lwe0RJEEEeH0ThlIs= golang.org/x/oauth2 v0.36.0/go.mod h1:YDBUJMTkDnJS+A4BP4eZBjCqtokkg1hODuPjwiGPO7Q= golang.org/x/sync v0.0.0-20190423024810-112230192c58/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= @@ -488,21 +489,21 @@ golang.org/x/sys v0.0.0-20220520151302-bc2c85ada10a/go.mod h1:oPkhp1MJrh7nUepCBc golang.org/x/sys v0.0.0-20220722155257-8c9f86f7a55f/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.1.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.5.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= -golang.org/x/sys v0.43.0 h1:Rlag2XtaFTxp19wS8MXlJwTvoh8ArU6ezoyFsMyCTNI= -golang.org/x/sys v0.43.0/go.mod h1:4GL1E5IUh+htKOUEOaiffhrAeqysfVGipDYzABqnCmw= +golang.org/x/sys v0.45.0 h1:dO4czNzziLiiXplLQgBCEpCvXQ3dnkn0SdaZSYdQ+FY= +golang.org/x/sys v0.45.0/go.mod h1:4GL1E5IUh+htKOUEOaiffhrAeqysfVGipDYzABqnCmw= golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo= golang.org/x/term v0.0.0-20210927222741-03fcf44c2211/go.mod h1:jbD1KX2456YbFQfuXm/mYQcufACuNUgVhRMnK/tPxf8= golang.org/x/term v0.5.0/go.mod h1:jMB1sMXY+tzblOD4FWmEbocvup2/aLOaQEp7JmGp78k= -golang.org/x/term v0.42.0 h1:UiKe+zDFmJobeJ5ggPwOshJIVt6/Ft0rcfrXZDLWAWY= -golang.org/x/term v0.42.0/go.mod h1:Dq/D+snpsbazcBG5+F9Q1n2rXV8Ma+71xEjTRufARgY= +golang.org/x/term v0.43.0 h1:S4RLU2sB31O/NCl+zFN9Aru9A/Cq2aqKpTZJ6B+DwT4= +golang.org/x/term v0.43.0/go.mod h1:lrhlHNdQJHO+1qVYiHfFKVuVioJIheAc3fBSMFYEIsk= golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= golang.org/x/text v0.3.3/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= golang.org/x/text v0.3.6/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= golang.org/x/text v0.3.7/go.mod h1:u+2+/6zg+i71rQMx5EYifcz6MCKuco9NR6JIITiCfzQ= golang.org/x/text v0.3.8/go.mod h1:E6s5w1FMmriuDzIBO73fBruAKo1PCIq6d2Q6DHfQ8WQ= golang.org/x/text v0.7.0/go.mod h1:mrYo+phRRbMaCq/xk9113O4dZlRixOauAjOtrjsXDZ8= -golang.org/x/text v0.36.0 h1:JfKh3XmcRPqZPKevfXVpI1wXPTqbkE5f7JA92a55Yxg= -golang.org/x/text v0.36.0/go.mod h1:NIdBknypM8iqVmPiuco0Dh6P5Jcdk8lJL0CUebqK164= +golang.org/x/text v0.37.0 h1:Cqjiwd9eSg8e0QAkyCaQTNHFIIzWtidPahFWR83rTrc= +golang.org/x/text v0.37.0/go.mod h1:a5sjxXGs9hsn/AJVwuElvCAo9v8QYLzvavO5z2PiM38= golang.org/x/time v0.15.0 h1:bbrp8t3bGUeFOx08pvsMYRTCVSMk89u4tKbNOZbp88U= golang.org/x/time v0.15.0/go.mod h1:Y4YMaQmXwGQZoFaVFk4YpCt4FLQMYKZe9oeV/f4MSno= golang.org/x/tools v0.0.0-20180917221912-90fa682c2a6e/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= @@ -510,24 +511,23 @@ golang.org/x/tools v0.0.0-20190328211700-ab21143f2384/go.mod h1:LCzVGOaR6xXOjkQ3 golang.org/x/tools v0.0.0-20191119224855-298f0cb1881e/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= golang.org/x/tools v0.1.7/go.mod h1:LGqMHiF4EqQNHR1JncWGqT5BVaXmza+X+BDGol+dOxo= golang.org/x/tools v0.1.12/go.mod h1:hNGJHUnrk76NpqgfD5Aqm5Crs+Hm0VOH/i9J2+nxYbc= -golang.org/x/tools v0.44.0 h1:UP4ajHPIcuMjT1GqzDWRlalUEoY+uzoZKnhOjbIPD2c= -golang.org/x/tools v0.44.0/go.mod h1:KA0AfVErSdxRZIsOVipbv3rQhVXTnlU6UhKxHd1seDI= +golang.org/x/tools v0.45.0 h1:18qN3FAooORvApf5XjCXgsuayZOEtXf6JK18I3+ONa8= +golang.org/x/tools v0.45.0/go.mod h1:LuUGqqaXcXMEFEruIVJVm5mgDD8vww/z/SR1gQ4uE/0= golang.org/x/xerrors v0.0.0-20190717185122-a985d3407aa7/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= golang.org/x/xerrors v0.0.0-20191011141410-1b5146add898/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= -golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= golang.org/x/xerrors v0.0.0-20200804184101-5ec99f83aff1/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= gonum.org/v1/gonum v0.17.0 h1:VbpOemQlsSMrYmn7T2OUvQ4dqxQXU+ouZFQsZOx50z4= gonum.org/v1/gonum v0.17.0/go.mod h1:El3tOrEuMpv2UdMrbNlKEh9vd86bmQ6vqIcDwxEOc1E= -google.golang.org/api v0.276.0 h1:nVArUtfLEihtW+b0DdcqRGK1xoEm2+ltAihyztq7MKY= -google.golang.org/api v0.276.0/go.mod h1:Fnag/EWUPIcJXuIkP1pjoTgS5vdxlk3eeemL7Do6bvw= +google.golang.org/api v0.282.0 h1:WmJiSVqUnKqJCpJOx7YADbXaC+9DDsnGSfllFSj7R2I= +google.golang.org/api v0.282.0/go.mod h1:6Wssta4c5n9qHq5CBhmlai5h/PUa1djdDAIhYEHyvcM= google.golang.org/genproto v0.0.0-20260319201613-d00831a3d3e7 h1:XzmzkmB14QhVhgnawEVsOn6OFsnpyxNPRY9QV01dNB0= google.golang.org/genproto v0.0.0-20260319201613-d00831a3d3e7/go.mod h1:L43LFes82YgSonw6iTXTxXUX1OlULt4AQtkik4ULL/I= -google.golang.org/genproto/googleapis/api v0.0.0-20260427160629-7cedc36a6bc4 h1:yOzSCGPx+cp5VO7IxvZ9SBFF7j1tZVcNtlHR2iYKtVo= -google.golang.org/genproto/googleapis/api v0.0.0-20260427160629-7cedc36a6bc4/go.mod h1:Q9HWtNeE7tM9npdIsEvqXj1QJIvVoeAV3rtXtS715Cw= -google.golang.org/genproto/googleapis/rpc v0.0.0-20260427160629-7cedc36a6bc4 h1:tEkOQcXgF6dH1G+MVKZrfpYvozGrzb91k6ha7jireSM= -google.golang.org/genproto/googleapis/rpc v0.0.0-20260427160629-7cedc36a6bc4/go.mod h1:4Hqkh8ycfw05ld/3BWL7rJOSfebL2Q+DVDeRgYgxUU8= -google.golang.org/grpc v1.81.0 h1:W3G9N3KQf3BU+YuCtGKJk0CmxQNbAISICD/9AORxLIw= -google.golang.org/grpc v1.81.0/go.mod h1:xGH9GfzOyMTGIOXBJmXt+BX/V0kcdQbdcuwQ/zNw42I= +google.golang.org/genproto/googleapis/api v0.0.0-20260526163538-3dc84a4a5aaa h1:Kjn0N0tCrDgiAFW+lGO4JZ3ck44CehvJQMAwj9QF0G8= +google.golang.org/genproto/googleapis/api v0.0.0-20260526163538-3dc84a4a5aaa/go.mod h1:q4lMZS6kskjT5HvCPrnnypcDPVJqT/f4nfxmkE7gryY= +google.golang.org/genproto/googleapis/rpc v0.0.0-20260526163538-3dc84a4a5aaa h1:mZHHdPZl0dbGHCflZgAq/Q468DWVFcU2whhB2KAo8fk= +google.golang.org/genproto/googleapis/rpc v0.0.0-20260526163538-3dc84a4a5aaa/go.mod h1:4Hqkh8ycfw05ld/3BWL7rJOSfebL2Q+DVDeRgYgxUU8= +google.golang.org/grpc v1.81.1 h1:VnnIIZ88UzOOKLukQi+ImGz8O1Wdp8nAGGnvOfEIWQQ= +google.golang.org/grpc v1.81.1/go.mod h1:xGH9GfzOyMTGIOXBJmXt+BX/V0kcdQbdcuwQ/zNw42I= google.golang.org/protobuf v1.36.11 h1:fV6ZwhNocDyBLK0dj+fg8ektcVegBBuEolpbTQyBNVE= google.golang.org/protobuf v1.36.11/go.mod h1:HTf+CrKn2C3g5S8VImy6tdcUvCska2kB7j23XfzDpco= gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= diff --git a/pkg/mongo/mongo.go b/pkg/mongo/mongo.go index 32768de5d..8f3d33950 100644 --- a/pkg/mongo/mongo.go +++ b/pkg/mongo/mongo.go @@ -9,7 +9,7 @@ import ( "fmt" "strings" - libLog "github.com/LerianStudio/lib-commons/v5/commons/log" + libLog "github.com/LerianStudio/lib-observability/log" "github.com/iancoleman/strcase" "go.mongodb.org/mongo-driver/bson" ) diff --git a/pkg/mtransaction/validations.go b/pkg/mtransaction/validations.go index f7ae90deb..2260426b9 100644 --- a/pkg/mtransaction/validations.go +++ b/pkg/mtransaction/validations.go @@ -11,9 +11,10 @@ import ( "time" "github.com/LerianStudio/lib-commons/v5/commons" + libObservability "github.com/LerianStudio/lib-observability" constant "github.com/LerianStudio/lib-commons/v5/commons/constants" - libLog "github.com/LerianStudio/lib-commons/v5/commons/log" - "github.com/LerianStudio/lib-commons/v5/commons/opentelemetry" + libLog "github.com/LerianStudio/lib-observability/log" + "github.com/LerianStudio/lib-observability/tracing" "github.com/LerianStudio/midaz/v3/pkg" pkgConstant "github.com/LerianStudio/midaz/v3/pkg/constant" "github.com/shopspring/decimal" @@ -33,7 +34,7 @@ func CheckTransactionDate(ctx context.Context, transactionInput Transaction, tra return now, nil } - logger := commons.NewLoggerFromContext(ctx) + logger := libObservability.NewLoggerFromContext(ctx) if transactionInput.TransactionDate.After(now) { err := pkg.ValidateBusinessError(pkgConstant.ErrInvalidFutureTransactionDate, pkgConstant.EntityTransaction) @@ -54,28 +55,28 @@ func CheckTransactionDate(ctx context.Context, transactionInput Transaction, tra // ValidateBalancesRules function with some validates in accounts operations func ValidateBalancesRules(ctx context.Context, transaction Transaction, validate Responses, balances []*Balance) error { - logger, tracer, _, _ := commons.NewTrackingFromContext(ctx) + logger, tracer, _, _ := libObservability.NewTrackingFromContext(ctx) _, spanValidateBalances := tracer.Start(ctx, "transaction.validate_balances_rules") defer spanValidateBalances.End() if len(balances) != (len(validate.From) + len(validate.To)) { err := pkg.ValidateBusinessError(pkgConstant.ErrAccountIneligibility, "ValidateAccounts") - opentelemetry.HandleSpanBusinessErrorEvent(spanValidateBalances, "validations.validate_balances_rules", err) + tracing.HandleSpanBusinessErrorEvent(spanValidateBalances, "validations.validate_balances_rules", err) return err } for _, balance := range balances { if err := validateFromBalances(balance, validate.From, validate.Asset, validate.Pending); err != nil { - opentelemetry.HandleSpanBusinessErrorEvent(spanValidateBalances, "Failed to validate source balance", err) + tracing.HandleSpanBusinessErrorEvent(spanValidateBalances, "Failed to validate source balance", err) logger.Log(ctx, libLog.LevelError, "Failed to validate source balance", libLog.Err(err)) return err } if err := validateToBalances(balance, validate.To, validate.Asset); err != nil { - opentelemetry.HandleSpanBusinessErrorEvent(spanValidateBalances, "Failed to validate destination balance", err) + tracing.HandleSpanBusinessErrorEvent(spanValidateBalances, "Failed to validate destination balance", err) logger.Log(ctx, libLog.LevelError, "Failed to validate destination balance", libLog.Err(err)) return err @@ -376,7 +377,7 @@ func DetermineOperation(isPending bool, isFrom bool, transactionType string) (st // Skipped for CREATED transactions because their balance operations (simple // DEBIT/CREDIT) do not branch on RouteValidationEnabled. func PropagateRouteValidation(ctx context.Context, validate *Responses, transactionStatus string) { - logger, tracer, _, _ := commons.NewTrackingFromContext(ctx) + logger, tracer, _, _ := libObservability.NewTrackingFromContext(ctx) _, span := tracer.Start(ctx, "transaction.propagate_route_validation") defer span.End() @@ -547,7 +548,7 @@ func ValidateSendSourceAndDistribute(ctx context.Context, transaction Transactio destinationsTotal decimal.Decimal ) - logger, tracer, _, _ := commons.NewTrackingFromContext(ctx) + logger, tracer, _, _ := libObservability.NewTrackingFromContext(ctx) _, span := tracer.Start(ctx, "transaction.validate_send_source_and_distribute") defer span.End() diff --git a/pkg/mtransaction/validations_test.go b/pkg/mtransaction/validations_test.go index 9a7a0e42d..4b9cb4d60 100644 --- a/pkg/mtransaction/validations_test.go +++ b/pkg/mtransaction/validations_test.go @@ -10,9 +10,9 @@ import ( "testing" "testing/quick" - "github.com/LerianStudio/lib-commons/v5/commons" + commons "github.com/LerianStudio/lib-observability" constant "github.com/LerianStudio/lib-commons/v5/commons/constants" - "github.com/LerianStudio/lib-commons/v5/commons/log" + "github.com/LerianStudio/lib-observability/log" "github.com/LerianStudio/midaz/v3/pkg" pkgConstant "github.com/LerianStudio/midaz/v3/pkg/constant" "github.com/shopspring/decimal" diff --git a/pkg/net/http/withBody.go b/pkg/net/http/withBody.go index 77c8250bb..a82162bfb 100644 --- a/pkg/net/http/withBody.go +++ b/pkg/net/http/withBody.go @@ -15,7 +15,7 @@ import ( "time" libCommons "github.com/LerianStudio/lib-commons/v5/commons" - libOpentelemetry "github.com/LerianStudio/lib-commons/v5/commons/opentelemetry" + libOpentelemetry "github.com/LerianStudio/lib-observability/tracing" "github.com/LerianStudio/midaz/v3/pkg" cn "github.com/LerianStudio/midaz/v3/pkg/constant" "github.com/LerianStudio/midaz/v3/pkg/mtransaction" diff --git a/pkg/net/http/withRecover.go b/pkg/net/http/withRecover.go index 8146800b1..594bc5653 100644 --- a/pkg/net/http/withRecover.go +++ b/pkg/net/http/withRecover.go @@ -8,8 +8,8 @@ import ( "fmt" "net/http" - libCommons "github.com/LerianStudio/lib-commons/v5/commons" - libLog "github.com/LerianStudio/lib-commons/v5/commons/log" + libCommons "github.com/LerianStudio/lib-observability" + libLog "github.com/LerianStudio/lib-observability/log" "github.com/gofiber/fiber/v2" "go.opentelemetry.io/otel/codes" "go.opentelemetry.io/otel/trace" diff --git a/pkg/streaming/emit.go b/pkg/streaming/emit.go index d185ba300..331efa067 100644 --- a/pkg/streaming/emit.go +++ b/pkg/streaming/emit.go @@ -10,8 +10,8 @@ import ( "strconv" "time" - libLog "github.com/LerianStudio/lib-commons/v5/commons/log" - libOpentelemetry "github.com/LerianStudio/lib-commons/v5/commons/opentelemetry" + libLog "github.com/LerianStudio/lib-observability/log" + libOpentelemetry "github.com/LerianStudio/lib-observability/tracing" libStreaming "github.com/LerianStudio/lib-streaming" "go.opentelemetry.io/otel/trace" ) diff --git a/pkg/streaming/emit_test.go b/pkg/streaming/emit_test.go index c271d9a8e..d16e7eb23 100644 --- a/pkg/streaming/emit_test.go +++ b/pkg/streaming/emit_test.go @@ -11,7 +11,7 @@ import ( "testing" "time" - libLog "github.com/LerianStudio/lib-commons/v5/commons/log" + libLog "github.com/LerianStudio/lib-observability/log" libStreaming "github.com/LerianStudio/lib-streaming" "github.com/stretchr/testify/assert" "github.com/stretchr/testify/require" diff --git a/pkg/streaming/events/operation_route_created.go b/pkg/streaming/events/operation_route_created.go index 42e45fe11..cd1cc6192 100644 --- a/pkg/streaming/events/operation_route_created.go +++ b/pkg/streaming/events/operation_route_created.go @@ -71,7 +71,7 @@ func NewOperationRouteCreated(o *mmodel.OperationRoute) OperationRouteCreatedPay LedgerID: o.LedgerID.String(), Title: o.Title, Description: o.Description, - Code: o.Code, + Code: o.Code, //nolint:staticcheck // legacy Code field emitted for backward compatibility OperationType: o.OperationType, Account: o.Account, AccountingEntries: o.AccountingEntries, diff --git a/pkg/streaming/events/operation_route_updated.go b/pkg/streaming/events/operation_route_updated.go index 42af27c68..b8b2ba7e9 100644 --- a/pkg/streaming/events/operation_route_updated.go +++ b/pkg/streaming/events/operation_route_updated.go @@ -63,7 +63,7 @@ func NewOperationRouteUpdated(o *mmodel.OperationRoute) OperationRouteUpdatedPay LedgerID: o.LedgerID.String(), Title: o.Title, Description: o.Description, - Code: o.Code, + Code: o.Code, //nolint:staticcheck // legacy Code field emitted for backward compatibility OperationType: o.OperationType, Account: o.Account, AccountingEntries: o.AccountingEntries, diff --git a/pkg/streaming/mock.go b/pkg/streaming/mock.go index 4c5cda186..b0997d3d3 100644 --- a/pkg/streaming/mock.go +++ b/pkg/streaming/mock.go @@ -108,8 +108,8 @@ func AssertEventEmitted(t *testing.T, m *MockEmitter, resourceType, eventType st // tests can substitute a stub for the no-match path without driving a // real subtest. Unexported on purpose — the public API takes *testing.T // for symmetry with the rest of midaz's test helpers. -func assertEventEmittedTB(t testing.TB, m *MockEmitter, resourceType, eventType string) { - t.Helper() +func assertEventEmittedTB(tb testing.TB, m *MockEmitter, resourceType, eventType string) { + tb.Helper() key := resourceType + "." + eventType @@ -119,6 +119,6 @@ func assertEventEmittedTB(t testing.TB, m *MockEmitter, resourceType, eventType } } - t.Fatalf("expected emitted event with definition key %q, got %d events: %v", + tb.Fatalf("expected emitted event with definition key %q, got %d events: %v", key, len(m.Events()), m.Events()) } diff --git a/pkg/utils/metrics.go b/pkg/utils/metrics.go index 06ee3e54c..a94a3e850 100644 --- a/pkg/utils/metrics.go +++ b/pkg/utils/metrics.go @@ -4,7 +4,7 @@ package utils -import "github.com/LerianStudio/lib-commons/v5/commons/opentelemetry/metrics" +import "github.com/LerianStudio/lib-observability/metrics" var ( BalanceSynced = metrics.Metric{ diff --git a/tests/utils/crypto.go b/tests/utils/crypto.go index 624d205ca..79f959fbd 100644 --- a/tests/utils/crypto.go +++ b/tests/utils/crypto.go @@ -8,7 +8,7 @@ import ( "testing" libCrypto "github.com/LerianStudio/lib-commons/v5/commons/crypto" - libLog "github.com/LerianStudio/lib-commons/v5/commons/log" + libLog "github.com/LerianStudio/lib-observability/log" "github.com/stretchr/testify/require" ) diff --git a/tests/utils/stubs/logger.go b/tests/utils/stubs/logger.go index 1083a9362..8cfe6d77a 100644 --- a/tests/utils/stubs/logger.go +++ b/tests/utils/stubs/logger.go @@ -13,7 +13,7 @@ import ( "fmt" "strings" - libLog "github.com/LerianStudio/lib-commons/v5/commons/log" + libLog "github.com/LerianStudio/lib-observability/log" ) // Compile-time check that LoggerStub implements libLog.Logger