fix(telemetry): prevent double counting of usage metrics
Description
This is a fix for the below bug: _[BUG] OpenTelemetry token/cost metrics double-counted in Langfuse due to duplicate reporting on parent and child spans https://github.com/strands-agents/sdk-python/issues/1267
Related Issues
https://github.com/strands-agents/sdk-python/issues/1267
Documentation PR
Type of Change
Bug fix
Bug fix New feature Breaking change Documentation update Other (please describe):
Testing
How have you tested the change? Verify that the changes do not break functionality or introduce warnings in consuming repositories: agents-docs, agents-tools, agents-cli
- [x] I ran
hatch run prepare
Checklist
- [ ] I have read the CONTRIBUTING document
- [ ] I have added any necessary tests that prove my fix is effective or my feature works
- [ ] I have updated the documentation accordingly
- [ ] I have added an appropriate example to the documentation to outline the feature, or no new docs are needed
- [ ] My changes generate no new warnings
- [ ] Any dependent changes have been merged and published
By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of your choice.
I created a new pull request for this pull request# 1327
@rajib76 could you update the code based on this reply: https://github.com/strands-agents/sdk-python/issues/1267#issuecomment-3666286154
I can make the new PR too if preferred.
Codecov Report
:white_check_mark: All modified and coverable lines are covered by tests.
:loudspeaker: Thoughts on this report? Let us know!
Thank you very much @poshinchen for resolving this so quickly! Would love to connect with you on discord, pls share details if okay with it.
This change will go in 1.21.0, right? If yes, when can we expect the package release.
Sorry I don't have discord account. The next release should be on next Tuesday / Wednesday.