Skip to content

Conversation

umaannamalai
Copy link
Contributor

@umaannamalai umaannamalai commented Sep 10, 2025

This PR updates Gemini instrumentation and tests to pull token counts directly from the response object. If a customer has an LLM token counting callback function registered, this will still take priority over the response token count values.

It also removes token count calculations from error cases as the agent will consistently stop reporting token counts when a error was met during the creation of a text generation.

@umaannamalai umaannamalai changed the base branch from main to feature-llm-token-counts September 10, 2025 20:56
Copy link

🦙 MegaLinter status: ✅ SUCCESS

Descriptor Linter Files Fixed Errors Warnings Elapsed time
✅ ACTION actionlint 6 0 0 0.72s
✅ MARKDOWN markdownlint 7 0 0 0 1.16s
✅ MARKDOWN markdown-link-check 7 0 0 24.7s
✅ PYTHON ruff 940 0 0 0 0.84s
✅ PYTHON ruff-format 940 1 0 0 0.32s
✅ YAML prettier 13 0 0 0 1.42s
✅ YAML v8r 13 0 0 5.83s
✅ YAML yamllint 13 0 0 0.61s

See detailed report in MegaLinter reports

MegaLinter is graciously provided by OX Security

@mergify mergify bot added the tests-failing Tests failing in CI. label Sep 10, 2025
@codecov-commenter
Copy link

Codecov Report

❌ Patch coverage is 67.39130% with 15 lines in your changes missing coverage. Please review.
✅ Project coverage is 81.47%. Comparing base (c2f8fe4) to head (68d8f28).
⚠️ Report is 2 commits behind head on feature-llm-token-counts.

Files with missing lines Patch % Lines
newrelic/hooks/mlmodel_gemini.py 67.39% 7 Missing and 8 partials ⚠️
Additional details and impacted files
@@                     Coverage Diff                      @@
##           feature-llm-token-counts    #1486      +/-   ##
============================================================
- Coverage                     81.48%   81.47%   -0.01%     
============================================================
  Files                           209      209              
  Lines                         23815    23839      +24     
  Branches                       3753     3757       +4     
============================================================
+ Hits                          19405    19423      +18     
- Misses                         3153     3155       +2     
- Partials                       1257     1261       +4     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@TimPansino TimPansino self-assigned this Sep 15, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
tests-failing Tests failing in CI.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants