Skip to content

Update OpenAI instrumentation to support autogen compatiblity #1445

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 9 commits into
base: feature-autogen-instrumentation
Choose a base branch
from

Conversation

umaannamalai
Copy link
Contributor

This PR includes two updates to OpenAI instrumentation to support autogen compatibility in the UI.

First change: Add a check for finish_reason to ensure we do not send up empty content when using autogen + tools

Second change: Save linking metadata on instance instead of getting it fresh in _record_events_on_stop_iteration. This was necessary to fix a bug in the UI where LLM calls were not linked to the correct span ID.

@umaannamalai umaannamalai requested a review from a team as a code owner August 11, 2025 20:13
Copy link

github-actions bot commented Aug 11, 2025

🦙 MegaLinter status: ✅ SUCCESS

Descriptor Linter Files Fixed Errors Warnings Elapsed time
✅ ACTION actionlint 6 0 0 0.74s
✅ MARKDOWN markdownlint 7 0 0 0 1.17s
✅ MARKDOWN markdown-link-check 7 0 0 21.9s
✅ PYTHON ruff 927 0 0 0 0.95s
✅ PYTHON ruff-format 927 0 0 0 0.32s
✅ YAML prettier 13 0 0 0 1.34s
✅ YAML v8r 13 0 0 4.64s
✅ YAML yamllint 13 0 0 0.64s

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 Aug 11, 2025
@codecov-commenter
Copy link

codecov-commenter commented Aug 11, 2025

Codecov Report

❌ Patch coverage is 57.14286% with 3 lines in your changes missing coverage. Please review.
⚠️ Please upload report for BASE (feature-autogen-instrumentation@50c7425). Learn more about missing BASE report.

Files with missing lines Patch % Lines
newrelic/hooks/mlmodel_openai.py 57.14% 1 Missing and 2 partials ⚠️
Additional details and impacted files
@@                        Coverage Diff                         @@
##             feature-autogen-instrumentation    #1445   +/-   ##
==================================================================
  Coverage                                   ?   80.87%           
==================================================================
  Files                                      ?      209           
  Lines                                      ?    23674           
  Branches                                   ?     3730           
==================================================================
  Hits                                       ?    19146           
  Misses                                     ?     3267           
  Partials                                   ?     1261           

☔ 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.

@umaannamalai umaannamalai force-pushed the feature-autogen-instrumentation branch from 8cdd45e to 50c7425 Compare August 11, 2025 22:00
umaannamalai and others added 8 commits August 11, 2025 15:01
* Add instrumentation for MCP tool adapter.

* [MegaLinter] Apply linters fixes
* Add autogen agent instrumentation.

* Address review feedback.

* [MegaLinter] Apply linters fixes

---------

Co-authored-by: mergify[bot] <37929162+mergify[bot]@users.noreply.github.com>
@umaannamalai umaannamalai force-pushed the patch-openai-span-id-bug branch from f2c81fe to 0b1d9b9 Compare August 11, 2025 22:04
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