Skip to content

feat(instrumentation-aws-sdk): add gen ai instrumentation for InvokeModel API #2777

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

Merged
merged 24 commits into from
Apr 17, 2025

Conversation

ezhang6811
Copy link
Contributor

@ezhang6811 ezhang6811 commented Apr 1, 2025

Which problem is this PR solving?

  • Gen AI is currently only supported in bedrock runtime for the Converse API. The InvokeModel API has request and response attributes whose format is specific to each model.

Short description of the changes

  • Extends bedrock service extension to add gen ai attributes for InvokeModel.
    • supported models: Amazon Titan, Amazon Nova, Anthropic Claude, Meta Llama, Cohere Command, Cohere Command R, AI21 Jamba, Mistral AI

@ezhang6811 ezhang6811 requested a review from a team as a code owner April 1, 2025 21:23
@github-actions github-actions bot requested review from blumamir, jj22ee and trivikr April 1, 2025 21:23
@ezhang6811 ezhang6811 changed the title gen ai contributions feat(instrumentation-aws-sdk): add gen ai instrumentation for InvokeModel API Apr 1, 2025
config: AwsSdkInstrumentationConfig
) {
const currentModelId = response.request.commandInput?.modelId;
if (response.data?.body) {
Copy link
Contributor

Choose a reason for hiding this comment

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

If there's no response body should this generate some debug log?

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 don't think we need to since an empty response body would not necessarily indicate broken client behavior, though I can't imagine an instance of this occurring.

@ezhang6811 ezhang6811 force-pushed the zhaez/gen-ai-support branch from d8adc04 to be0b075 Compare April 14, 2025 20:15
Copy link
Contributor

Choose a reason for hiding this comment

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

Can you also undo the changes to package-lock.json, since there are no changes to any package.json here.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

should be fixed now.

@ezhang6811 ezhang6811 force-pushed the zhaez/gen-ai-support branch from 16a18d3 to 751edd1 Compare April 15, 2025 17:19
@ezhang6811 ezhang6811 force-pushed the zhaez/gen-ai-support branch from f898864 to aeda8e6 Compare April 15, 2025 17:29
@jj22ee
Copy link
Contributor

jj22ee commented Apr 15, 2025

Tagging @anuraaga since he is also working on features related to bedrock and might be interested, but I don't think your changes will conflict with his anyways.

@pichlermarc pichlermarc added the has:owner-approval Approved by Component Owner label Apr 16, 2025
Copy link

codecov bot commented Apr 16, 2025

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 89.60%. Comparing base (d579630) to head (6cd7c1c).
Report is 2 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff             @@
##             main    #2777      +/-   ##
==========================================
+ Coverage   89.46%   89.60%   +0.14%     
==========================================
  Files         174      174              
  Lines        8322     8450     +128     
  Branches     1592     1660      +68     
==========================================
+ Hits         7445     7572     +127     
- Misses        877      878       +1     
Files with missing lines Coverage Δ
...umentation-aws-sdk/src/services/bedrock-runtime.ts 98.83% <100.00%> (+1.15%) ⬆️
🚀 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.

@pichlermarc
Copy link
Member

@ezhang6811 - looks like the lint step is failing - please also run npm run lint:fix and commit+push the result 🙂

Copy link
Member

@pichlermarc pichlermarc left a comment

Choose a reason for hiding this comment

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

proxy-approving for @jj22ee (component owner)

@pichlermarc pichlermarc merged commit 41d0d4b into open-telemetry:main Apr 17, 2025
10 checks passed
@dyladan dyladan mentioned this pull request Apr 17, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

7 participants