FiddlerClient

FiddlerClient

The main client for instrumenting Generative AI applications with Fiddler observability.

This client configures and manages the OpenTelemetry tracer that sends telemetry data to the Fiddler platform for monitoring, analysis, and debugging of your AI agents and workflows.

Parameters

Parameter
Type
Required
Default
Description

api_key

str

-

The API key for authenticating with the Fiddler backend.

application_id

str

-

The unique identifier (UUID4) for the application.

url

str

-

The base URL for your Fiddler instance. This is specific to your deployment, whether hosted, VPC-deployed, on-premise, or local development (e.g., https://your-instance.fiddler.ai, http://localhost:4318).

console_tracer

bool

False

If True, traces will be printed to the console instead of being sent to the Fiddler backend. Useful for debugging.

span_limits

SpanLimits | None

a restrictive set of internal limits (32 events

Configuration for span limits, such as the maximum number of attributes or events. 2048 char limit).

sampler

sampling.Sampler | None

None, which uses the parent-based always-on Ope

The sampler for deciding which spans to record. which uses the parent-based always-on OpenTelemetry sampler (100% sampling).

compression

Compression

Compression.Gzip (recommended for production

The compression for exporting traces. Can be Compression.Gzip, Compression.Deflate, or Compression.NoCompression. Defaults to Compression.Gzip (recommended for production).

jsonl_capture_enabled

bool

False

Whether to enable JSONL capture of trace data. When enabled, all span data will be captured and saved to a JSONL file in OpenTelemetry format for offline analysis.

jsonl_file_path

str

“fiddler_trace_data.jsonl”

Path to the JSONL file where trace data will be saved. Only used when jsonl_capture_enabled is True. Defaults to “fiddler_trace_data.jsonl”.

Raises

ValueError – If application_id is not a valid UUID4 or if the url is not a valid HTTP/HTTPS URL.

Examples

Basic connection to your Fiddler instance:

High-volume applications with custom configuration:

Local development with console output:

get_tracer_provider()

Gets the OpenTelemetry TracerProvider instance.

Initializes the provider on the first call.

Returns

The configured OpenTelemetry TracerProvider.

Return type: TracerProvider

Raises

RuntimeError – If tracer provider initialization fails.

update_resource()

Updates the OpenTelemetry resource with additional attributes.

Use this to add metadata that applies to all spans, such as version numbers or environment names.

Parameters

Parameter
Type
Required
Default
Description

attributes

dict[str, Any]

-

Key-value pairs to add to the resource.

Raises

ValueError – If the tracer has already been initialized. Return type: None

Examples

get_tracer()

Returns an OpenTelemetry tracer instance for creating spans.

Initializes the tracer on the first call. This is the primary method for developers to get a tracer for custom instrumentation.

Returns

OpenTelemetry tracer instance.

Return type: trace.Tracer

Raises

RuntimeError – If tracer initialization fails.

Examples

Last updated

Was this helpful?