{"id":2150,"library":"opentelemetry-instrumentation-alephalpha","title":"OpenTelemetry Aleph Alpha Instrumentation","description":"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.","status":"active","version":"0.58.0","language":"en","source_language":"en","source_url":"https://github.com/traceloop/openllmetry/tree/main/packages/opentelemetry-instrumentation-alephalpha","tags":["opentelemetry","observability","tracing","alephalpha","llm","ai","generative-ai"],"install":[{"cmd":"pip install opentelemetry-instrumentation-alephalpha aleph-alpha-client opentelemetry-sdk","lang":"bash","label":"Install with Aleph Alpha client and OTel SDK"}],"dependencies":[{"reason":"Core OpenTelemetry API for defining tracing interfaces.","package":"opentelemetry-api"},{"reason":"Base package for OpenTelemetry instrumentation utilities.","package":"opentelemetry-instrumentation"},{"reason":"OpenTelemetry semantic conventions for standardized attribute names.","package":"opentelemetry-semantic-conventions"},{"reason":"Specific semantic conventions for AI/LLM applications.","package":"opentelemetry-semantic-conventions-ai"}],"imports":[{"symbol":"AlephAlphaInstrumentor","correct":"from opentelemetry.instrumentation.alephalpha import AlephAlphaInstrumentor"}],"quickstart":{"code":"import os\nfrom opentelemetry import trace\nfrom opentelemetry.sdk.resources import Resource\nfrom opentelemetry.sdk.trace import TracerProvider\nfrom opentelemetry.sdk.trace.export import ConsoleSpanExporter, SimpleSpanProcessor\nfrom opentelemetry.instrumentation.alephalpha import AlephAlphaInstrumentor\n\n# Ensure Aleph Alpha client is installed: pip install aleph-alpha-client\nimport aleph_alpha_client\n\n# --- OpenTelemetry SDK Setup ---\n# Configure resource (optional, but good practice)\nresource = Resource.create({\"service.name\": \"aleph-alpha-app\"})\n\n# Set up a TracerProvider\nprovider = TracerProvider(resource=resource)\n\n# Export spans to console for demonstration\nspan_processor = SimpleSpanProcessor(ConsoleSpanExporter())\nprovider.add_span_processor(span_processor)\n\n# Set the global TracerProvider\ntrace.set_tracer_provider(provider)\n\n# --- Aleph Alpha Instrumentation ---\n# Instrument the Aleph Alpha client\nAlephAlphaInstrumentor().instrument()\n\n# --- Aleph Alpha Client Usage ---\n# Replace with your actual Aleph Alpha API key\nAA_API_KEY = os.environ.get(\"ALEPH_ALPHA_API_KEY\", \"YOUR_AA_API_KEY\")\n\nif AA_API_KEY == \"YOUR_AA_API_KEY\":\n    print(\"Warning: ALEPH_ALPHA_API_KEY not set. Using dummy key. API calls will fail.\")\n\n# Example Aleph Alpha API call\nprint(\"\\n--- Making an Aleph Alpha API call ---\")\nclient = aleph_alpha_client.Client(host=\"https://api.aleph-alpha.com\", token=AA_API_KEY)\n\ntry:\n    # A simple completion request\n    request = aleph_alpha_client.CompletionRequest(\n        prompt=aleph_alpha_client.Prompt([aleph_alpha_client.Text(\"Hello, world!\")]),\n        model=\"luminous-extended\",\n        maximum_tokens=10,\n    )\n    response = client.complete(request=request)\n    print(f\"Aleph Alpha Response: {response.completions[0].completion}\")\nexcept Exception as e:\n    print(f\"Aleph Alpha API call failed (this is expected if API key is invalid): {e}\")\n\nprint(\"\\n--- OpenTelemetry tracing complete ---\")\n","lang":"python","description":"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."},"warnings":[{"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.","message":"OpenTelemetry 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.","severity":"breaking","affected_versions":"All versions leveraging OpenTelemetry GenAI semantic conventions (0.53.4+)."},{"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`.","message":"By default, this instrumentation logs prompts, completions, and embeddings to span attributes. This might include sensitive user data.","severity":"gotcha","affected_versions":"All versions."},{"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.","message":"Installing `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.","severity":"gotcha","affected_versions":"All versions."}],"env_vars":null,"last_verified":"2026-04-09T00:00:00.000Z","next_check":"2026-07-08T00:00:00.000Z"}