Skip to content

Conversation

@bizob2828
Copy link
Member

Description

The linked bug found an issue with how we're now instrumenting openai with the tracing channel. I determined this is actually a bug in Node.js. In the meantime, we can work around it by wrapping the functions we need in traceSync and propagating and emitting the results in the resolve/reject blocks of the promise.

Note: I added a test to prove this no longer crashes, but I can't seem to get it to succeed with our mock server. I want to test with a live openai instance to ensure there aren't more issues, but I don't expect there to be.

How to Test

npm run versioned:internal openai

Related Issues

Fixes #3379

…o avoid crashing when using `completions.parse` or `responses.parse`
@bizob2828 bizob2828 force-pushed the fix-openai-instrumentation branch from aa57ce8 to 90fcf63 Compare September 19, 2025 21:03
@codecov
Copy link

codecov bot commented Sep 19, 2025

Codecov Report

❌ Patch coverage is 93.33333% with 2 lines in your changes missing coverage. Please review.
✅ Project coverage is 97.59%. Comparing base (e6ad52e) to head (90fcf63).
⚠️ Report is 4 commits behind head on main.

Files with missing lines Patch % Lines
lib/subscribers/openai/chat.js 92.59% 2 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main    #3382      +/-   ##
==========================================
- Coverage   97.66%   97.59%   -0.07%     
==========================================
  Files         366      366              
  Lines       52555    52585      +30     
  Branches        1        1              
==========================================
- Hits        51326    51322       -4     
- Misses       1229     1263      +34     
Flag Coverage Δ
integration-tests-cjs-20.x 73.40% <50.00%> (-0.02%) ⬇️
integration-tests-cjs-22.x 73.44% <50.00%> (-0.03%) ⬇️
integration-tests-cjs-24.x 74.15% <50.00%> (-0.03%) ⬇️
integration-tests-esm-20.x 49.98% <50.00%> (-0.01%) ⬇️
integration-tests-esm-22.x 50.04% <50.00%> (-0.01%) ⬇️
integration-tests-esm-24.x 51.33% <50.00%> (-0.01%) ⬇️
unit-tests-20.x 88.23% <50.00%> (-0.03%) ⬇️
unit-tests-22.x 88.24% <50.00%> (-0.03%) ⬇️
unit-tests-24.x 88.28% <50.00%> (-0.03%) ⬇️
versioned-tests-20.x 80.55% <93.33%> (-0.15%) ⬇️
versioned-tests-22.x 80.56% <93.33%> (-0.15%) ⬇️
versioned-tests-24.x 80.46% <93.33%> (-0.15%) ⬇️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ 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.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@jsumners-nr jsumners-nr merged commit c7ccf26 into newrelic:main Sep 22, 2025
23 of 25 checks passed
@github-project-automation github-project-automation bot moved this from Needs PR Review to Done: Issues recently completed in Node.js Engineering Board Sep 22, 2025
@github-actions github-actions bot mentioned this pull request Sep 22, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: Done: Issues recently completed

Development

Successfully merging this pull request may close these issues.

openai.chat.completions.parse is not working with latest newrelic version 13.3.2

2 participants