Overview
Weave supports ingestion of OpenTelemetry compatible trace data through a dedicated endpoint. This endpoint allows you to send OTLP (OpenTelemetry Protocol) formatted trace data directly to your Weave project.Endpoint details
Path:/otel/v1/traces
Method: POST
Content-Type: application/x-protobuf
Base URL: The base URL for the OTEL trace endpoint depends on your W&B deployment type:
-
Multi-tenant Cloud:
https://trace.wandb.ai/otel/v1/traces -
Dedicated Cloud and Self-Managed instances:
https://<your-subdomain>.wandb.io/traces/otel/v1/traces
<your-subdomain> with your organization’s unique W&B domain, e.g., acme.wandb.io.
Authentication
Standard W&B authentication is used. You must have write permissions to the project where you’re sending trace data.Required Headers
project_id: <your_entity>/<your_project_name>Authorization=Basic <Base64 Encoding of api:$WANDB_API_KEY>
Examples:
You must modify the following fields before you can run the code samples below:WANDB_API_KEY: You can get this from https://wandb.ai/authorize.- Entity: You can only log traces to the project under an entity that you have access to. You can find your entity name by visiting your W&N dashboard at [https://wandb.ai/home], and checking the Teams field in the left sidebar.
- Project Name: Choose a fun name!
OPENAI_API_KEY: You can obtain this from the OpenAI dashboard.
OpenInference Instrumentation:
This example shows how to use the OpenAI instrumentation. There are many more available which you can find in the official repository: https://github.com/Arize-ai/openinference First, install the required dependencies:openinference_example.py
OpenLLMetry Instrumentation:
The following example shows how to use the OpenAI instrumentation. Additional examples are available at https://github.com/traceloop/openllmetry/tree/main/packages. First install the required dependencies:openllmetry_example.py. Note that this is the same code as above, except the OpenAIInstrumentor is imported from opentelemetry.instrumentation.openai instead of openinference.instrumentation.openai
Without Instrumentation
If you would prefer to use OTEL directly instead of an instrumentation package, you may do so. Span attributes will be parsed according to the OpenTelemetry semantic conventions described at https://opentelemetry.io/docs/specs/semconv/gen-ai/gen-ai-spans/. First, install the required dependencies:opentelemetry_example.py
gen_ai and openinference are used to determine which convention to use, if any, when interpreting the trace. If neither key is detected, then all span attributes are visible in the trace view. The full span is available in the side panel when you select a trace.
Organize OTEL traces into threads
Add specific span attributes to organize your OpenTelemetry traces into Weave threads, then use Weave’s Thread UI to analyze related operations like multi-turn conversations or user sessions in Weave’s thread UI. Add the following attributes to your OTEL spans to enable thread grouping:wandb.thread_id: Groups spans into a specific threadwandb.is_turn: Marks a span as a conversation turn (appears as a row in the thread view)
wandb.thread_id to group related operations, and use wandb.is_turn to view high level operations as rows in the thread view. Each example performs the followingmark high-level operations that appear as rows in the thread view).
Initial set up
Initial set up
Use this configuration to run these examples:
Trace a basic single-turn thread
Trace a basic single-turn thread
Trace a multi-turn conversation sharing one thread ID
Trace a multi-turn conversation sharing one thread ID
Trace deeply nested operations and mark only the outermost span as a turn
Trace deeply nested operations and mark only the outermost span as a turn
Trace background operations that belong to a thread but aren't turns
Trace background operations that belong to a thread but aren't turns
thread_id and each turn will appear as a separate row.
Attribute Mappings
Weave automatically maps OpenTelemetry span attributes from various instrumentation frameworks to its internal data model. When multiple attribute names map to the same field, Weave applies them in priority order, allowing frameworks to coexist in the same traces.Supported Frameworks
Weave supports attribute conventions from the following observability frameworks and SDKs:- OpenTelemetry GenAI: Standard semantic conventions for generative AI (
gen_ai.*) - OpenInference: Arize AI’s instrumentation library (
input.value,output.value,llm.*,openinference.*) - Vercel AI SDK: Vercel’s AI SDK attributes (
ai.prompt,ai.response,ai.model.*,ai.usage.*) - MLflow: MLflow tracking attributes (
mlflow.spanInputs,mlflow.spanOutputs) - Traceloop: OpenLLMetry instrumentation (
traceloop.entity.*,traceloop.span.kind) - Google Vertex AI: Vertex AI agent attributes (
gcp.vertex.agent.*) - OpenLit: OpenLit observability attributes (
gen_ai.content.completion) - Langfuse: Langfuse tracing attributes (
langfuse.startTime,langfuse.endTime)
Attribute Reference
Limitations
- The Weave UI does not support rendering OTEL trace tool calls the Chat view. They appear as raw JSON, instead.