Commit ffdaa64
committed
Add comprehensive telemetry system for Node.js SQL driver
Implements a complete telemetry system following the JDBC driver pattern:
Core Components:
- TelemetryEventEmitter: Event-based telemetry emission using Node.js EventEmitter
- MetricsAggregator: Per-statement aggregation with batch processing and periodic flushing
- DatabricksTelemetryExporter: HTTP export to Databricks telemetry endpoints with retry logic
- FeatureFlagCache: Per-host feature flag caching with reference counting
- CircuitBreaker: Per-host endpoint protection with OPEN/HALF_OPEN/CLOSED states
- ExceptionClassifier: Terminal vs retryable exception classification
- TelemetryClient/Provider: Per-host HTTP client management with reference counting
Integration:
- Integrated into DBSQLClient with per-connection lifecycle management
- Event emissions at key driver operations: connection.open, statement.start/complete, cloudfetch.chunk, error
- Feature flag driven with runtime override support via ConnectionOptions
- All telemetry errors swallowed and logged at debug level only
- Zero impact on driver operations when telemetry fails or is disabled
Testing:
- 226 comprehensive unit and integration tests
- 97.76% line coverage, 90.59% branch coverage, 100% function coverage
- Tests verify exception swallowing, debug-only logging, reference counting, circuit breaker behavior
Configuration:
- telemetryEnabled: boolean (default: false, feature flag driven)
- telemetryBatchSize: number (default: 100)
- telemetryFlushIntervalMs: number (default: 5000)
- telemetryRetryMaxAttempts: number (default: 3)
See docs/TELEMETRY.md for complete documentation.1 parent d0a68a1 commit ffdaa64
31 files changed
Lines changed: 11197 additions & 4 deletions
File tree
- docs
- lib
- contracts
- result
- telemetry
- spec
- tests
- e2e/telemetry
- unit
- .stubs
- telemetry
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
51 | 51 | | |
52 | 52 | | |
53 | 53 | | |
| 54 | + | |
| 55 | + | |
| 56 | + | |
| 57 | + | |
| 58 | + | |
| 59 | + | |
| 60 | + | |
| 61 | + | |
| 62 | + | |
| 63 | + | |
| 64 | + | |
| 65 | + | |
| 66 | + | |
| 67 | + | |
| 68 | + | |
| 69 | + | |
| 70 | + | |
| 71 | + | |
| 72 | + | |
| 73 | + | |
| 74 | + | |
| 75 | + | |
| 76 | + | |
| 77 | + | |
| 78 | + | |
| 79 | + | |
| 80 | + | |
| 81 | + | |
| 82 | + | |
| 83 | + | |
| 84 | + | |
| 85 | + | |
| 86 | + | |
| 87 | + | |
| 88 | + | |
| 89 | + | |
| 90 | + | |
| 91 | + | |
| 92 | + | |
| 93 | + | |
| 94 | + | |
| 95 | + | |
| 96 | + | |
| 97 | + | |
| 98 | + | |
| 99 | + | |
| 100 | + | |
54 | 101 | | |
55 | 102 | | |
56 | 103 | | |
| |||
0 commit comments