Launch Week 02 wrapped — explore all five launches

Confident OpenTelemetry Skill

Teach your agent to export raw OpenTelemetry traces to Confident AI from any language without the confident-trace package.

Overview

The confident-otel Agent Skill teaches your coding agent how to export raw OpenTelemetry traces from an AI application to Confident AI without the confident-trace package. It works with any OpenTelemetry SDK in any language because the contract is the OTLP exporter endpoint plus the confident.* attributes on each span.

The skill points an OTLP/HTTP traces exporter at the correct Confident AI region, adds the x-confident-api-key header, preserves native OpenTelemetry trace context, and sets confident.span.* and confident.trace.* fields. Parentage, trace IDs, sampling, status, resources, links, and propagation remain native OpenTelemetry concerns.

RegionBase endpointDirect exporter endpoint
US/AUhttps://otel.confident-ai.comhttps://otel.confident-ai.com/v1/traces
EUhttps://eu.otel.confident-ai.comhttps://eu.otel.confident-ai.com/v1/traces

Only confident_eu_... API keys use the EU endpoint.

When It Triggers

The skill activates on prompts like:

Prompts that trigger the skill
Send our OpenTelemetry AI traces to Confident AI.
Wire our OTel Collector to export agent spans to Confident AI.
Set confident.span.type on the LLM spans in our TypeScript service.
Which direct OTLP endpoint should our EU deployment use?

Installation

Works with Cursor, Claude Code, Codex, Windsurf, OpenCode, and any other Skills-compatible assistant:

npx skills add confident-ai/confident-trace --skill "confident-otel"

Prerequisites

  • A project-scoped CONFIDENT_API_KEY
  • An OpenTelemetry SDK for the application's language
  • For Python, opentelemetry-sdk and opentelemetry-exporter-otlp-proto-http

What Changes in Your Codebase

  1. Inspect the existing OpenTelemetry setup

    The agent checks for a TracerProvider, span processors, exporters, Collector configuration, and APM instrumentation. It preserves the application's provider and prefers repointing an existing exporter over adding a duplicate pipeline.

    Prompt
    Send our OpenTelemetry AI traces to Confident AI.
  2. Configure direct OTLP export

    The agent selects the region endpoint and configures the x-confident-api-key header. Standard OpenTelemetry environment variables can configure the direct exporter without a package-specific SDK:

    export OTEL_EXPORTER_OTLP_ENDPOINT="https://otel.confident-ai.com"
    export OTEL_EXPORTER_OTLP_HEADERS="x-confident-api-key=<CONFIDENT_API_KEY>"
    Python example
    import os
    
    from opentelemetry import trace
    from opentelemetry.exporter.otlp.proto.http.trace_exporter import OTLPSpanExporter
    from opentelemetry.sdk.trace import TracerProvider
    from opentelemetry.sdk.trace.export import BatchSpanProcessor
    
    provider = TracerProvider()
    provider.add_span_processor(
        BatchSpanProcessor(
            OTLPSpanExporter(
                endpoint="https://otel.confident-ai.com/v1/traces",
                headers={"x-confident-api-key": os.environ["CONFIDENT_API_KEY"]},
            )
        )
    )
    trace.set_tracer_provider(provider)
  3. Set AI span and trace fields

    The agent sets confident.span.* fields on AI components and confident.trace.* fields for the whole trace. It JSON-encodes objects and metadata, uses native string arrays for lists, and preserves native OpenTelemetry parent-child context.

    Raw OpenTelemetry example
    tracer = trace.get_tracer(__name__)
    
    with tracer.start_as_current_span("support-agent") as root:
        root.set_attribute("confident.span.type", "agent")
        root.set_attribute("confident.trace.name", "support-chat")
    
        with tracer.start_as_current_span("chat-completion") as llm:
            llm.set_attribute("confident.span.type", "llm")
            llm.set_attribute("confident.llm.model", "gpt-4o")
  4. Keep non-AI spans out

    If the process also emits HTTP, database, cache, or infrastructure spans, the agent uses a dedicated AI provider or filters the Confident AI-bound processor or exporter. It preserves parentage when removing intermediate spans.

  5. Flush and verify

    The component that owns the provider owns shutdown. The agent finishes active work and streams, flushes or shuts down the provider, and verifies the AI trace hierarchy in Confident AI.

Attribute Rules

  • Raw span types are llm, tool, agent, retriever, and base.
  • Set confident.span.type explicitly when known.
  • Put trace-wide input, output, tags, metadata, environment, user ID, thread ID, turn ID, and metric collection on confident.trace.*.
  • Put component input, output, metadata, retrieval context, expected output, tools, and metric collection on confident.span.*.
  • Use native OpenTelemetry status and exception recording for errors.
  • Existing gen_ai.* attributes can provide fallbacks for model, token counts, tool name, and basic span-type inference.

FAQs

Do I need the confident-trace package installed?

No. confident-otel is the language-neutral path for raw OpenTelemetry export. Use confident-tracing when you want the Python or TypeScript SDK and its integrations.

Can I export directly over gRPC?

No. Confident AI's direct Cloud endpoint accepts OTLP/HTTP. Your application may send gRPC to its own Collector if that Collector exports to Confident AI over OTLP/HTTP.

I already run an APM agent; will every span be sent?

Not when the pipeline is configured correctly. The skill uses a dedicated provider or filters the Confident AI-bound processor or exporter so only AI spans are sent.

My app already emits gen_ai.* fields; do I need confident.* too?

Confident AI can fall back to standard gen_ai.* fields for model, token counts, tool name, and basic type inference. Explicit confident.* fields win when both are present.

Next Steps

Scaling beyond prototype?For teams evaluating Confident AI in productionTalk to us

Last updated on

Built byConfident AI