@@ -2442,7 +2442,7 @@ client.health.health()
24422442
24432443** Legacy endpoint for batch ingestion for Langfuse Observability.**
24442444
2445- -> Please use the OpenTelemetry endpoint (` /api/public/otel ` ). Learn more: https://langfuse.com/integrations/native/opentelemetry
2445+ -> Please use the OpenTelemetry endpoint (` /api/public/otel/v1/traces ` ). Learn more: https://langfuse.com/integrations/native/opentelemetry
24462446
24472447Within each batch, there can be multiple events.
24482448Each event has a type, an id, a timestamp, metadata and a body.
@@ -3604,6 +3604,184 @@ client.observations.get_many()
36043604<dl >
36053605<dd >
36063606
3607+ ** filter:** ` typing.Optional[str] `
3608+
3609+ JSON string containing an array of filter conditions. When provided, this takes precedence over legacy filter parameters (userId, name, sessionId, tags, version, release, environment, fromTimestamp, toTimestamp).
3610+ Each filter condition has the following structure:
3611+ ``` json
3612+ [
3613+ {
3614+ "type" : string, // Required. One of: "datetime", "string", "number", "stringOptions", "categoryOptions", "arrayOptions", "stringObject", "numberObject", "boolean", "null"
3615+ "column" : string, // Required. Column to filter on
3616+ "operator" : string, // Required. Operator based on type:
3617+ // - datetime: ">", "<", ">=", "<="
3618+ // - string: "=", "contains", "does not contain", "starts with", "ends with"
3619+ // - stringOptions: "any of", "none of"
3620+ // - categoryOptions: "any of", "none of"
3621+ // - arrayOptions: "any of", "none of", "all of"
3622+ // - number: "=", ">", "<", ">=", "<="
3623+ // - stringObject: "=", "contains", "does not contain", "starts with", "ends with"
3624+ // - numberObject: "=", ">", "<", ">=", "<="
3625+ // - boolean: "=", "<>"
3626+ // - null: "is null", "is not null"
3627+ "value" : any, // Required (except for null type). Value to compare against. Type depends on filter type
3628+ "key" : string // Required only for stringObject, numberObject, and categoryOptions types when filtering on nested fields like metadata
3629+ }
3630+ ]
3631+ ```
3632+
3633+ </dd >
3634+ </dl >
3635+
3636+ <dl >
3637+ <dd >
3638+
3639+ ** request_options:** ` typing.Optional[RequestOptions] ` — Request-specific configuration.
3640+
3641+ </dd >
3642+ </dl >
3643+ </dd >
3644+ </dl >
3645+
3646+
3647+ </dd >
3648+ </dl >
3649+ </details >
3650+
3651+ ## Opentelemetry
3652+ <details ><summary ><code >client.opentelemetry.<a href =" src/langfuse/resources/opentelemetry/client.py " >export_traces</a >(...)</code ></summary >
3653+ <dl >
3654+ <dd >
3655+
3656+ #### 📝 Description
3657+
3658+ <dl >
3659+ <dd >
3660+
3661+ <dl >
3662+ <dd >
3663+
3664+ ** OpenTelemetry Traces Ingestion Endpoint**
3665+
3666+ This endpoint implements the OTLP/HTTP specification for trace ingestion, providing native OpenTelemetry integration for Langfuse Observability.
3667+
3668+ ** Supported Formats:**
3669+ - Binary Protobuf: ` Content-Type: application/x-protobuf `
3670+ - JSON Protobuf: ` Content-Type: application/json `
3671+ - Supports gzip compression via ` Content-Encoding: gzip ` header
3672+
3673+ ** Specification Compliance:**
3674+ - Conforms to [ OTLP/HTTP Trace Export] ( https://opentelemetry.io/docs/specs/otlp/#otlphttp )
3675+ - Implements ` ExportTraceServiceRequest ` message format
3676+
3677+ ** Documentation:**
3678+ - Integration guide: https://langfuse.com/integrations/native/opentelemetry
3679+ - Data model: https://langfuse.com/docs/observability/data-model
3680+ </dd >
3681+ </dl >
3682+ </dd >
3683+ </dl >
3684+
3685+ #### 🔌 Usage
3686+
3687+ <dl >
3688+ <dd >
3689+
3690+ <dl >
3691+ <dd >
3692+
3693+ ``` python
3694+ from langfuse import (
3695+ OtelAttribute,
3696+ OtelAttributeValue,
3697+ OtelResource,
3698+ OtelResourceSpan,
3699+ OtelScope,
3700+ OtelScopeSpan,
3701+ OtelSpan,
3702+ )
3703+ from langfuse.client import FernLangfuse
3704+
3705+ client = FernLangfuse(
3706+ x_langfuse_sdk_name = " YOUR_X_LANGFUSE_SDK_NAME" ,
3707+ x_langfuse_sdk_version = " YOUR_X_LANGFUSE_SDK_VERSION" ,
3708+ x_langfuse_public_key = " YOUR_X_LANGFUSE_PUBLIC_KEY" ,
3709+ username = " YOUR_USERNAME" ,
3710+ password = " YOUR_PASSWORD" ,
3711+ base_url = " https://yourhost.com/path/to/api" ,
3712+ )
3713+ client.opentelemetry.export_traces(
3714+ resource_spans = [
3715+ OtelResourceSpan(
3716+ resource = OtelResource(
3717+ attributes = [
3718+ OtelAttribute(
3719+ key = " service.name" ,
3720+ value = OtelAttributeValue(
3721+ string_value = " my-service" ,
3722+ ),
3723+ ),
3724+ OtelAttribute(
3725+ key = " service.version" ,
3726+ value = OtelAttributeValue(
3727+ string_value = " 1.0.0" ,
3728+ ),
3729+ ),
3730+ ],
3731+ ),
3732+ scope_spans = [
3733+ OtelScopeSpan(
3734+ scope = OtelScope(
3735+ name = " langfuse-sdk" ,
3736+ version = " 2.60.3" ,
3737+ ),
3738+ spans = [
3739+ OtelSpan(
3740+ trace_id = " 0123456789abcdef0123456789abcdef" ,
3741+ span_id = " 0123456789abcdef" ,
3742+ name = " my-operation" ,
3743+ kind = 1 ,
3744+ start_time_unix_nano = " 1747872000000000000" ,
3745+ end_time_unix_nano = " 1747872001000000000" ,
3746+ attributes = [
3747+ OtelAttribute(
3748+ key = " langfuse.observation.type" ,
3749+ value = OtelAttributeValue(
3750+ string_value = " generation" ,
3751+ ),
3752+ )
3753+ ],
3754+ status = {},
3755+ )
3756+ ],
3757+ )
3758+ ],
3759+ )
3760+ ],
3761+ )
3762+
3763+ ```
3764+ </dd >
3765+ </dl >
3766+ </dd >
3767+ </dl >
3768+
3769+ #### ⚙️ Parameters
3770+
3771+ <dl >
3772+ <dd >
3773+
3774+ <dl >
3775+ <dd >
3776+
3777+ ** resource_spans:** ` typing.Sequence[OtelResourceSpan] ` — Array of resource spans containing trace data as defined in the OTLP specification
3778+
3779+ </dd >
3780+ </dl >
3781+
3782+ <dl >
3783+ <dd >
3784+
36073785** request_options:** ` typing.Optional[RequestOptions] ` — Request-specific configuration.
36083786
36093787</dd >
0 commit comments