|
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. |
| 1 | +// GENERATED — do not edit. Source of truth: mothership worker packages/contracts/src/metrics-v1.ts |
| 2 | +// Regenerate with `bun run contracts:sync` in the worker. |
| 3 | + |
| 4 | +// Canonical mothership OTel metric names Sim emits. Names only: label keys and histogram |
| 5 | +// buckets are the emitter's. |
15 | 6 |
|
16 | 7 | export const Metric = { |
17 | | - CopilotBillingLongContextCount: 'copilot.billing.long_context.count', |
18 | | - CopilotCacheAttempted: 'copilot.cache.attempted', |
19 | | - CopilotCacheHit: 'copilot.cache.hit', |
20 | | - CopilotCacheWrite: 'copilot.cache.write', |
21 | | - CopilotChatBlobBytes: 'copilot.chat.blob.bytes', |
22 | | - CopilotChatBlobCount: 'copilot.chat.blob.count', |
23 | | - CopilotDegradedCount: 'copilot.degraded.count', |
24 | | - CopilotFileReadDuration: 'copilot.file.read.duration', |
25 | | - CopilotFileReadSize: 'copilot.file.read.size', |
26 | | - CopilotMessagesSerializeDuration: 'copilot.messages.serialize.duration', |
27 | | - CopilotOptionsEmittedCount: 'copilot.options.emitted.count', |
28 | | - CopilotPromptComponentChars: 'copilot.prompt.component.chars', |
29 | | - CopilotRequestCount: 'copilot.request.count', |
30 | | - CopilotRequestDuration: 'copilot.request.duration', |
31 | | - CopilotToolCalls: 'copilot.tool.calls', |
32 | | - CopilotToolDuration: 'copilot.tool.duration', |
33 | | - CopilotVfsDelta: 'copilot.vfs.delta', |
34 | | - CopilotVfsMaterializeDuration: 'copilot.vfs.materialize.duration', |
35 | | - GenAiClientCacheTokenUsage: 'gen_ai.client.cache.token.usage', |
36 | | - GenAiClientTokenUsage: 'gen_ai.client.token.usage', |
37 | | - LlmClientCompactions: 'llm.client.compactions', |
38 | | - LlmClientContextTokens: 'llm.client.context_tokens', |
39 | | - LlmClientErrors: 'llm.client.errors', |
40 | | - LlmClientOutputCutoff: 'llm.client.output_cutoff', |
41 | | - LlmClientStreamDuration: 'llm.client.stream.duration', |
42 | | - LlmClientTimeToFirstToken: 'llm.client.time_to_first_token', |
43 | | -} as const |
| 8 | + CopilotBillingLongContextCount: "copilot.billing.long_context.count", |
| 9 | + CopilotCacheAttempted: "copilot.cache.attempted", |
| 10 | + CopilotCacheHit: "copilot.cache.hit", |
| 11 | + CopilotCacheWrite: "copilot.cache.write", |
| 12 | + CopilotChatBlobBytes: "copilot.chat.blob.bytes", |
| 13 | + CopilotChatBlobCount: "copilot.chat.blob.count", |
| 14 | + CopilotDegradedCount: "copilot.degraded.count", |
| 15 | + CopilotFileReadDuration: "copilot.file.read.duration", |
| 16 | + CopilotFileReadSize: "copilot.file.read.size", |
| 17 | + CopilotMessagesSerializeDuration: "copilot.messages.serialize.duration", |
| 18 | + CopilotOptionsEmittedCount: "copilot.options.emitted.count", |
| 19 | + CopilotPromptComponentChars: "copilot.prompt.component.chars", |
| 20 | + CopilotRequestCount: "copilot.request.count", |
| 21 | + CopilotRequestDuration: "copilot.request.duration", |
| 22 | + CopilotToolCalls: "copilot.tool.calls", |
| 23 | + CopilotToolDuration: "copilot.tool.duration", |
| 24 | + CopilotVfsDelta: "copilot.vfs.delta", |
| 25 | + CopilotVfsMaterializeDuration: "copilot.vfs.materialize.duration", |
| 26 | + GenAiClientCacheTokenUsage: "gen_ai.client.cache.token.usage", |
| 27 | + GenAiClientTokenUsage: "gen_ai.client.token.usage", |
| 28 | + LlmClientCompactions: "llm.client.compactions", |
| 29 | + LlmClientContextTokens: "llm.client.context_tokens", |
| 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; |
44 | 35 |
|
45 | | -export type MetricKey = keyof typeof Metric |
46 | | -export type MetricValue = (typeof Metric)[MetricKey] |
| 36 | +export type MetricKey = keyof typeof Metric; |
| 37 | +export type MetricValue = (typeof Metric)[MetricKey]; |
47 | 38 |
|
48 | 39 | /** Readonly sorted list of every canonical mothership metric name. */ |
49 | 40 | export const MetricValues: readonly MetricValue[] = [ |
50 | | - 'copilot.billing.long_context.count', |
51 | | - 'copilot.cache.attempted', |
52 | | - 'copilot.cache.hit', |
53 | | - 'copilot.cache.write', |
54 | | - 'copilot.chat.blob.bytes', |
55 | | - 'copilot.chat.blob.count', |
56 | | - 'copilot.degraded.count', |
57 | | - 'copilot.file.read.duration', |
58 | | - 'copilot.file.read.size', |
59 | | - 'copilot.messages.serialize.duration', |
60 | | - 'copilot.options.emitted.count', |
61 | | - 'copilot.prompt.component.chars', |
62 | | - 'copilot.request.count', |
63 | | - 'copilot.request.duration', |
64 | | - 'copilot.tool.calls', |
65 | | - 'copilot.tool.duration', |
66 | | - 'copilot.vfs.delta', |
67 | | - 'copilot.vfs.materialize.duration', |
68 | | - 'gen_ai.client.cache.token.usage', |
69 | | - 'gen_ai.client.token.usage', |
70 | | - 'llm.client.compactions', |
71 | | - 'llm.client.context_tokens', |
72 | | - 'llm.client.errors', |
73 | | - 'llm.client.output_cutoff', |
74 | | - 'llm.client.stream.duration', |
75 | | - 'llm.client.time_to_first_token', |
76 | | -] as const |
| 41 | + "copilot.billing.long_context.count", |
| 42 | + "copilot.cache.attempted", |
| 43 | + "copilot.cache.hit", |
| 44 | + "copilot.cache.write", |
| 45 | + "copilot.chat.blob.bytes", |
| 46 | + "copilot.chat.blob.count", |
| 47 | + "copilot.degraded.count", |
| 48 | + "copilot.file.read.duration", |
| 49 | + "copilot.file.read.size", |
| 50 | + "copilot.messages.serialize.duration", |
| 51 | + "copilot.options.emitted.count", |
| 52 | + "copilot.prompt.component.chars", |
| 53 | + "copilot.request.count", |
| 54 | + "copilot.request.duration", |
| 55 | + "copilot.tool.calls", |
| 56 | + "copilot.tool.duration", |
| 57 | + "copilot.vfs.delta", |
| 58 | + "copilot.vfs.materialize.duration", |
| 59 | + "gen_ai.client.cache.token.usage", |
| 60 | + "gen_ai.client.token.usage", |
| 61 | + "llm.client.compactions", |
| 62 | + "llm.client.context_tokens", |
| 63 | + "llm.client.errors", |
| 64 | + "llm.client.output_cutoff", |
| 65 | + "llm.client.stream.duration", |
| 66 | + "llm.client.time_to_first_token", |
| 67 | +] as const; |
0 commit comments