[receiver/awscloudwatch] Add tag-based filtering for log group autodiscovery#49419
Draft
taiyo2001 wants to merge 2 commits into
Draft
[receiver/awscloudwatch] Add tag-based filtering for log group autodiscovery#49419taiyo2001 wants to merge 2 commits into
taiyo2001 wants to merge 2 commits into
Conversation
DescribeLogGroups returns two ARN fields for each log group. The Arn field carries the log-stream wildcard suffix ":*", while LogGroupArn is documented by the AWS SDK as the value to use for tagging APIs. ListTagsForResource rejects the ":*" form with a ValidationException, so tag-based autodiscovery fails at runtime against real AWS despite the unit test passing with a non-realistic mock ARN. Switch to lg.LogGroupArn, update the test mock to include both fields, and tighten the assertion so a log group whose tags do not match is verified to be excluded from FilterLogEvents rather than only checking that some record flowed. Rename the chloggen entry to match the surrounding naming convention.
|
Contributor
|
Welcome, contributor! Thank you for your contribution to opentelemetry-collector-contrib. Important reminders:
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
Adds
tagsfilter toreceiver/awscloudwatchautodiscover, selecting log groups by AWS tag key-value pairs (AND semantics). Continues #46282 (closed inactive; takeover approved by @dyl10s in #46237).Fixes the
ValidationException: Invalid resourceArnthe reporter of #46282 hit against real AWS:DescribeLogGroupsreturns two ARNs, andListTagsForResourcerejects the:*suffix onArn— the SDK documentsLogGroupArnas the right field for tagging APIs. #46282's test used a mock ARN without:*, so the bug never surfaced.Log Streams don't support tags at the CloudWatch API level, so this covers log groups only.
Link to tracking issue
Fixes #46237
Supersedes #46282
Testing
TestAutodiscoverTagsreworked: mock ARNs now match real AWS output (Arnwith:*,LogGroupArnwithout), and the test asserts that a non-matching log group is excluded fromFilterLogEvents.go test ./receiver/awscloudwatchreceiver/...passes.aws logs list-tags-for-resourcereturnsValidationExceptionwith the:*ARN and 200 with theLogGroupArn.Documentation
README: new
tagsrow in the autodiscover parameter table and a filtering example..chloggen/entry added.Authorship