Skip to content

Conversation

@langfuse-bot
Copy link
Collaborator

@langfuse-bot langfuse-bot commented Oct 17, 2025

Important

This pull request adds OpenTelemetry support to the API, introducing new models and clients for handling OpenTelemetry traces and updating existing clients to integrate this functionality.

  • OpenTelemetry Support:
    • Adds OtelAttribute, OtelAttributeValue, OtelResource, OtelResourceSpan, OtelScope, OtelScopeSpan, OtelSpan, OtelTraceResponse models in opentelemetry/types.
    • Introduces OpentelemetryClient and AsyncOpentelemetryClient in opentelemetry/client.py for trace ingestion.
    • Updates client.py to include OpentelemetryClient and AsyncOpentelemetryClient.
  • API Changes:
    • Adds export_traces() method to handle OpenTelemetry trace ingestion.
    • Updates reference.md to document new OpenTelemetry endpoint /api/public/otel/v1/traces.
  • Miscellaneous:
    • Updates observations/client.py to include a filter parameter in get_many() method.
    • Updates ingestion/client.py to deprecate batch ingestion in favor of OpenTelemetry.

This description was created by Ellipsis for b9107ab. 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:35:44 UTC

Summary

This PR updates the auto-generated API client code from the main Langfuse repository, introducing three main additions:

  • New OpenTelemetry Trace Export API: Adds a complete implementation of the OTLP/HTTP specification for trace ingestion (/api/public/otel/v1/traces endpoint) with support for both JSON and binary Protobuf formats, including all necessary types (OtelSpan, OtelResource, OtelScope, OtelAttribute, etc.)

  • Enhanced Observations Filtering: Adds an advanced filter parameter to the observations API that supports complex filter conditions with various operators and data types, providing more flexible querying capabilities

  • Prompt Type Classification: Adds a type field to PromptMeta to distinguish between chat and text prompts

All changes are auto-generated from the API specification and follow established patterns in the codebase. The OpenTelemetry integration aligns with the SDK's existing OTel-based architecture mentioned in CLAUDE.md.

Confidence Score: 5/5

  • Safe to merge - auto-generated API spec update with no breaking changes
  • All files are auto-generated from the API specification using Fern, following consistent patterns. The changes are purely additive (new endpoints, types, and optional parameters) with no modifications to existing APIs. The OpenTelemetry client follows the same error handling patterns as other API clients, and the new filter parameter is optional, maintaining backward compatibility.
  • No files require special attention

Important Files Changed

File Analysis

Filename Score Overview
langfuse/api/client.py 5/5 Adds OpenTelemetry client instances to sync and async clients - clean integration
langfuse/api/resources/opentelemetry/client.py 5/5 Implements OTLP trace export endpoint with proper error handling and documentation
langfuse/api/resources/observations/client.py 5/5 Adds advanced filter parameter to observations API with comprehensive documentation
langfuse/api/resources/prompts/types/prompt_meta.py 5/5 Adds type field to PromptMeta to distinguish between chat and text prompts

Sequence Diagram

sequenceDiagram
    participant Client as Langfuse Client
    participant API as FernLangfuse API
    participant OTel as OpenTelemetry Client
    participant Obs as Observations Client
    participant Prompts as Prompts Client
    
    Note over Client,Prompts: New OpenTelemetry Integration
    Client->>API: Initialize with credentials
    API->>OTel: Create opentelemetry client
    Client->>OTel: export_traces(resource_spans)
    OTel->>OTel: POST /api/public/otel/v1/traces
    OTel-->>Client: OtelTraceResponse
    
    Note over Client,Prompts: Enhanced Observations Filtering
    Client->>API: Initialize client
    API->>Obs: Create observations client
    Client->>Obs: get(filter=json_string)
    Obs->>Obs: Apply complex filter conditions
    Obs-->>Client: ObservationsViews
    
    Note over Client,Prompts: Prompt Type Classification
    Client->>API: Initialize client
    API->>Prompts: Create prompts client
    Client->>Prompts: get_prompts()
    Prompts-->>Client: PromptMeta (with type field)
Loading

@langfuse-bot langfuse-bot requested a review from sumerman October 17, 2025 14:32
</dl>
</details>

## Opentelemetry
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The section header uses "Opentelemetry" while the description below uses "OpenTelemetry". For consistency and clarity, please standardize the capitalization (preferably "OpenTelemetry").

Suggested change
## Opentelemetry
## OpenTelemetry

Copy link
Contributor

@greptile-apps greptile-apps bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

21 files reviewed, no comments

Edit Code Review Agent Settings | Greptile

@hassiebp hassiebp self-requested a review October 20, 2025 08:24
@hassiebp hassiebp merged commit 1319ddf into main Oct 20, 2025
11 checks passed
@hassiebp hassiebp deleted the api-spec-bot-f5e96a9 branch October 20, 2025 13:49
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants