adding crew ai instrumentation - #363
Open
venkata-pavani wants to merge 1 commit into
Open
Conversation
Pull request dashboard statusWaiting on the author · refreshed 2026-08-07 03:27 UTC Two things need attention:
Status above doesn't look right?
|
Contributor
There was a problem hiding this comment.
Pull request overview
Adds first-pass OpenTelemetry GenAI instrumentation for CrewAI LLM inference by translating CrewAI LLM lifecycle events into opentelemetry-util-genai inference telemetry, along with unit + conformance scaffolding and docs/examples.
Changes:
- Introduces a
CrewAIInferenceEventListenerthat maps CrewAI LLM events toTelemetryHandler.inference()invocations. - Adds unit tests for inference event translation, completion hook wiring, and disabling CrewAI’s native telemetry while instrumented.
- Adds a CrewAI conformance scenario + tox wiring and expands the package README with configuration and completion hook docs.
Reviewed changes
Copilot reviewed 11 out of 11 changed files in this pull request and generated 1 comment.
Show a summary per file
| File | Description |
|---|---|
| tox.ini | Adds a CrewAI conformance tox env and updates CrewAI test commands to exclude conformance from non-conformance runs. |
| instrumentation/opentelemetry-instrumentation-genai-crewai/tests/test_instrumentor.py | Adds tests ensuring CrewAI native telemetry is disabled only when instrumentation sets the default. |
| instrumentation/opentelemetry-instrumentation-genai-crewai/tests/test_inference.py | Adds unit tests validating span attributes/status for completed/failed events and completion hook invocation. |
| instrumentation/opentelemetry-instrumentation-genai-crewai/tests/test_conformance.py | Adds conformance test entrypoint wiring for CrewAI scenarios. |
| instrumentation/opentelemetry-instrumentation-genai-crewai/tests/conftest.py | Ensures content_capture="SPAN_ONLY" for tests that assert content-related attributes exist. |
| instrumentation/opentelemetry-instrumentation-genai-crewai/tests/conformance/inference.py | Adds a minimal inference conformance scenario emitting CrewAI LLM start/completion events. |
| instrumentation/opentelemetry-instrumentation-genai-crewai/tests/conformance/init.py | Adds package marker for conformance scenarios. |
| instrumentation/opentelemetry-instrumentation-genai-crewai/src/opentelemetry/instrumentation/genai/crewai/event_listener.py | Implements event listener translating CrewAI LLM events into GenAI inference invocations. |
| instrumentation/opentelemetry-instrumentation-genai-crewai/src/opentelemetry/instrumentation/genai/crewai/init.py | Creates the listener during instrumentation and disables/restores CrewAI native telemetry via env var. |
| instrumentation/opentelemetry-instrumentation-genai-crewai/README.rst | Updates README to reflect inference spans/metrics and documents native telemetry disabling + completion hooks. |
| instrumentation/opentelemetry-instrumentation-genai-crewai/examples/custom_hook.py | Adds a minimal custom completion hook example. |
Comment on lines
56
to
60
| ; instrumentation-genai-crewai | ||
| py3{10,11,12,13,14}-test-instrumentation-genai-crewai-latest | ||
| py310-test-instrumentation-genai-crewai-oldest | ||
| py313-test-instrumentation-genai-crewai-conformance | ||
| lint-instrumentation-genai-crewai |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
Description
opentelemetry-util-genai.CREWAI_DISABLE_TELEMETRY=false. Existing values are preserved and restored correctly. ref: #308 (comment)Type of change
Please delete options that are not relevant.
How has this been tested?
Testing
--advice-data; the CrewAI scenario did not runFuture PR
In follow-up PRs, I plan to add CrewAI workflow, agent, and tool instrumentation using the
invoke_workflow,invoke_agent, andexecute_toolGenAI semantic conventions, along with proper context propagation and streaming support.