Registry / observability / opentelemetry-instrumentation-groq

opentelemetry-instrumentation-groq

JSON →
library0.62.3pypypi✓ verified 23d ago

OpenTelemetry Groq instrumentation for Python allows automatic tracing of calls to the Groq API. It integrates with the OpenTelemetry Python SDK to capture LLM-related operations, requests, responses, and metadata, conforming to the OpenTelemetry Generative AI semantic conventions. The current version is 0.58.0, with frequent releases to keep up with Groq API changes and OpenTelemetry semantic convention updates.

pip install opentelemetry-instrumentation-groq groq
INSTALL
IMPORT
SIG · OPENTELEMETRY-INST
O
opentelemetry-instrumentation-groq
observabilitypythonv0.62.3
Install
5.1s avg
Import
1143ms
Disk
38MB
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 1.190s · 39.2MB
glibc
py 3.103.95 runs
installs and imports cleanly · install 5.1s · import 1.096s · 39MB
38MB installed
● package 38MB
Code
Verified usage

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

GroqInstrumentor
from opentelemetry.instrumentation.groq import GroqInstrumentor

This quickstart demonstrates how to set up the OpenTelemetry SDK with a console exporter, instrument the Groq client, and make a sample API call. Traces generated by the Groq client will be printed to the console.

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.groq import GroqInstrumentor # 1. Configure OpenTelemetry SDK resource = Resource.create({"service.name": "groq-llm-app"}) provider = TracerProvider(resource=resource) processor = SimpleSpanProcessor(ConsoleSpanExporter()) provider.add_span_processor(processor) trace.set_tracer_provider(provider) # 2. Instrument the Groq library GroqInstrumentor().instrument() # 3. Ensure Groq API key is set groq_api_key = os.environ.get("GROQ_API_KEY", " # In a real application, use proper secret management. # For this quickstart, ensure the env var is set or provide a dummy key for testing. ") if not groq_api_key: print("Warning: GROQ_API_KEY environment variable not set.") print("Skipping Groq API call. Please set GROQ_API_KEY to run the example.") else: print("Making Groq API call...") try: from groq import Groq client = Groq(api_key=groq_api_key) chat_completion = client.chat.completions.create( messages=[ { "role": "user", "content": "Explain the concept of 'observability' in one sentence." } ], model="llama3-8b-8192", temperature=0.7, max_tokens=100 ) print("Groq Response:", chat_completion.choices[0].message.content) print("Traces should be printed to console.") except Exception as e: print(f"An error occurred during Groq API call: {e}")
Debug
Known issues
breakingThe instrumentation has migrated to the OpenTelemetry Generative AI semantic conventions (gen_ai), starting from version 0.53.0. This change renames many span attributes (e.g., `llm.request.type` to `gen_ai.request.type`) and introduces new ones. Custom dashboards, alerts, or queries relying on older attribute names will break.
fix
Update your telemetry data consumers (dashboards, alerts, processors) to reflect the new OpenTelemetry GenAI semantic convention attribute names. Refer to the OpenTelemetry GenAI specification for details.
affects: >=0.53.0
gotchaThe instrumentation must be initialized (`GroqInstrumentor().instrument()`) *before* the `groq` library is imported or its client is instantiated for automatic tracing to work correctly. If `groq` is imported first, its methods might not be patched.
fix
Ensure `GroqInstrumentor().instrument()` is called early in your application's lifecycle, ideally before any other `groq` imports or client instantiations.
affects: All
gotchaThis package only provides the OpenTelemetry instrumentation. It requires the `groq` library itself to be installed separately for the instrumentation to function. If `groq` is not installed, the instrumentation will be enabled but won't find the target methods to patch.
fix
Ensure `pip install groq` is run in your environment in addition to `pip install opentelemetry-instrumentation-groq`.
affects: All
Upgrade
Version history
0.62.3latest on PyPI · released Aug 10, 2026
Audit
Dependencies
opentelemetry-apirequiredCore OpenTelemetry API for tracing.
opentelemetry-sdkrequiredOpenTelemetry SDK for provider and processor setup.
opentelemetry-semantic-conventionsrequiredDefines the standard attribute names and values for GenAI operations.
groqrequiredThe Groq client library being instrumented. This package does not bundle it.
Agent activity
23 hits · last 30 days
node
20
Amazon
1
OpenAI (training)
1
Resources
opentelemetry-instrumentation-groq — pip install opentelemetry-instrumentation-groq · libregistry