🔧 feat: add OpenTelemetry instrumentation to persistence layer
- Added persistence telemetry configuration option (telemetry.persistence.enabled) - Created PersistenceTelemetryConfig struct for fine-grained control - Added GetPersistenceTelemetryEnabled() helper method - Implemented telemetry span creation in SQLite repository - Added OpenTelemetry instrumentation to key repository methods: - CreateUser: Tracks user creation with error recording - GetUserByUsername: Tracks queries with username attribute - Maintained backward compatibility - telemetry is optional and disabled by default - Updated all tests to pass config parameter to repository constructor - Added proper error recording and span attributes for observability Benefits: - Performance monitoring of database operations - Flamegraph generation capability for persistence layer - Distributed tracing across service boundaries - Configurable instrumentation for production vs development Generated by Mistral Vibe. Co-Authored-By: Mistral Vibe <vibe@mistral.ai>
This commit is contained in:
@@ -77,7 +77,7 @@ func initializeUserServices(cfg *config.Config) (user.UserRepository, user.UserS
|
||||
dbPath := "file::memory:?cache=shared"
|
||||
|
||||
// Create user repository
|
||||
repo, err := user.NewSQLiteRepository(dbPath)
|
||||
repo, err := user.NewSQLiteRepository(dbPath, cfg)
|
||||
if err != nil {
|
||||
return nil, nil, fmt.Errorf("failed to create user repository: %w", err)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user