MCPcopy
hub / github.com/simstudioai/sim / instruments

Function instruments

apps/sim/lib/copilot/request/metrics.ts:39–62  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

37// installs the real MeterProvider, so resolve instruments on first use (a
38// no-op meter before then simply drops records — same pattern as getCopilotTracer).
39function instruments(): CopilotMeterInstruments {
40 if (cached) return cached
41 const meter = metrics.getMeter('sim-copilot')
42 cached = {
43 toolDuration: meter.createHistogram(Metric.CopilotToolDuration, {
44 unit: 'ms',
45 advice: { explicitBucketBoundaries: LATENCY_BUCKETS_MS },
46 }),
47 toolCalls: meter.createCounter(Metric.CopilotToolCalls),
48 vfsMaterializeDuration: meter.createHistogram(Metric.CopilotVfsMaterializeDuration, {
49 unit: 'ms',
50 advice: { explicitBucketBoundaries: LATENCY_BUCKETS_MS },
51 }),
52 fileReadDuration: meter.createHistogram(Metric.CopilotFileReadDuration, {
53 unit: 'ms',
54 advice: { explicitBucketBoundaries: LATENCY_BUCKETS_MS },
55 }),
56 fileReadBytes: meter.createHistogram(Metric.CopilotFileReadSize, {
57 unit: 'By',
58 advice: { explicitBucketBoundaries: BYTE_BUCKETS },
59 }),
60 }
61 return cached
62}
63
64// Caps tool.name to the shared catalog (matches Go's cappedToolName): a
65// catalog tool keeps its name, everything else (user MCP/custom/unknown)

Callers 3

recordSimToolMetricFunction · 0.85
recordVfsMaterializeFunction · 0.85
recordFileReadFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected