Skip to content

feat(server-utils): Add orchestrion aws-sdk channel integration#22142

Draft
andreiborza wants to merge 1 commit into
developfrom
ab/aws-sdk-server-utils
Draft

feat(server-utils): Add orchestrion aws-sdk channel integration#22142
andreiborza wants to merge 1 commit into
developfrom
ab/aws-sdk-server-utils

Conversation

@andreiborza

Copy link
Copy Markdown
Member

Before submitting a pull request, please take a look at our
Contributing guidelines and verify:

  • If you've added code that should be tested, please add tests.
  • Ensure your code lints and the test suite passes (yarn lint) & (yarn test).
  • Link an issue if there is one related to your pull request. If no issue is linked, one will be auto-generated and linked.

Closes #issue_link_here

Adds an OTel-free, orchestrion diagnostics-channel implementation of the aws-sdk
(v3) instrumentation to `@sentry/server-utils`.

The integration subscribes to the `orchestrion:<smithy-pkg>:send` channels the
transform injects into the smithy `Client.prototype.send`
(`@smithy/core`, `@smithy/smithy-client`, `@aws-sdk/smithy-client`) and emits the
same spans as the OTel `@opentelemetry/instrumentation-aws-sdk` integration for
every service (S3, DynamoDB, SQS, SNS, Lambda, Kinesis, SecretsManager,
StepFunctions, Bedrock), with a distinct `auto.aws.orchestrion.aws-sdk` origin.
SQS/SNS/Lambda trace propagation uses Sentry-native `sentry-trace`/`baggage`
headers instead of OTel `propagation.inject`.

Registered in `channelIntegrations`, so it is reachable via `@sentry/node`'s
`experimentalUseDiagnosticsChannelInjection()`. No default behavior changes yet;
the `@sentry/aws-serverless` swap follows in the next PR.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>

@cursor cursor Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Cursor Bugbot has reviewed your changes and found 6 potential issues.

Fix All in Cursor

❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.

Reviewed by Cursor Bugbot for commit 6b85478. Configure here.

}

if (request.commandInput?.body) {
const requestBody = JSON.parse(request.commandInput.body);

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Binary invoke body parse fails

Medium Severity

InvokeModel request instrumentation calls JSON.parse on commandInput.body directly, while the response path decodes with TextDecoder first. AWS SDK v3 typically supplies the body as Uint8Array/Buffer, so parsing often throws inside safe(), and no span is created for those calls.

Fix in Cursor Fix in Web

Reviewed by Cursor Bugbot for commit 6b85478. Configure here.


if (request.commandInput?.body) {
const requestBody = JSON.parse(request.commandInput.body);
if (modelId.includes('amazon.titan')) {

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

modelId guard missing on includes

Medium Severity

Bedrock hooks call modelId.includes(...) / currentModelId.includes(...) inside branches where body or response data exists, but modelId can still be undefined. That throws inside safe(), skipping span creation or response attributes for otherwise valid calls.

Additional Locations (1)
Fix in Cursor Fix in Web

Reviewed by Cursor Bugbot for commit 6b85478. Configure here.

const modelId = response.request.commandInput?.modelId;
if (!stream || !modelId) {
return;
}

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Stream span never ends

High Severity

For InvokeModelWithResponseStream, when isStream is set the channel integration defers span end, but _responseHookInvokeModelWithResponseStream returns early if stream or modelId is missing without calling span.end(). Those spans stay open indefinitely.

Fix in Cursor Fix in Web

Reviewed by Cursor Bugbot for commit 6b85478. Configure here.

...extractAttributesFromNormalizedRequest(normalizedRequest),
...requestMetadata.spanAttributes,
},
});

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Missing sentry.op on spans

Medium Severity

AWS channel spans are started with startInactiveSpan and SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN, but no sentry.op (via op or SEMANTIC_ATTRIBUTE_SENTRY_OP), unlike peer orchestrion integrations such as ioredis and anthropic.

Fix in Cursor Fix in Web

Triggered by project rule: PR Review Guidelines for Cursor Bot

Reviewed by Cursor Bugbot for commit 6b85478. Configure here.

*
* @experimental
*/
export const awsChannelIntegration = defineIntegration(_awsChannelIntegration);

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

No integration tests added

Low Severity

This feature PR adds a large new orchestrion AWS SDK channel integration but the diff includes no unit, integration, or E2E test covering span creation, propagation, or service-specific hooks.

Fix in Cursor Fix in Web

Triggered by project rule: PR Review Guidelines for Cursor Bot

Reviewed by Cursor Bugbot for commit 6b85478. Configure here.


if (Object.keys(attributes).length + headerKeys.length <= MAX_MESSAGE_ATTRIBUTES) {
for (const key of headerKeys) {
(attributes as AwsSdkContextObject)[key] = { DataType: 'String', StringValue: headers[key] } as any;

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Unchecked any cast in attributes

Low Severity

injectPropagationContext assigns message attribute entries with as any and no comment explaining why a safer type is not possible.

Fix in Cursor Fix in Web

Triggered by project rule: PR Review Guidelines for Cursor Bot

Reviewed by Cursor Bugbot for commit 6b85478. Configure here.

@github-actions

github-actions Bot commented Jul 9, 2026

Copy link
Copy Markdown
Contributor

size-limit report 📦

Path Size % Change Change
@sentry/browser 27.59 kB - -
@sentry/browser - with treeshaking flags 26.03 kB - -
@sentry/browser (incl. Tracing) 46.34 kB - -
@sentry/browser (incl. Tracing + Span Streaming) 48.13 kB - -
@sentry/browser (incl. Tracing, Profiling) 51.12 kB - -
@sentry/browser (incl. Tracing, Replay) 85.62 kB - -
@sentry/browser (incl. Tracing, Replay) - with treeshaking flags 75.26 kB - -
@sentry/browser (incl. Tracing, Replay with Canvas) 90.32 kB - -
@sentry/browser (incl. Tracing, Replay, Feedback) 102.97 kB - -
@sentry/browser (incl. Feedback) 44.76 kB - -
@sentry/browser (incl. sendFeedback) 32.38 kB - -
@sentry/browser (incl. FeedbackAsync) 37.51 kB - -
@sentry/browser (incl. Metrics) 28.67 kB - -
@sentry/browser (incl. Logs) 28.91 kB - -
@sentry/browser (incl. Metrics & Logs) 29.59 kB - -
@sentry/react 29.38 kB - -
@sentry/react (incl. Tracing) 48.61 kB - -
@sentry/vue 33.03 kB - -
@sentry/vue (incl. Tracing) 48.3 kB - -
@sentry/svelte 27.61 kB - -
CDN Bundle 30 kB - -
CDN Bundle (incl. Tracing) 48.32 kB - -
CDN Bundle (incl. Logs, Metrics) 31.57 kB - -
CDN Bundle (incl. Tracing, Logs, Metrics) 49.64 kB - -
CDN Bundle (incl. Replay, Logs, Metrics) 70.81 kB - -
CDN Bundle (incl. Tracing, Replay) 85.84 kB - -
CDN Bundle (incl. Tracing, Replay, Logs, Metrics) 87.14 kB - -
CDN Bundle (incl. Tracing, Replay, Feedback) 91.64 kB - -
CDN Bundle (incl. Tracing, Replay, Feedback, Logs, Metrics) 92.92 kB - -
CDN Bundle - uncompressed 89.35 kB - -
CDN Bundle (incl. Tracing) - uncompressed 146.1 kB - -
CDN Bundle (incl. Logs, Metrics) - uncompressed 94.05 kB - -
CDN Bundle (incl. Tracing, Logs, Metrics) - uncompressed 150.07 kB - -
CDN Bundle (incl. Replay, Logs, Metrics) - uncompressed 218.78 kB - -
CDN Bundle (incl. Tracing, Replay) - uncompressed 265.3 kB - -
CDN Bundle (incl. Tracing, Replay, Logs, Metrics) - uncompressed 269.26 kB - -
CDN Bundle (incl. Tracing, Replay, Feedback) - uncompressed 279 kB - -
CDN Bundle (incl. Tracing, Replay, Feedback, Logs, Metrics) - uncompressed 282.95 kB - -
@sentry/nextjs (client) 51.16 kB - -
@sentry/sveltekit (client) 46.78 kB - -
@sentry/core/server 78.42 kB - -
@sentry/core/browser 64.74 kB - -
@sentry/node-core 62.72 kB - -
@sentry/node 125.37 kB - -
⛔️ @sentry/node (incl. diagnostics channel injection) (max: 142 kB) 143.15 kB +3.33% +4.6 kB 🔺
@sentry/node/import (ESM hook with diagnostics-channel injection) 69.95 kB - -
@sentry/node/light 50.72 kB - -
@sentry/node - without tracing 74.06 kB - -
@sentry/aws-serverless 85.5 kB -0.01% -1 B 🔽
@sentry/cloudflare (withSentry) - minified 181.71 kB - -
@sentry/cloudflare (withSentry) 449.16 kB - -

View base workflow run

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant