Skip to content

Conversation

@amychisholm03
Copy link
Contributor

@amychisholm03 amychisholm03 commented Dec 5, 2025

Description

AWS Bedrock instrumentation utilizes a unique LlmError class. It should use the LlmErrorMessage class all other LLM packages use instead.

How to Test

npm run unit
npm run versioned:major aws-sdk-v3

@codecov
Copy link

codecov bot commented Dec 5, 2025

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 97.68%. Comparing base (3ee4d38) to head (e92151f).
⚠️ Report is 4 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff             @@
##             main    #3567      +/-   ##
==========================================
- Coverage   97.80%   97.68%   -0.13%     
==========================================
  Files         428      427       -1     
  Lines       56592    56585       -7     
  Branches        1        1              
==========================================
- Hits        55351    55273      -78     
- Misses       1241     1312      +71     
Flag Coverage Δ
integration-tests-cjs-20.x 73.94% <29.16%> (-0.02%) ⬇️
integration-tests-cjs-22.x 73.97% <29.16%> (-0.03%) ⬇️
integration-tests-cjs-24.x 74.73% <29.16%> (-0.02%) ⬇️
integration-tests-esm-20.x 52.61% <29.16%> (-0.03%) ⬇️
integration-tests-esm-22.x 52.65% <29.16%> (-0.03%) ⬇️
integration-tests-esm-24.x 53.84% <29.16%> (-0.03%) ⬇️
unit-tests-20.x 88.69% <70.83%> (-0.02%) ⬇️
unit-tests-22.x 88.72% <70.83%> (-0.02%) ⬇️
unit-tests-24.x 88.73% <70.83%> (-0.02%) ⬇️
versioned-tests-20.x 80.93% <100.00%> (-0.30%) ⬇️
versioned-tests-22.x 80.94% <100.00%> (-0.30%) ⬇️
versioned-tests-24.x 80.88% <100.00%> (-0.30%) ⬇️

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.

* @param {LlmTool} [params.tool] Details about the tool event if it was a tool event.
* @param {boolean} [params.useNameAsCode] defaults to false, only Bedrock sets it to true so far
*/
constructor({ response, cause, summary, embedding, vectorsearch, tool } = {}) {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't think I realized that this class is overloaded. We handle specific assignment of attributes depending on params and/or further processing. It seems like most LLMs will either use keys on response or error(cause) to assign attributes but in the case of gemini it parses error and in case of bedrock is uses the error.name for the code instead of error.code

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I was thinking of maybe having error message classes that inherit from LlmErrorMessage for Bedrock and Gemini. I was planning to do in the AIM subscriber refactor.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

for sure, that's what I was referring to. it can wait until then

@amychisholm03 amychisholm03 merged commit 8b2bb42 into newrelic:main Dec 8, 2025
24 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 Dec 8, 2025
@amychisholm03 amychisholm03 deleted the llm-error-refactor branch December 8, 2025 21:30
@github-actions github-actions bot mentioned this pull request Dec 11, 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.

2 participants