Skip to content

ref(node): Vendor amqplib instrumentation#21003

Open
nicohrubec wants to merge 6 commits into
developfrom
nh/vendor-amqplib-instrumentation
Open

ref(node): Vendor amqplib instrumentation#21003
nicohrubec wants to merge 6 commits into
developfrom
nh/vendor-amqplib-instrumentation

Conversation

@nicohrubec
Copy link
Copy Markdown
Member

@nicohrubec nicohrubec commented May 19, 2026

Vendors @opentelemetry/instrumentation-amqplib into the SDK with no logic changes. Uses latest upstream v0.65.0 which extends supported versions to include amqplib v1.x. Types from @types/amqplib are inlined as simplified interfaces to avoid requiring the package as a dependency. Adds integration test for amqplib v1.x.

Closes #20144

nicohrubec and others added 3 commits May 19, 2026 14:09
Closes #20144

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Copy link
Copy Markdown

@cursor cursor Bot left a comment

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 1 potential issue.

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 8573651. Configure here.

Comment thread packages/node/src/integrations/tracing/amqplib/vendored/amqplib.ts
v2 is not within the supported version range (>=0.5.5 <2).
The existing test covers v0.10.x, this one covers v1.x.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
@github-actions
Copy link
Copy Markdown
Contributor

github-actions Bot commented May 19, 2026

size-limit report 📦

Path Size % Change Change
@sentry/browser 26.92 kB - -
@sentry/browser - with treeshaking flags 25.35 kB - -
@sentry/browser (incl. Tracing) 44.91 kB - -
@sentry/browser (incl. Tracing + Span Streaming) 47.16 kB - -
@sentry/browser (incl. Tracing, Profiling) 49.91 kB - -
@sentry/browser (incl. Tracing, Replay) 84.54 kB - -
@sentry/browser (incl. Tracing, Replay) - with treeshaking flags 74.04 kB - -
@sentry/browser (incl. Tracing, Replay with Canvas) 89.25 kB - -
@sentry/browser (incl. Tracing, Replay, Feedback) 101.87 kB - -
@sentry/browser (incl. Feedback) 44.1 kB - -
@sentry/browser (incl. sendFeedback) 31.73 kB - -
@sentry/browser (incl. FeedbackAsync) 36.84 kB - -
@sentry/browser (incl. Metrics) 28.01 kB - -
@sentry/browser (incl. Logs) 28.15 kB - -
@sentry/browser (incl. Metrics & Logs) 28.84 kB - -
@sentry/react 28.66 kB - -
@sentry/react (incl. Tracing) 47.16 kB - -
@sentry/vue 31.85 kB - -
@sentry/vue (incl. Tracing) 46.78 kB - -
@sentry/svelte 26.94 kB - -
CDN Bundle 29.34 kB - -
CDN Bundle (incl. Tracing) 47.47 kB - -
CDN Bundle (incl. Logs, Metrics) 30.71 kB - -
CDN Bundle (incl. Tracing, Logs, Metrics) 48.59 kB - -
CDN Bundle (incl. Replay, Logs, Metrics) 70.03 kB - -
CDN Bundle (incl. Tracing, Replay) 84.94 kB - -
CDN Bundle (incl. Tracing, Replay, Logs, Metrics) 86 kB - -
CDN Bundle (incl. Tracing, Replay, Feedback) 90.8 kB - -
CDN Bundle (incl. Tracing, Replay, Feedback, Logs, Metrics) 91.88 kB - -
CDN Bundle - uncompressed 86.46 kB - -
CDN Bundle (incl. Tracing) - uncompressed 142.93 kB - -
CDN Bundle (incl. Logs, Metrics) - uncompressed 90.66 kB - -
CDN Bundle (incl. Tracing, Logs, Metrics) - uncompressed 146.4 kB - -
CDN Bundle (incl. Replay, Logs, Metrics) - uncompressed 215.38 kB - -
CDN Bundle (incl. Tracing, Replay) - uncompressed 261.71 kB - -
CDN Bundle (incl. Tracing, Replay, Logs, Metrics) - uncompressed 265.16 kB - -
CDN Bundle (incl. Tracing, Replay, Feedback) - uncompressed 275.41 kB - -
CDN Bundle (incl. Tracing, Replay, Feedback, Logs, Metrics) - uncompressed 278.85 kB - -
@sentry/nextjs (client) 49.66 kB - -
@sentry/sveltekit (client) 45.4 kB - -
@sentry/core/server 75.75 kB - -
@sentry/core/browser 62.52 kB - -
@sentry/node-core 62.22 kB - -
@sentry/node 166.07 kB -0.41% -671 B 🔽
@sentry/node - without tracing 74.66 kB - -
@sentry/aws-serverless 109.63 kB -0.01% -1 B 🔽
@sentry/cloudflare (withSentry) - minified 171.52 kB - -
@sentry/cloudflare (withSentry) 429.62 kB - -

View base workflow run

nicohrubec and others added 2 commits May 19, 2026 15:07
Avoids conflict with the existing amqplib test's rabbitmq container.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
@nicohrubec nicohrubec marked this pull request as ready for review May 19, 2026 13:46
@nicohrubec nicohrubec requested a review from a team as a code owner May 19, 2026 13:46
Comment on lines +8 to +10
export interface Connection {
connection: { serverProperties: { product?: string; [key: string]: any } };
[key: string]: any;
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Bug: The code accesses conn.serverProperties directly, but the actual amqplib connection object nests this property under conn.connection.serverProperties, causing a TypeError.
Severity: CRITICAL

Suggested Fix

In utils.ts, change the access from conn.serverProperties.product?.toLowerCase?.() to conn.connection.serverProperties.product?.toLowerCase?.() to match the actual structure of the amqplib Connection object.

Prompt for AI Agent
Review the code at the location below. A potential bug has been identified by an AI
agent. Verify if this is a real issue. If it is, propose a fix; if not, explain why it's
not valid.

Location:
packages/node/src/integrations/tracing/amqplib/vendored/amqplib-types.ts#L8-L10

Potential issue: The `getConnectionAttributesFromServer` function in `utils.ts` attempts
to access `conn.serverProperties.product`. However, the `Connection` object from
`amqplib` has a nested structure where server properties are located at
`conn.connection.serverProperties`. Accessing `conn.serverProperties` directly results
in `undefined`, which will cause a `TypeError: Cannot read property 'product' of
undefined` when the code attempts to access the `product` property. This error will
occur every time a RabbitMQ connection is established, crashing the amqplib
instrumentation.

Also affects:

  • packages/node/src/integrations/tracing/amqplib/vendored/utils.ts:105~107

Did we get this right? 👍 / 👎 to inform future reviews.

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.

Vendor @opentelemetry/instrumentation-amqplib

1 participant