Skip to content

[receiver/awscloudwatch] Add tag-based filtering for log group autodiscovery#49419

Draft
taiyo2001 wants to merge 2 commits into
open-telemetry:mainfrom
taiyo2001:feat/awscloudwatch-tag-filter
Draft

[receiver/awscloudwatch] Add tag-based filtering for log group autodiscovery#49419
taiyo2001 wants to merge 2 commits into
open-telemetry:mainfrom
taiyo2001:feat/awscloudwatch-tag-filter

Conversation

@taiyo2001

@taiyo2001 taiyo2001 commented Jul 1, 2026

Copy link
Copy Markdown

Description

Adds tags filter to receiver/awscloudwatch autodiscover, 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 resourceArn the reporter of #46282 hit against real AWS: DescribeLogGroups returns two ARNs, and ListTagsForResource rejects the :* suffix on Arn — the SDK documents LogGroupArn as 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

  • TestAutodiscoverTags reworked: mock ARNs now match real AWS output (Arn with :*, LogGroupArn without), and the test asserts that a non-matching log group is excluded from FilterLogEvents.
  • go test ./receiver/awscloudwatchreceiver/... passes.
  • Verified end-to-end against real AWS: aws logs list-tags-for-resource returns ValidationException with the :* ARN and 200 with the LogGroupArn.

Documentation

README: new tags row in the autodiscover parameter table and a filtering example. .chloggen/ entry added.

Authorship

  • I, a human, wrote this pull request description myself.

schmikei and others added 2 commits July 2, 2026 00:55
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.
@linux-foundation-easycla

Copy link
Copy Markdown

CLA Not Signed

@github-actions github-actions Bot added the first-time contributor PRs made by new contributors label Jul 1, 2026
@github-actions

github-actions Bot commented Jul 1, 2026

Copy link
Copy Markdown
Contributor

Welcome, contributor! Thank you for your contribution to opentelemetry-collector-contrib.

Important reminders:

  • Read our Contributing Guidelines.
  • Sign the CLA if you haven't already.
  • First-time contributors should have at most one PR not marked as draft until their first PR is merged.
  • If your change isn't one of our priority components, reviews may take more time.
  • Give reviewers at least a few days before pinging them for feedback.
  • If you need help or struggle to move your PR forward:

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

Labels

first-time contributor PRs made by new contributors

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Include tag filter for receiver/awscloudwatch group/stream autodiscovery

2 participants