()
| 67 | } |
| 68 | |
| 69 | function ensureBackground(): void { |
| 70 | if (timer) return |
| 71 | timer = setInterval(() => { |
| 72 | void flushHostedKeyMetrics() |
| 73 | }, FLUSH_INTERVAL_MS) |
| 74 | timer.unref?.() |
| 75 | if (!handlersRegistered) { |
| 76 | handlersRegistered = true |
| 77 | const onExit = async () => { |
| 78 | await flushHostedKeyMetrics() |
| 79 | } |
| 80 | process.once('SIGTERM', onExit) |
| 81 | process.once('SIGINT', onExit) |
| 82 | process.once('beforeExit', onExit) |
| 83 | } |
| 84 | } |
| 85 | |
| 86 | function buildDimensions(labels: Record<string, string | undefined>) { |
| 87 | const dimensions = [{ Name: 'Environment', Value: ENVIRONMENT }] |
no test coverage detected