FabricFabricHarness
EcosystemTooling

OpenTelemetry

Export Fabric agent, model, tool, task, and shell activity as spans.

Fabric provides flat event exporters and a hierarchical observer. Your application owns the OpenTelemetry SDK, exporter, sampling, credentials, and shutdown lifecycle.

fh add opentelemetry

The managed recipe installs the OpenTelemetry API and creates a hierarchical observer configured with content redaction and Foundry-compatible semantic conventions.

import { trace } from '@opentelemetry/api';
import { init } from '@fabric-harness/sdk';
import { createOpenTelemetryObserver } from '@fabric-harness/sdk/otel-observer';

const observe = createOpenTelemetryObserver({
  tracer: trace.getTracer('support-agent'),
  conventions: 'foundry',
  correlation: { agentId: 'support', jobId: runId, submissionId, tenantId },
});

const fabric = await init({ onEvent: observe });

The observer creates nested turn, tool, shell, and task spans. conventions: 'foundry' emits gen_ai.* names and attributes compatible with Azure AI Foundry and OpenTelemetry GenAI consumers. Stable job, agent, session, submission, and tenant IDs are span attributes. Use openTelemetryExporter() when one flat span per duration-bearing Fabric event is preferable.

Do not export prompts, tool arguments, or results without a deliberate redaction and retention policy. See Telemetry for exporters, attributes, and event coverage.