Wrap AI functions with OpenTelemetry tracing to track interactions within a Gentrace pipeline
interaction()
function wraps your AI functions with OpenTelemetry tracing to track interactions within a Gentrace pipeline. It creates spans for function execution, records arguments and outputs, and automatically manages OpenTelemetry baggage to ensure proper sampling and tracing context.
init()
. If you have an existing OpenTelemetry setup or need custom
configuration, see the manual setup guide.GentraceSpanProcessor
when you call init()
, which simplifies the process of converting baggage values to span attributes, ensuring proper trace routing to Gentrace. For manual configuration details, see the OpenTelemetry setup guide.
GentraceSpanProcessor
simplifies baggage-to-span attribute conversion by
automatically copying baggage values (like gentrace.sample=true
) to span
attributes. This ensures that the OpenTelemetry Collector can properly
identify and route Gentrace-related traces without requiring manual attribute
management in your code.interaction()
function:
gentrace.sample="true"
for proper samplinggentrace.pipeline_id
attributeattributes
option.
interaction()
function provides deep integration with OpenTelemetry:
gentrace.pipeline_id
attributegentrace.fn.args
with serialized function argumentsgentrace.fn.output
with serialized return valueinteraction()
function handles errors gracefully and automatically associates all errors and exceptions with the OpenTelemetry span:
Error
objects (TypeScript) and exceptions (Python) are automatically captured as span eventsERROR
when unhandled exceptions occurinteraction()
function works seamlessly with Gentrace experiments:
init()
with a valid API key. The SDK automatically
configures OpenTelemetry for you. For custom OpenTelemetry setups, see the
manual setup guide.init()
- Initialize the Gentrace SDKtraced()
- Lower-level function tracing without pipeline associationexperiment()
- Create testing contexts for grouping related evaluationseval()
/ evalOnce()
- Run individual test cases within experimentsevalDataset()
/ eval_dataset()
- Run tests against a dataset