Skip to content

Add messaging v1.43 metrics to AWS Lambda SQS - #19486

Merged
trask merged 4 commits into
trask-migrate-lambda-sqs-messaging-v1-43from
trask-add-lambda-sqs-messaging-metrics
Aug 14, 2026
Merged

trask merged 4 commits into
trask-migrate-lambda-sqs-messaging-v1-43from
trask-add-lambda-sqs-messaging-metrics

Conversation

@trask

@trask trask commented Aug 10, 2026 •

Copy link
Copy Markdown
Member

Adds the v1.43 messaging metrics to AWS Lambda SQS processing, so Lambda functions consuming SQS events now report messaging.process.duration and messaging.client.consumed.messages alongside their existing process spans.

The batch event instrumenter records both metrics, counting every SQS record delivered in the event exactly once. The nested per-message instrumenter records only messaging.process.duration, so consumed messages are not double counted. A processing exception that propagates out adds error.type to both.

Nothing changes on the default path: the new instruments are only created when the stable messaging semantic conventions are enabled, and no spans are affected either way.

Stacked on #19478. Part of #19254.

Copilot AI left a comment

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.

Pull request overview

Adds stable messaging v1.43 process-duration and consumed-message metrics to AWS Lambda SQS instrumentation while preserving existing span behavior.

Changes:

  • Registers process metrics for batch and per-message processing.
  • Records consumed-message counts once per batch.
  • Adds success, failure, default-mode, and topology-aware metric assertions.

Reviewed changes

Copilot reviewed 7 out of 7 changed files in this pull request and generated 1 comment.

Show a summary per file
File Description
AwsLambdaSqsInstrumenterFactory.java Registers stable SQS operation metrics.
AwsLambdaSqsMessageHandlerTest.java Tests nested and failed processing metrics.
AwsLambdaSqsEventWrapperTest.java Tests wrapper-generated metrics.
AwsLambdaSqsEventHandlerTest.java (3.11) Supplies the library instrumentation name.
AwsLambdaSqsMetricsAssertions.java Adds shared metric assertions.
AbstractAwsLambdaSqsEventHandlerTest.java Verifies batch event metrics.
AwsLambdaSqsEventHandlerTest.java (javaagent) Supplies the agent instrumentation name.

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

@trask
trask requested a balanced review from Copilot August 11, 2026 00:16

Copilot AI left a comment

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.

Pull request overview

Copilot reviewed 7 out of 7 changed files in this pull request and generated no new comments.

@trask
trask requested a balanced review from Copilot August 13, 2026 13:04

Copilot AI left a comment

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.

Pull request overview

Copilot reviewed 9 out of 9 changed files in this pull request and generated no new comments.

trask and others added 3 commits August 13, 2026 17:26
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
`hasPointsSatisfying` delegates to AssertJ's `satisfiesExactlyInAnyOrder`,
which already requires the points to match the given assertions and no more.
The separate `satisfies(data -> assertThat(...getPoints()).hasSize(1))` call
therefore asserts nothing that the following `hasPointsSatisfying(...)` does
not already assert.

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
@trask
trask force-pushed the trask-add-lambda-sqs-messaging-metrics branch from 050d81f to 7091dea Compare August 14, 2026 00:26
@trask
trask requested a balanced review from Copilot August 14, 2026 01:13

Copilot AI left a comment

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.

Pull request overview

Copilot reviewed 9 out of 9 changed files in this pull request and generated no new comments.

Review finding:

The new assertMetrics method carries @SuppressWarnings("deprecation") with the comment "using deprecated semconv", but nothing it references is deprecated. Verified against opentelemetry-semconv-incubating 1.43.0-alpha with javap: MessagingIncubatingAttributes.MESSAGING_SYSTEM, MESSAGING_DESTINATION_NAME and MESSAGING_OPERATION_NAME carry no Deprecated attribute, MessagingSystemIncubatingValues and its AWS_SQS constant carry none either, and ErrorAttributes.ERROR_TYPE is stable. The deprecated MESSAGING_OPERATION key, which is what justifies the same suppression on AbstractAwsLambdaSqsEventHandlerTest and on AwsLambdaSqsMessageHandlerTest.processSpans, is never used in this file. The suppression is therefore inert today and its comment is factually wrong, and it will silently swallow any genuine deprecation warning introduced in this method later. Fix: delete the @SuppressWarnings("deprecation") annotation and its comment from assertMetrics.

Analysis: AwsLambdaSqsMetricsAssertions only references non-deprecated symbols. Every semconv key it uses (MESSAGING_SYSTEM, MESSAGING_DESTINATION_NAME, MESSAGING_OPERATION_NAME, MessagingSystemIncubatingValues.AWS_SQS) and the stable ErrorAttributes.ERROR_TYPE carry no Deprecated attribute in the resolved semconv artifacts, and neither do the enclosing classes or the assertion and metric APIs the method calls. The deprecated MESSAGING_OPERATION key that justifies the identical suppression in the sibling span-assertion tests is never used here, so the annotation was inert from the moment the file was added.

Upsides: Removes a suppression whose comment misstates what the code does, and restores deprecation warnings for this method so a future migration to a deprecated API is surfaced rather than silently swallowed.

Downsides: No material downside identified; the module still compiles cleanly without the suppression.

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
@trask
trask requested a balanced review from Copilot August 14, 2026 03:03

Copilot AI left a comment

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.

Pull request overview

Copilot reviewed 9 out of 9 changed files in this pull request and generated no new comments.

@trask
trask marked this pull request as ready for review August 14, 2026 04:01
@trask
trask requested a review from a team as a code owner August 14, 2026 04:01
@opentelemetry-pr-dashboard

opentelemetry-pr-dashboard Bot commented Aug 14, 2026 •

Copy link
Copy Markdown

Pull request dashboard status

Merged · refreshed 2026-08-14 17:24 UTC

Status above doesn't look right?
  • Anything look wrong? Report it with what you expected; it helps us improve the dashboard.

@trask
trask merged commit f3b4a2c into main Aug 14, 2026
100 checks passed
@trask
trask deleted the trask-add-lambda-sqs-messaging-metrics branch August 14, 2026 15:24
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.

3 participants