Per-run token/cost accounting, audit log, and risk-level/human-in-the-loop compliance config declared in agent.yaml. Worth extracting given how expensive untracked multi-agent sessions have been.
// Source: https://github.com/mperkins0155/gitagent | License: MIT | Copyright 2025 GitAgent Contributors
// Provided via justclaw.it.com; keep this notice with the code.
// OpenTelemetry instrumentation for gitagent.
//
// Design:
// - All OTel packages are regular dependencies and always installed.
// - SDK packages are loaded via dynamic `import()` inside `initTelemetry()`
// so the module is side-effect-free until telemetry is explicitly enabled.
// - Every public function wraps its body in try/catch โ telemetry must never
// crash the agent.
// - Spans never carry prompt or completion content; only metadata.
import {
trace,
metrics,
context as otelContext,
SpanStatusCode,
SpanKind,
} from "@opentelemetry/api";
import type {
Span,
Tracer,
Meter,
Context,
Histogram,
... (truncated -- full source via MCP)
See the full source, get the GitHub permalink, and search 40K more like it.
Get a free API key