fix(observabillity): propagate ctx to every log call and add resource to logging
All checks were successful
Build Docker Image / Build-Docker-Image (push) Successful in 5m5s
Build and Push Docker Image / Build-And-Push-Docker-Image (push) Successful in 5m36s

This commit was merged in pull request #187.
This commit is contained in:
2025-06-17 09:42:19 +02:00
parent ff3c7bdf52
commit 6c92206b3c
27 changed files with 288 additions and 266 deletions

View File

@@ -24,7 +24,7 @@ func (l migrationLogger) Verbose() bool {
func RunMigrations(ctx context.Context, db *sqlx.DB, pathPrefix string) error {
driver, err := sqlite3.WithInstance(db.DB, &sqlite3.Config{})
if err != nil {
slog.Error("Could not create Migration instance", "err", err)
slog.ErrorContext(ctx, "Could not create Migration instance", "err", err)
return types.ErrInternal
}
@@ -33,14 +33,14 @@ func RunMigrations(ctx context.Context, db *sqlx.DB, pathPrefix string) error {
"",
driver)
if err != nil {
slog.Error("Could not create migrations instance", "err", err)
slog.ErrorContext(ctx, "Could not create migrations instance", "err", err)
return types.ErrInternal
}
m.Log = migrationLogger{}
if err = m.Up(); err != nil && !errors.Is(err, migrate.ErrNoChange) {
slog.Error("Could not run migrations", "err", err)
slog.ErrorContext(ctx, "Could not run migrations", "err", err)
return types.ErrInternal
}