|
| 1 | +// AUTO-GENERATED FILE. DO NOT EDIT. |
| 2 | +// |
| 3 | +// Source: copilot/copilot/contracts/metrics-v1.schema.json |
| 4 | +// Regenerate with: bun run metrics-contract:generate |
| 5 | +// |
| 6 | +// Canonical mothership OTel metric names. Call sites should reference |
| 7 | +// `Metric.<Identifier>` (e.g. `Metric.CopilotToolDuration`) rather than raw |
| 8 | +// string literals, so the Go-side contract is the single source of truth and |
| 9 | +// typos become compile errors. |
| 10 | +// |
| 11 | +// NAMES ONLY. Label keys and histogram bucket boundaries are NOT in this |
| 12 | +// contract — Go owns the label-cardinality allowlist and the shared bucket |
| 13 | +// constant, and the Sim emitter MUST mirror those by hand so the Go∪Sim metric |
| 14 | +// union is queryable as one series set. |
| 15 | + |
| 16 | +export const Metric = { |
| 17 | + CopilotCacheAttempted: 'copilot.cache.attempted', |
| 18 | + CopilotCacheHit: 'copilot.cache.hit', |
| 19 | + CopilotCacheWrite: 'copilot.cache.write', |
| 20 | + CopilotFileReadDuration: 'copilot.file.read.duration', |
| 21 | + CopilotFileReadSize: 'copilot.file.read.size', |
| 22 | + CopilotMessagesSerializeDuration: 'copilot.messages.serialize.duration', |
| 23 | + CopilotRequestCount: 'copilot.request.count', |
| 24 | + CopilotRequestDuration: 'copilot.request.duration', |
| 25 | + CopilotToolCalls: 'copilot.tool.calls', |
| 26 | + CopilotToolDuration: 'copilot.tool.duration', |
| 27 | + CopilotVfsMaterializeDuration: 'copilot.vfs.materialize.duration', |
| 28 | + GenAiClientCacheTokenUsage: 'gen_ai.client.cache.token.usage', |
| 29 | + GenAiClientTokenUsage: 'gen_ai.client.token.usage', |
| 30 | + LlmClientErrors: 'llm.client.errors', |
| 31 | + LlmClientOutputCutoff: 'llm.client.output_cutoff', |
| 32 | + LlmClientStreamDuration: 'llm.client.stream.duration', |
| 33 | + LlmClientTimeToFirstToken: 'llm.client.time_to_first_token', |
| 34 | +} as const |
| 35 | + |
| 36 | +export type MetricKey = keyof typeof Metric |
| 37 | +export type MetricValue = (typeof Metric)[MetricKey] |
| 38 | + |
| 39 | +/** Readonly sorted list of every canonical mothership metric name. */ |
| 40 | +export const MetricValues: readonly MetricValue[] = [ |
| 41 | + 'copilot.cache.attempted', |
| 42 | + 'copilot.cache.hit', |
| 43 | + 'copilot.cache.write', |
| 44 | + 'copilot.file.read.duration', |
| 45 | + 'copilot.file.read.size', |
| 46 | + 'copilot.messages.serialize.duration', |
| 47 | + 'copilot.request.count', |
| 48 | + 'copilot.request.duration', |
| 49 | + 'copilot.tool.calls', |
| 50 | + 'copilot.tool.duration', |
| 51 | + 'copilot.vfs.materialize.duration', |
| 52 | + 'gen_ai.client.cache.token.usage', |
| 53 | + 'gen_ai.client.token.usage', |
| 54 | + 'llm.client.errors', |
| 55 | + 'llm.client.output_cutoff', |
| 56 | + 'llm.client.stream.duration', |
| 57 | + 'llm.client.time_to_first_token', |
| 58 | +] as const |
0 commit comments