Registry / observability / opentelemetry-instrumentation-alephalpha

opentelemetry-instrumentation-alephalpha

JSON →
library0.62.3pypypi✓ verified 23d ago

This library provides OpenTelemetry instrumentation for tracing calls to Aleph Alpha's endpoints when using the official Aleph Alpha Client. It is part of the broader OpenLLMetry project, offering observability for Generative AI and LLM applications. The library is actively maintained with frequent releases, currently at version 0.58.0.

pip install opentelemetry-instrumentation-alephalpha aleph-alpha-client opentelemetry-sdk
INSTALL
IMPORT
SIG · OPENTELEMETRY-INST
O
opentelemetry-instrumentation-alephalpha
observabilitypythonv0.62.3
Install
12.7s avg
Import
447ms
Disk
158MB
Pass rate
10/ 10
Env Coverage10 / 10
glibc
3.93.13
musl
3.93.13
Install & Compatibility
Where this runs
tested against v0.62.3 · pip install
no network on importno background threads
Install × environment matrix
Each cell = how many times install + import succeeded across repeated harness runs. Partial = flaky.
glibc = Debian/Ubuntu slim · musl = Alpine Linux
musl
py 3.103.95 runs
installs and imports cleanly · install 0.0s · import 0.460s · 162.2MB
glibc
py 3.103.95 runs
installs and imports cleanly · install 12.7s · import 0.434s · 146MB
158MB installed
● package 158MB
Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

AlephAlphaInstrumentor
from opentelemetry.instrumentation.alephalpha import AlephAlphaInstrumentor

This quickstart demonstrates how to set up the OpenTelemetry SDK with a console exporter and then apply the `AlephAlphaInstrumentor` to automatically trace calls made using the `aleph-alpha-client`. Ensure your `ALEPH_ALPHA_API_KEY` is set as an environment variable or replaced in the code.

import os from opentelemetry import trace from opentelemetry.sdk.resources import Resource from opentelemetry.sdk.trace import TracerProvider from opentelemetry.sdk.trace.export import ConsoleSpanExporter, SimpleSpanProcessor from opentelemetry.instrumentation.alephalpha import AlephAlphaInstrumentor # Ensure Aleph Alpha client is installed: pip install aleph-alpha-client import aleph_alpha_client # --- OpenTelemetry SDK Setup --- # Configure resource (optional, but good practice) resource = Resource.create({"service.name": "aleph-alpha-app"}) # Set up a TracerProvider provider = TracerProvider(resource=resource) # Export spans to console for demonstration span_processor = SimpleSpanProcessor(ConsoleSpanExporter()) provider.add_span_processor(span_processor) # Set the global TracerProvider trace.set_tracer_provider(provider) # --- Aleph Alpha Instrumentation --- # Instrument the Aleph Alpha client AlephAlphaInstrumentor().instrument() # --- Aleph Alpha Client Usage --- # Replace with your actual Aleph Alpha API key AA_API_KEY = os.environ.get("ALEPH_ALPHA_API_KEY", "YOUR_AA_API_KEY") if AA_API_KEY == "YOUR_AA_API_KEY": print("Warning: ALEPH_ALPHA_API_KEY not set. Using dummy key. API calls will fail.") # Example Aleph Alpha API call print("\n--- Making an Aleph Alpha API call ---") client = aleph_alpha_client.Client(host="https://api.aleph-alpha.com", token=AA_API_KEY) try: # A simple completion request request = aleph_alpha_client.CompletionRequest( prompt=aleph_alpha_client.Prompt([aleph_alpha_client.Text("Hello, world!")]), model="luminous-extended", maximum_tokens=10, ) response = client.complete(request=request) print(f"Aleph Alpha Response: {response.completions[0].completion}") except Exception as e: print(f"Aleph Alpha API call failed (this is expected if API key is invalid): {e}") print("\n--- OpenTelemetry tracing complete ---")
Debug
Known issues
breakingOpenTelemetry semantic conventions, especially for Generative AI, are evolving. Updates to `opentelemetry-semantic-conventions-ai` might introduce breaking changes to span attribute names in minor versions.
fix
Monitor release notes for `opentelemetry-semantic-conventions-ai`. Use the `OTEL_SEMCONV_STABILITY_OPT_IN` environment variable (e.g., `OTEL_SEMCONV_STABILITY_OPT_IN=gen_ai/dup`) to emit both old and new conventions during migration periods.
affects: All versions leveraging OpenTelemetry GenAI semantic conventions (0.53.4+).
gotchaBy default, this instrumentation logs prompts, completions, and embeddings to span attributes. This might include sensitive user data.
fix
To disable logging of content for privacy reasons or to reduce trace size, set the environment variable `TRACELOOP_TRACE_CONTENT` to `false`. Example: `TRACELOOP_TRACE_CONTENT=false`.
affects: All versions.
gotchaInstalling `opentelemetry-instrumentation-alephalpha` alone is not sufficient to generate traces. A full OpenTelemetry SDK setup, including a `TracerProvider`, `SpanProcessor`, and `SpanExporter`, is required to process and export telemetry data.
fix
Always initialize a `TracerProvider` and configure at least one `SpanProcessor` and `SpanExporter` in your application code. Refer to the OpenTelemetry Python SDK documentation for complete setup. The quickstart above includes a minimal working example.
affects: All versions.
Upgrade
Version history
0.62.3latest on PyPI · released Aug 10, 2026
Audit
Dependencies
opentelemetry-apirequiredCore OpenTelemetry API for defining tracing interfaces.
opentelemetry-instrumentationrequiredBase package for OpenTelemetry instrumentation utilities.
opentelemetry-semantic-conventionsrequiredOpenTelemetry semantic conventions for standardized attribute names.
opentelemetry-semantic-conventions-airequiredSpecific semantic conventions for AI/LLM applications.
Agent activity
15 hits · last 30 days
node
12
OpenAI (training)
2
Resources
opentelemetry-instrumentation-alephalpha — pip install opentelemetry-instrumentation-alephalpha · libregistry