traceloop / traceloop/openllmetry
🚀 Feature: Callback Hooks for LLM Instrumentation Libraries
Nobody has claimed this yet.
- Dominant language
- Python
- Stars
- 7.4k
- Forks
- 1.1k
- Avg merge
- 8d 14h
- Merged PRs (30d)
- 2
Description
Which component is this feature for?
Bedrock Instrumentation
🔖 Feature description
Ability to pass a callback hook to the instrumentors which takes in the span aditiona attibutes line request and response.
The callback function can update the spans with new additiona attributes
🎤 Why is this feature needed ?
It will allow us to record more metrics and add more attributes which are not already implemeted.
This will allow us to extend the functionaly of the instrumentor using custom logic without waiting the functionality to be implemented in the core library.
Eg, I want the below 2 features asap
- Add a metrics that directly tracks the cost of the llm
- Bedrock converse api instrumentor does not support prompt caching tracking yet
Would love to contribute and implement these features directly, but having a callback hook will allow us to not wait for it (or any other custom attributes which does not make sense to core library, eg org_id, etc..) to be part of the core library
✌️ How do you aim to achieve this?
Not fully sure yet.
Maybe something like how Django Instrumentor does it.
Request and Response hooks
🔄️ Additional Information
No response
👀 Have you spent some time to check if this feature request has been raised before?
- I checked and didn't find similar issue
Are you willing to submit PR?
Yes I am willing to submit a PR!
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start with the Bedrock Instrumentation component and review the linked Django request and response hooks documentation for a possible callback model. Define how callbacks receive request, response, and span attributes, and verify that custom callbacks can add attributes and metrics without blocking existing instrumentation behavior.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- python
- Domain
- observability
- Issue type
- Feature
- Difficulty
- 5/5
- Estimated time
- Over a week
- Activity status
- Quiet
- Clarity
- Needs clarification
- Newbie friendliness
- 35/100