()
| 286 | } |
| 287 | |
| 288 | async function doInitializeTelemetry(): Promise<void> { |
| 289 | if (telemetryInitialized) { |
| 290 | // Already initialized, nothing to do |
| 291 | return |
| 292 | } |
| 293 | |
| 294 | // Set flag before init to prevent double initialization |
| 295 | telemetryInitialized = true |
| 296 | try { |
| 297 | await setMeterState() |
| 298 | } catch (error) { |
| 299 | // Reset flag on failure so subsequent calls can retry |
| 300 | telemetryInitialized = false |
| 301 | throw error |
| 302 | } |
| 303 | } |
| 304 | |
| 305 | async function setMeterState(): Promise<void> { |
| 306 | // Lazy-load instrumentation to defer ~400KB of OpenTelemetry + protobuf |
no test coverage detected