| 58 | } |
| 59 | |
| 60 | function usage() { |
| 61 | return [ |
| 62 | 'Usage: node scripts/telemetry-otlp-export.js [--endpoint url] [--dry-run] [--reset] [--project-root path]', |
| 63 | '', |
| 64 | 'Exports new Citadel telemetry JSONL records as OTLP/HTTP JSON metrics.', |
| 65 | '', |
| 66 | ' --endpoint url OTLP collector base url. Defaults to OTEL_EXPORTER_OTLP_ENDPOINT.', |
| 67 | ` When the url has no path, ${DEFAULT_OTLP_METRICS_PATH} is appended.`, |
| 68 | ' --dry-run Print the OTLP JSON payload to stdout. No POST, state not advanced.', |
| 69 | ' --reset Clear stored byte offsets so the next export starts from the beginning.', |
| 70 | ' --project-root path Project root containing .planning/telemetry (default: cwd).', |
| 71 | '', |
| 72 | 'The JSONL files stay canonical; this exporter never modifies them.', |
| 73 | ].join('\n'); |
| 74 | } |
| 75 | |
| 76 | function toUnixNano(timestamp) { |
| 77 | if (typeof timestamp !== 'string' || !timestamp) return null; |