Skip to main content
Galileo’s OTLP provider conforms to OpenTelemetry and OpenInference semantic conventions. To ensure your spans are valid and properly processed, follow these guidelines.

Semantic Conventions

Galileo supports two complementary semantic convention standards:
  1. OpenTelemetry GenAI Semantic ConventionsSemantic Conventions for GenAI agent and framework spans
  2. OpenInferenceOpenInference Semantic Conventions
When using automatic instrumentation libraries (like Traceloop/OpenLLMetry), these requirements are typically handled automatically. When creating custom spans, ensure you follow both the OpenTelemetry GenAI conventions and any framework-specific guidelines.

Minimum Requirements for Valid Spans

For a span to be considered valid, it must include certain required attributes depending on the span type.

Agent Spans

AttributeRequirement LevelDescriptionExample
gen_ai.operation.nameRequiredThe name of the operation being performedinvoke_agent, create_agent
gen_ai.provider.nameRequiredThe Generative AI provideropenai, anthropic, gcp.vertex_ai
Span nameRequiredShould follow format: invoke_agent {gen_ai.agent.name} or invoke_agentinvoke_agent Math Tutor
Span kindRequiredShould be CLIENT for remote agents or INTERNAL for in-process agentsCLIENT, INTERNAL
InputRequiredInput messages or data. Use gen_ai.input.messages (OpenTelemetry) or input.value (OpenInference)[{"role": "user", "content": "..."}]
OutputRequiredOutput messages or data. Use gen_ai.output.messages (OpenTelemetry) or output.value (OpenInference)[{"role": "assistant", "content": "..."}]

LLM Spans

AttributeRequirement LevelDescriptionExample
gen_ai.operation.nameRequiredThe name of the operationchat, text_completion, embeddings
gen_ai.provider.nameRequiredThe Generative AI provideropenai, anthropic
gen_ai.request.modelConditionally RequiredThe name of the GenAI modelgpt-4, claude-3-opus
InputRequiredInput messages or prompts. Use gen_ai.input.messages (OpenTelemetry) or llm.input_messages (OpenInference)[{"role": "user", "content": "..."}]
OutputRequiredOutput messages or completions. Use gen_ai.output.messages (OpenTelemetry) or llm.output_messages (OpenInference)[{"role": "assistant", "content": "..."}]

Tool Execution Spans

AttributeRequirement LevelDescriptionExample
gen_ai.operation.nameRequiredShould be execute_toolexecute_tool
tool.name (OpenInference)RequiredName of the tool being usedget_weather, calculate
InputRequiredTool call arguments. Use gen_ai.tool.call.arguments (OpenTelemetry) or input.value (OpenInference){"location": "NYC", "unit": "fahrenheit"}
OutputRequiredTool call result. Use gen_ai.tool.call.result (OpenTelemetry) or output.value (OpenInference){"temperature": 72, "condition": "sunny"}

Retriever Spans

AttributeRequirement LevelDescriptionExample
db.operationRequiredDatabase operation type. Should be query or searchquery, search
openinference.span.kind (OpenInference)Conditionally RequiredShould be retriever when using OpenInferenceretriever
InputRequiredQuery string or search input. Use gen_ai.input.messages (OpenTelemetry) or input.value (OpenInference)"What is machine learning?"
OutputRequiredRetrieved documents. Use gen_ai.output.messages with document list (OpenTelemetry) or retrieval.documents (OpenInference)[{"id": "doc1", "content": "..."}, {"id": "doc2", "content": "..."}]
Retriever spans are typically detected automatically when db.operation is set to query or search. The output should be a list of documents, which will be formatted appropriately by Galileo’s OTLP provider.

Error Handling

For spans that end in an error, you must include:
  • error.type — Describes the class of error (e.g., timeout, 500, exception name)
  • Span status — Should be set to ERROR with an appropriate error description
Python
from opentelemetry.trace import StatusCode

span.set_status(StatusCode.ERROR, "Connection timed out")
span.set_attribute("error.type", "timeout")

Direct POST Calls to the OTLP Endpoint

You can make direct POST calls to the Galileo OTLP endpoint to send OTLP packets. This is useful for custom integrations or when you need to send pre-generated OTLP data.

Endpoint

POST https://api.galileo.ai/otel/v1/traces

Headers

The following headers are required:
HeaderDescription
Galileo-API-KeyYour Galileo API key
project or projectidProject name or project ID (at least one required)
logstream or logstreamidLog stream name or Log stream ID (at least one required)
Content-TypeMust be application/x-protobuf

Request Body

The request body should contain OTLP packets in protobuf format (binary). The payload should be an ExportTraceServiceRequest message as defined in the OpenTelemetry Protocol specification.

Response Codes

The request was successfully processed. The response body contains an ExportTraceServiceResponse in JSON format.If some spans were rejected, the response includes partial success information:
{
  "partialSuccess": {
    "rejectedSpans": 5,
    "errorMessage": "Group 0: Run not found for logstream ..."
  }
}
Even when the HTTP status is 200, check for partialSuccess in the response to determine if all spans were successfully processed.
The API key is missing or invalid.
{
  "detail": "API Key is missing"
}
The specified project was not found and could not be created.
{
  "detail": "Project not found."
}
The Content-Type header is not application/x-protobuf.
{
  "detail": "<content-type> is not supported, content_type needs to be: 'application/x-protobuf'"
}
The request could not be processed. Common reasons include no spans found, trace processing failure, or missing Log stream ID.
{
  "detail": "No spans found in request."
}

Additional Resources