Skip to content

Comments

fix(logs): correct metric name in metricIncomingLogEvents#37068

Open
abhu85 wants to merge 1 commit intoaws:mainfrom
abhu85:fix/logs-metric-incoming-log-events-36815
Open

fix(logs): correct metric name in metricIncomingLogEvents#37068
abhu85 wants to merge 1 commit intoaws:mainfrom
abhu85:fix/logs-metric-incoming-log-events-36815

Conversation

@abhu85
Copy link

@abhu85 abhu85 commented Feb 24, 2026

Issue # (if applicable)

Closes #36815.

Reason for this change

The metricIncomingLogEvents() method returns a metric with the wrong name 'IncomingLogs' instead of the correct AWS CloudWatch Logs metric name 'IncomingLogEvents'.

This causes users to monitor a non-existent metric, resulting in no data being collected when they expect to see incoming log event counts.

Description of changes

  1. Changed the metric name in metricIncomingLogEvents() from 'IncomingLogs' to 'IncomingLogEvents' to match the actual AWS CloudWatch metric name.

  2. Added unit tests for:

    • metricIncomingLogEvents() - verifies correct metric name
    • metricIncomingBytes() - verifies correct metric name
    • metric() - verifies custom metric name handling

Describe any new or updated permissions being added

None.

Description of how you validated changes

  1. Verified the fix matches the AWS CloudWatch Logs documentation which lists the correct metric name as IncomingLogEvents.

  2. Added unit tests that verify:

    • The metricIncomingLogEvents() method returns a metric with metricName: 'IncomingLogEvents'
    • The metricIncomingBytes() method returns a metric with metricName: 'IncomingBytes'
    • Both use the correct namespace 'AWS/Logs' and default statistic 'Sum'

Checklist


By submitting this pull request, I confirm that my contribution is made under the terms of the Apache-2.0 license

The `metricIncomingLogEvents()` method was returning a metric with name
'IncomingLogs' instead of the correct AWS CloudWatch Logs metric name
'IncomingLogEvents'.

This fix changes the metric name to match the actual AWS CloudWatch
metric name as documented in AWS CloudWatch Logs documentation.

Added unit tests for `metricIncomingLogEvents()`, `metricIncomingBytes()`,
and the base `metric()` method to prevent regression.

Closes aws#36815.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Signed-off-by: abhu85 <60182103+abhu85@users.noreply.github.com>
@aws-cdk-automation aws-cdk-automation requested a review from a team February 24, 2026 13:08
@github-actions github-actions bot added bug This issue is a bug. effort/medium Medium work item – several days of effort p2 beginning-contributor [Pilot] contributed between 0-2 PRs to the CDK labels Feb 24, 2026
Copy link
Collaborator

@aws-cdk-automation aws-cdk-automation left a comment

Choose a reason for hiding this comment

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

The pull request linter fails with the following errors:

❌ Fixes must contain a change to an integration test file and the resulting snapshot.

If you believe this pull request should receive an exemption, please comment and provide a justification. A comment requesting an exemption should contain the text Exemption Request. Additionally, if clarification is needed, add Clarification Request to a comment.

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

Labels

beginning-contributor [Pilot] contributed between 0-2 PRs to the CDK bug This issue is a bug. effort/medium Medium work item – several days of effort p2

Projects

None yet

Development

Successfully merging this pull request may close these issues.

(aws-logs): metricIncomingLogEvents not working

2 participants