FiddlerClient
API reference for 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
api_key
str
✓
-
The API key for authenticating with the Fiddler backend.
application_id
str
✓
-
The unique identifier (UUID4) for the application.
url
str
✗
http://localhost:4318 for local development
The base URL for the Fiddler backend. While it
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
Configuration for span limits, such as the maximum number of attributes or events.
sampler
sampling.Sampler | None
✗
None, which uses the parent-based OpenTelemetry
The sampler for deciding which spans to record.
compression
Compression
✗
Compression.Gzip
The compression for exporting traces. Can be Compression.Gzip or Compression.NoCompression. Gzip.
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 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. jsonl”.
Raises
ValueError – If application_id is not a valid UUID4 or if the url is not a valid HTTPS URL.
Examples
from opentelemetry.sdk.trace import SpanLimits
from fiddler_langgraph import FiddlerClient
client = FiddlerClient(
api_key='YOUR_API_KEY',
application_id='YOUR_APPLICATION_ID',
url='https://your-fiddler-instance.fiddler.ai',
span_limits=SpanLimits(max_span_attributes=64),
)
#### 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.
[!IMPORTANT]
Must be called before get_tracer() is invoked.
#### 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
```python
>>> from fiddler_langgraph import FiddlerClient
>>> client = FiddlerClient(api_key='...', application_id='...')
>>> client.update_resource({'service.version': '1.2.3'})
#### 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
>>> from fiddler_langgraph import FiddlerClient
>>> client = FiddlerClient(api_key='...', application_id='...')
>>> client.update_resource({'service.version': '1.2.3'})
#### 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
```python
>>> from fiddler_langgraph import FiddlerClient
>>> client = FiddlerClient(api_key='...', application_id='...')
>>> tracer = client.get_tracer()
>>> with tracer.start_as_current_span('my-operation'):
... print('Doing some work...')
Last updated
Was this helpful?