openllmetry
openllmetry copied to clipboard
feat(instrumentation): Add event-based tracking implementation across providers
/claim #2456 Fixes: #2456
- [x] I have added tests that cover my changes.
- [ ] If adding a new instrumentation or changing an existing one, I've added screenshots from some observability platform showing the change.
- [x] PR name follows conventional commits format:
feat(instrumentation): ...orfix(instrumentation): .... - [ ] (If applicable) I have updated the documentation accordingly.
Description
This PR adds event-based tracking implementation across multiple providers while maintaining backward compatibility with the legacy attribute-based approach.
Completed Implementations:
- ✅ Anthropic
- ✅ Bedrock
- ✅ Cohere
- ✅ Google GenerativeAI
- ✅ Groq
- ✅ Langchain
- ✅ LlamaIndex
- ✅ MistralAI
- ✅ Ollama
- ✅ Replicate
Pending Implementations:
- 🔄 SageMaker
- 🔄 Together
- 🔄 Transformers
- 🔄 VertexAI
- 🔄 WatsonX
Key Changes:
- Added event-based configuration with
use_legacy_attributessupport - Implemented event utilities for:
- Prompts
- Completions
- Embeddings (where applicable)
- Tool/Function calls (where applicable)
- Added comprehensive test coverage for event emission
- Added support for both sync and async clients
- Added streaming support where applicable
- Maintained backward compatibility with legacy mode
Each provider implementation includes:
- Event utilities (
events.py) - Configuration updates (
config.py) - Core instrumentation updates (
__init__.py) - Comprehensive test coverage (
test_events.py)
@nirga Could i get a review, to confirm I am on the right track. Thanks.
@onyedikachi-david can you rebase so we can run the CI?
@onyedikachi-david can you rebase so we can run the CI?
alright
Done @nirga
@onyedikachi-david looks like your tests are failing - can you take a look?
@onyedikachi-david looks like your tests are failing - can you take a look?
Okay
Hi, @nirga
Hope you don't mind I open another PR, the conflicts are a lot. I think it will be more cleaner. Thanks. What do you think?
Sure @onyedikachi-david
Thank you. On it.