newrelic / newrelic-python-agent

New Relic Python Agent
https://docs.newrelic.com/docs/agents/python-agent
Apache License 2.0
178 stars 102 forks source link

Fix LLM event durations #1151

Closed RyanKadri closed 5 months ago

RyanKadri commented 5 months ago

Overview

In order to match behavior across agents, the python agent should report the duration field on AI Monitoring events in milliseconds rather than seconds.

Testing

The test suite does not currently check the duration field because the integration tests have variability between runs

RyanKadri commented 5 months ago

I ended up just manually converting from seconds to ms where we were referencing the trace duration. LMK if you want this to be in a shared function somewhere

codecov-commenter commented 5 months ago

Codecov Report

All modified and coverable lines are covered by tests :white_check_mark:

Project coverage is 81.68%. Comparing base (b75ea43) to head (bc7085c).

Additional details and impacted files ```diff @@ Coverage Diff @@ ## main #1151 +/- ## ========================================== - Coverage 81.69% 81.68% -0.01% ========================================== Files 193 193 Lines 21368 21368 Branches 3716 3716 ========================================== - Hits 17457 17455 -2 - Misses 2827 2828 +1 - Partials 1084 1085 +1 ```

:umbrella: View full report in Codecov by Sentry.
:loudspeaker: Have feedback on the report? Share it here.

umaannamalai commented 5 months ago

We tend to do manual conversion throughout the agent as well so this approach is fine. We can always create a common utility function down the road after this PR gets merged.