MCPcopy Index your code
hub / github.com/getsentry/XcodeBuildMCP / recordToolInvocationMetric

Function recordToolInvocationMetric

src/utils/sentry.ts:476–498  ·  view source on GitHub ↗
(metric: ToolInvocationMetric)

Source from the content-addressed store, hash-verified

474 return initialized && !isSentryDisabled() && !isTestEnv() && !isSentryCaptureSealed();
475}
476export function recordToolInvocationMetric(metric: ToolInvocationMetric): void {
477 if (!shouldEmitMetrics()) {
478 return;
479 }
480
481 const tags = {
482 tool_name: sanitizeTagValue(metric.toolName),
483 runtime: metric.runtime,
484 transport: metric.transport,
485 outcome: metric.outcome,
486 };
487
488 try {
489 Sentry.metrics.count('xcodebuildmcp.tool.invocation.count', 1, { attributes: tags });
490 Sentry.metrics.distribution(
491 'xcodebuildmcp.tool.invocation.duration_ms',
492 Math.max(0, metric.durationMs),
493 { attributes: tags },
494 );
495 } catch {
496 // Metrics are best effort and must never affect tool execution.
497 }
498}
499
500export function recordInternalErrorMetric(metric: InternalErrorMetric): void {
501 if (!shouldEmitMetrics()) {

Callers 2

recordMcpInvocationFunction · 0.90

Calls 2

shouldEmitMetricsFunction · 0.85
sanitizeTagValueFunction · 0.85

Tested by

no test coverage detected