OpenTelemetry Replicate instrumentation provides automatic tracing for applications using the Replicate Python client, allowing developers to monitor and observe AI/ML model inferences. It is part of the `openllmetry` project and is currently at version 0.58.0, with frequent releases to keep up with OpenTelemetry semantic conventions and new LLM integrations, typically on a weekly or bi-weekly cadence.
pip install opentelemetry-instrumentation-replicate replicate opentelemetry-sdkVerified import paths — ran on the pinned version, not inferred.
This quickstart demonstrates how to set up the OpenTelemetry SDK with a console exporter, instrument the Replicate client, and then make calls to Replicate. The console will display the generated traces for the Replicate operations.
Review the OpenTelemetry GenAI Semantic Conventions (https://opentelemetry.io/docs/specs/semconv/llm/llm-spans/) and update your OTLP consumers, dashboards, and queries to use the new attribute names. For example, 'llm.request.type' might become 'gen_ai.request.type'.
Always use the `replicate` Python client after `ReplicateInstrumentor().instrument()` has been called if you want to capture traces.
Ensure `pip install replicate` is run in your environment alongside the instrumentation package. A full install command is `pip install opentelemetry-instrumentation-replicate replicate opentelemetry-sdk`.
Set the `REPLICATE_API_TOKEN` environment variable with your actual Replicate API key before making any Replicate client calls.