feat(api): update API spec from langfuse/langfuse c3d6c8b #1407
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Important
This pull request adds OpenTelemetry support to the Langfuse API, including new clients and data models for trace ingestion, and introduces a
PromptTypefor distinguishing prompt types.OpentelemetryClientandAsyncOpentelemetryClientinopentelemetry/client.pyfor handling OpenTelemetry trace ingestion.OtelAttribute,OtelAttributeValue,OtelResource,OtelResourceSpan,OtelScope,OtelScopeSpan,OtelSpan,OtelTraceResponseinopentelemetry/types.client.pyto includeOpentelemetryClientandAsyncOpentelemetryClient.PromptTypeinprompts/types/prompt_type.pyto distinguish between text and chat prompts.PromptMetainprompts/types/prompt_meta.pyto includePromptTypefield.This description was created by
for 6698b96. You can customize this summary. It will automatically update as commits are pushed.
Disclaimer: Experimental PR review
Greptile Overview
Updated On: 2025-10-17 14:09:34 UTC
Summary
This PR updates the auto-generated API client to add native OpenTelemetry (OTLP/HTTP) trace ingestion support and enhance prompt type handling.
Key Changes
/api/public/otel/v1/traceswith 8 new type definitions (OtelSpan,OtelAttribute,OtelResourceSpan, etc.)PromptTypeenum (chat/text) with visitor pattern support for better type discrimination in prompt metadataopentelemetryclient property added to both sync and async API clientsIntegration Points
The new OTel types integrate with the existing SDK's OpenTelemetry implementation in
langfuse/_client/which already uses OTel spans internally. This API update provides the HTTP endpoint for external OTel-compliant telemetry systems to send traces directly to Langfuse.Code Quality
All files are auto-generated by Fern from the OpenAPI specification, following consistent patterns with proper Pydantic models, error handling, and both sync/async support.
Confidence Score: 5/5
Important Files Changed
File Analysis
opentelemetryclient property to sync and async clients for OTel trace ingestion/api/public/otel/v1/tracesSequence Diagram
sequenceDiagram participant Client as SDK Client participant OTelClient as OpentelemetryClient participant API as Langfuse API participant Backend as Langfuse Backend Note over Client,Backend: New OpenTelemetry Trace Ingestion Flow Client->>OTelClient: export_traces(resource_spans) Note over Client,OTelClient: resource_spans contain:<br/>- OtelResourceSpan<br/>- OtelResource (attributes)<br/>- OtelScopeSpan<br/>- OtelSpan (trace data) OTelClient->>API: POST /api/public/otel/v1/traces Note over OTelClient,API: JSON: {"resourceSpans": [...]} API->>Backend: Process OTLP trace data Note over API,Backend: Maps OTel spans to<br/>Langfuse observations Backend-->>API: Processing complete API-->>OTelClient: 200 OK Note over API,OTelClient: Returns OtelTraceResponse<br/>(empty object on success) OTelClient-->>Client: OtelTraceResponse Note over Client,Backend: Legacy Ingestion (Deprecated) Client->>API: POST /api/public/ingestion Note over Client,API: Old endpoint still supported<br/>but deprecated