Registry / ai-ml / openinference-instrumentation-groq

openinference-instrumentation-groq

JSON →
library0.1.16pypypi✓ verified 79d ago

OpenInference instrumentation for Groq LLM API calls. This package provides automatic tracing of Groq client interactions (chat completions, embeddings, etc.) for observability and monitoring. Version 0.1.16 supports Python 3.10-3.14. It is part of the OpenInference ecosystem and is used with Phoenix or other OpenInference-compatible collectors.

pip install openinference-instrumentation-groq
INSTALL
IMPORT
SIG · OPENINFERENCE-INST
O
openinference-instrumentation-groq
ai-mlpythonv0.1.16
harness data pending
Install & Compatibility
Where this runs

No compatibility data collected yet for this library.

Code
Verified usage

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

GroqInstrumentor
from openinference.instrumentation.groq import GroqInstrumentor
from openinference_instrumentation_groq import GroqInstrumentor

Initialize OpenTelemetry, instrument Groq, then make a chat completion call to see traces.

import os from openinference_instrumentation_groq import GroqInstrumentor from opentelemetry.exporter.otlp.proto.http.trace_exporter import OTLPSpanExporter from opentelemetry.sdk.trace import TracerProvider from opentelemetry.sdk.trace.export import SimpleSpanProcessor # Set up OpenTelemetry (example with Phoenix) endpoint = os.environ.get('PHOENIX_COLLECTOR_ENDPOINT', 'http://localhost:4318/v1/traces') provider = TracerProvider() provider.add_span_processor(SimpleSpanProcessor(OTLPSpanExporter(endpoint))) # Instrument Groq GroqInstrumentor().instrument(tracer_provider=provider) # Now use Groq as usual from groq import Groq client = Groq(api_key=os.environ.get('GROQ_API_KEY', '')) response = client.chat.completions.create( model="llama3-8b-8192", messages=[{"role": "user", "content": "Say hello!"}] ) print(response.choices[0].message.content)
Debug
Known issues
gotchaThe `GroqInstrumentor` must be instantiated (with parentheses) even if no arguments are passed. `GroqInstrumentor.instrument()` (classmethod) may not work as expected.
fix
Use `GroqInstrumentor().instrument(...)` instead of `GroqInstrumentor.instrument(...)`.
affects: <=0.1.16
gotchaInstrumentation must be called before creating any Groq clients. If you import and use Groq before calling `instrument()`, some spans may be missed.
fix
Ensure `GroqInstrumentor().instrument()` is called at the top of your application, before any Groq client initialization.
affects: all
deprecatedThe `tracer_provider` parameter may be deprecated in future versions in favor of setting the global tracer provider via `opentelemetry-api`. Check documentation for the latest pattern.
fix
Consider using `from opentelemetry import trace; trace.set_tracer_provider(provider)` before instrumenting without arguments.
affects: 0.1.x
Upgrade
Version history
0.1.16latest on PyPI · released May 18, 2026
Audit
Dependencies
openinference-instrumentationrequiredBase instrumentation framework and semantic conventions required.
groqrequiredOfficial Groq Python client library that is instrumented.
opentelemetry-apirequiredOpenTelemetry API for creating spans and traces.
opentelemetry-sdkoptionalOpenTelemetry SDK for exporting traces (often used with Phoenix).
Agent activity
7 hits · last 30 days
node
6
Amazon
1
Resources
openinference-instrumentation-groq — pip install openinference-instrumentation-groq · libregistry