Skip to main content

conviva-otlp-exporter

The Conviva transport layer for Python. Resolves the gateway destination and routing headers, builds the OTLP http/protobuf exporter, and supplies the span processors that stamp the ids Conviva correlates on.

It depends on no vendor SDK — no OpenLLMetry, no Langfuse — so you can drop it underneath whichever instrumentation library you already have. If you want auto-instrumentation as well, use conviva-agent-tracing, which is this package plus OpenLLMetry.

Install

pip install conviva-otlp-exporter

Configure

Two values, and nothing else — the second is optional:

customer key customer_key= or CONVIVA_CUSTOMER_KEY. Becomes the subdomain: https://<customerKey>.agw.conviva.com.
project id project_id= or CONVIVA_PROJECT_ID. Sent as the X-Conviva-Project-Id header and written onto every span as cnv.project_id. Optional: without it, traces go to the account's default project.

Use

from opentelemetry.sdk.trace import TracerProvider
from opentelemetry.sdk.trace.export import BatchSpanProcessor

from conviva_otlp_exporter import (
    CompositeSpanProcessor,
    create_conviva_span_processors,
    create_trace_exporter,
    resolve_config,
)

config = resolve_config()  # reads CONVIVA_CUSTOMER_KEY and CONVIVA_PROJECT_ID

provider = TracerProvider()
provider.add_span_processor(BatchSpanProcessor(create_trace_exporter(config)))
for processor in create_conviva_span_processors(config):
    provider.add_span_processor(processor)

Order matters. The exporting processor goes first: the Conviva processors read attributes the instrumentation wrote during on_start, so they have to run after whatever put them there.

For an API that accepts only one processor — Traceloop.init(processor=...) is the common case — wrap the stack:

processor = CompositeSpanProcessor(*create_conviva_span_processors(config))

Masking PII

Off by default. To mask content before it leaves the process, pass your own function: create_trace_exporter(config, mask=mask), or wrap any exporter with MaskingSpanExporter(exporter, mask). Content under other attribute names (e.g. input.value) can be masked on top of the built-in keys with mask_attributes. See INTEGRATION.md.

What the processors do

Processor Writes Notes
ConversationIdSpanProcessor cvx.conversation_id, gen_ai.conversation.id Resolves from an explicit value, then span attributes (traceloop.association.properties.session_id, session.id, gen_ai.conversation.id), then baggage (c3.conv_id, conversation_id, session_id, langfuse_session_id). Never overwrites an existing value.
ProjectIdSpanProcessor cnv.project_id Not redundant with the header. Header plus resource attribute alone was observed to return HTTP 200 with nothing visible downstream; only the per-span attribute worked.
AttributeSpanProcessor whatever you give it Drops None and "" once at construction.
CompositeSpanProcessor — Runs several as one, in argument order.

All of them mutate in on_start. By on_end the span is read-only.

Endpoint precedence

Highest first:

  1. the endpoint= argument
  2. CONVIVA_OTLP_ENDPOINT
  3. OTEL_EXPORTER_OTLP_TRACES_ENDPOINT
  4. OTEL_EXPORTER_OTLP_ENDPOINT
  5. derived — https://<customer_key>.agw.conviva.com

Rungs 3 and 4 let a stock OpenTelemetry operator point telemetry at a local collector without knowing any Conviva-specific variable name. A configured endpoint may include the signal path or not; /v1/traces is stripped and re-appended either way.

Traces only

This package exports traces to https://<customer_key>.agw.conviva.com/v1/traces and nothing else: there is no metric or log exporter. A configured endpoint that ends in /v1/metrics or /v1/logs is still accepted and reduced to its base URL, so a value copied from a generic OTLP setup resolves correctly.

The contract

Every constant here is authored in contract/config-contract.json at the component root, and asserted by tests/test_contract.py — alongside the JS exporter and the coding-agent hook engine, which read the same file. Three implementations, one source of truth.

Test

uv run pytest packages/python/conviva-otlp-exporter

Documentation

README.md What the package does and its API.
INTEGRATION.md Step-by-step integration into an application.
AGENTS.md Guidance for AI coding agents working on or with this package.

Metadata

Release files for conviva-otlp-exporter 1.2.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Built distribution (wheel)

Table of built distributions (wheels) for conviva-otlp-exporter 1.2.0
File Interpreter ABI Platform Actions
conviva_otlp_exporter-1.2.0-py3-none-any.whl Python 3 none any Details for conviva_otlp_exporter-1.2.0-py3-none-any.whl

Release files / conviva_otlp_exporter-1.2.0-py3-none-any.whl

Download URL conviva_otlp_exporter-1.2.0-py3-none-any.whl
Size 19.8 kB
Tags Python 3
SHA-256 checksum
How to use checksums
e35968b4ae463da9f0eff51b68d50b5b3bcacfc89f1c12421ad0fd7b7d74f549
BLAKE2b-256 checksum
How to use checksums
7075f02cdd06826c777b94de720dba3750d6b1a8612d12ffdd33b1b59cc5eb21
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 25, 2026.

Transparency log

Security for conviva-otlp-exporter 1.2.0

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

Full provenance

1 file in this release has been uploaded with provenance metadata.

Attestation for conviva_otlp_exporter-1.2.0-py3-none-any.whl

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 25, 2026.

Transparency log

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Release history Release notifications | RSS feed

This release

1.2.0 This release

1 release file Full provenance

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page