Skip to content

Conversation

lucas-gregoire
Copy link
Contributor

Which problem is this PR solving?

Currently, the amqplib instrumentation only exports legacy attributes.
However, according to the OpenTelemetry specifications, we will have to migrate to new attributes to ensure better compatibility and consistency across tools and libraries.
The v1.36.0+ conventions are not yet stable but will become stable in the future, so I think it's important to begin implementing the export of these new attributes, in order to anticipate the deprecation of the legacy ones, improve interoperability with other tools, and align with community best practices.

Short description of the changes

Adds support for stable semantic conventions in the amqplib instrumentation, controlled by the OTEL_SEMCONV_STABILITY_OPT_IN=messaging environment variable.

Key changes:

  • Updates the instrumentation to use stable span names and attributes.
  • Introduces new tests to validate stable semantic conventions.
  • Updates README with migration guide and semantic conventions for both legacy and stable versions.

I used these specifications for implementing new attributes:

Migration guide

When upgrading to the new semantic conventions, it is recommended to follow this migration path:

  1. Upgrade @opentelemetry/instrumentation-amqplib to the latest version
  2. Enable dual mode: Set OTEL_SEMCONV_STABILITY_OPT_IN=messaging/dup to emit both old and new semantic conventions
  3. Update monitoring: Modify alerts, dashboards, metrics, and other processes to use the new semantic conventions
  4. Switch to stable: Set OTEL_SEMCONV_STABILITY_OPT_IN=messaging to emit only the new semantic conventions

@github-actions github-actions bot requested a review from blumamir August 9, 2025 14:40
@lucas-gregoire lucas-gregoire changed the title Adds stable semantic conventions for AMQP feat(instrumentation-amqp): adds stable semantic conventions Aug 9, 2025
@lucas-gregoire lucas-gregoire marked this pull request as ready for review August 9, 2025 17:36
@lucas-gregoire lucas-gregoire requested a review from a team as a code owner August 9, 2025 17:36
@pichlermarc
Copy link
Member

@lucas-gregoire - looks like the messaging semantic conventions are not actually stable yet, so this PR is blocked until is is formally marked as such.

(Unless this is part of an effort to create prototypes to mark the messaging semconv as stable, if that is the case, please link the corresponding issue from SemConv here, thanks 🙂)

ATTR_MESSAGING_SYSTEM,
MESSAGING_OPERATION_TYPE_VALUE_PROCESS,
MESSAGING_OPERATION_TYPE_VALUE_SEND,
} from '@opentelemetry/semantic-conventions/incubating';
Copy link
Contributor

Choose a reason for hiding this comment

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

Will need to move this to a local "src/semconv.ts" file rather than using the '/incubating' entry-point directly, per https://github.com/open-telemetry/opentelemetry-js/blob/main/semantic-conventions/README.md#unstable-semconv

You can typically used the https://github.com/open-telemetry/opentelemetry-js-contrib/blob/main/scripts/gen-semconv-ts.js tool to generate the src/semconv.ts file.

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

Successfully merging this pull request may close these issues.

4 participants