Skip to content

Conversation

@cofin
Copy link
Member

@cofin cofin commented Nov 6, 2025

Introduce runtime helpers for lifecycle and span orchestration, improve storage telemetry diagnostics, and add comprehensive unit and integration tests. Implement redaction for SQL statements and parameters, and provide telemetry snapshot functions for monitoring recent storage events.

cofin added 6 commits November 6, 2025 17:25
… orchestration

- Added ObservabilityRuntime class to manage lifecycle events and statement observers.
- Implemented methods for emitting lifecycle events such as pool and connection creation/destruction.
- Introduced span management with SpanManager for OpenTelemetry integration.
- Added redaction capabilities for SQL statements and parameters.
- Created telemetry snapshot functions to capture recent storage events and metrics.

feat(storage): Enhance storage telemetry and diagnostics

- Added functions to record and retrieve recent storage telemetry events.
- Updated StorageTelemetry structure to include correlation and configuration metadata.
- Enhanced create_storage_bridge_job to record telemetry events upon job creation.

test(observability): Add unit tests for observability features

- Implemented tests for lifecycle hooks and statement observers in ObservabilityRuntime.
- Verified that lifecycle counters increment correctly when hooks are registered.
- Ensured that SQL statements and parameters are redacted before being observed.

test(storage): Add tests for storage telemetry and diagnostics

- Created tests to validate recent storage job telemetry in diagnostics snapshots.
- Verified that telemetry attributes are captured correctly during storage operations.

test(integration): Add integration tests for observability in SQLite and DuckDB

- Implemented tests to ensure observability hooks track query counts in async drivers.
- Verified that lifecycle counters remain zero when observability is disabled.
- Introduced `sqlspec.extensions.otel.enable_tracing()` for OpenTelemetry integration, allowing conditional tracing setup.
- Added `sqlspec.extensions.prometheus.enable_metrics()` to register Prometheus metrics observers.
- Updated `ObservabilityConfig` to support new telemetry configurations.
- Enhanced `DatabaseConfigProtocol` to configure observability extensions based on `extension_config`.
- Created unit tests for observability extensions to ensure proper functionality.
- Updated documentation to reflect new observability features and usage examples.
…etry and Prometheus support across database configurations
- Introduced ObservabilityRuntime to track migration metrics in BaseMigrationRunner.
- Added methods to start and end migration spans, capturing duration and errors.
- Updated SyncMigrationRunner and AsyncMigrationRunner to utilize the new observability features.
- Enhanced diagnostics aggregation in TelemetryDiagnostics to support new metrics.
- Refactored extension configuration handling across various adapters to ensure type safety.
- Added tests to verify observability metrics and loader behavior.
@cofin cofin changed the title feat(observability): Introduce runtime helpers for lifecycle and span orchestration feat(observability): enable telemetry integrations Nov 8, 2025
@cofin cofin merged commit 9521c6d into main Nov 8, 2025
16 checks passed
@cofin cofin deleted the feat/observe branch November 8, 2025 22:54
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants