Skip to content

Conversation

skartikey
Copy link
Contributor

Summary

This change ensures safe handling when only one of StatisticInclude or StatisticExclude is non-nil, preventing a nil pointer dereference that was causing a panic.

Background
The bug stemmed from not accounting for all possible nil combinations of these two pointers. The existing if condition only handled the case where both were nil, but the else block did not properly handle scenarios where only one was set. This fix explicitly checks each pointer before dereferencing.

Checklist

  • No AI generated code was used in this PR

Related issues

resolves #16779

@telegraf-tiger telegraf-tiger bot added fix pr to fix corresponding bug plugin/input 1. Request for new input plugins 2. Issues/PRs that are related to input plugins labels Apr 16, 2025
Copy link
Member

@srebhan srebhan left a comment

Choose a reason for hiding this comment

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

Thanks @skartikey!

@srebhan srebhan changed the title fix(inputs.cloudwatch): Handle nil include/exclude stats to prevent panic fix(inputs.cloudwatch): Handle metric includes/excludes correctly to prevent panic Apr 17, 2025
@srebhan srebhan removed their assignment Apr 17, 2025
@srebhan srebhan added ready for final review This pull request has been reviewed and/or tested by multiple users and is ready for a final review. area/aws AWS plugins including cloudwatch, ecs, kinesis labels Apr 17, 2025
@mstrandboge mstrandboge merged commit fc7d1ff into influxdata:master Apr 21, 2025
25 of 26 checks passed
@github-actions github-actions bot added this to the v1.34.3 milestone Apr 21, 2025
srebhan pushed a commit that referenced this pull request May 5, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area/aws AWS plugins including cloudwatch, ecs, kinesis fix pr to fix corresponding bug plugin/input 1. Request for new input plugins 2. Issues/PRs that are related to input plugins ready for final review This pull request has been reviewed and/or tested by multiple users and is ready for a final review.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Telegraf PANIC when Cloudwatch is configured with an Activities Include, but not an Exclude
3 participants