Skip to content

feat: add CloudWatch backed Kubernetes events query support#282

Open
chalindukodikara wants to merge 2 commits into
openchoreo:mainfrom
chalindukodikara:issue-3861_support_event_query
Open

feat: add CloudWatch backed Kubernetes events query support#282
chalindukodikara wants to merge 2 commits into
openchoreo:mainfrom
chalindukodikara:issue-3861_support_event_query

Conversation

@chalindukodikara

@chalindukodikara chalindukodikara commented Jul 10, 2026

Copy link
Copy Markdown
Contributor

Purpose

Enable observability-logs-aws-cloudwatch to query Kubernetes events from CloudWatch Logs, scoped by OpenChoreo component or workflow, with event ingestion handled by observability-events-otel-collector.

Approach

Adds Kubernetes event query support to observability-logs-aws-cloudwatch, backed by CloudWatch Logs Insights. This brings the CloudWatch logs adapter closer to parity with the OpenSearch/OpenObserve logs adapters by implementing:

  • POST /api/v1/events/query
  • Component-scoped event queries using enriched OpenChoreo labels
  • Workflow-scoped event queries using workflow namespace/run name
  • CloudWatch events log group configuration and setup
  • Documentation for event ingestion through observability-events-otel-collector

Related Issues

Include any related issues that are resolved by this PR.

Checklist

  • Tests added or updated (unit, integration, etc.)
  • Samples updated (if applicable)

Remarks

Add any additional context, known issues, or TODOs related to this PR.

Summary by CodeRabbit

  • New Features

    • Added Kubernetes event querying for components and workflows through the observability API.
    • Added configurable event log groups, retention, and optional automatic provisioning.
    • Added support for custom application log group names.
    • Missing event log groups now return empty results instead of errors.
  • Documentation

    • Updated AWS CloudWatch setup, IAM, installation, configuration, and troubleshooting guidance.
    • Added Kubernetes events ingestion and querying instructions.
  • Chores

    • Released version 0.3.0.

Signed-off-by: Chalindu Kodikara <chalindumkodikara@gmail.com>
Signed-off-by: Chalindu Kodikara <chalindumkodikara@gmail.com>
@chalindukodikara chalindukodikara changed the title Add CloudWatch-backed Kubernetes events query support feat: add CloudWatch backed Kubernetes events query support Jul 10, 2026
@coderabbitai

coderabbitai Bot commented Jul 10, 2026

Copy link
Copy Markdown

Review Change Stack

📝 Walkthrough

Walkthrough

Adds Kubernetes events support to the CloudWatch observability adapter, including dedicated log-group configuration and provisioning, component/workflow event queries, a new API handler, deployment wiring, tests, and installation documentation.

Changes

CloudWatch Kubernetes events support

Layer / File(s) Summary
Log group configuration and provisioning
observability-logs-aws-cloudwatch/helm/*, observability-logs-aws-cloudwatch/init/setup-cloudwatch.sh
Adds configurable application and events log groups, optional events provisioning, separate retention settings, and environment wiring.
Event query model and CloudWatch retrieval
observability-logs-aws-cloudwatch/internal/cloudwatch/*, observability-logs-aws-cloudwatch/internal/config*
Adds event types, OTEL field mappings, component/workflow Logs Insights queries, result normalization, missing-log-group handling, and tests.
Events query API and response mapping
observability-logs-aws-cloudwatch/internal/handlers*, observability-logs-aws-cloudwatch/internal/event_handlers_test.go
Adds POST /api/v1/events/query handling for component and workflow scopes, validation, response mapping, error handling, and test doubles.
Deployment wiring and documentation
observability-logs-aws-cloudwatch/README.md, observability-events-otel-collector/README.md, observability-logs-aws-cloudwatch/main.go
Updates startup configuration, chart versioning, IAM policies, collector setup, Pod Identity instructions, restart steps, and configuration references.

Estimated code review effort: 4 (Complex) | ~45 minutes

Sequence Diagram(s)

sequenceDiagram
  participant Client
  participant QueryEvents
  participant CloudWatchClient
  participant CloudWatchLogs
  Client->>QueryEvents: POST /api/v1/events/query
  QueryEvents->>CloudWatchClient: Select component or workflow query
  CloudWatchClient->>CloudWatchLogs: Run Logs Insights query
  CloudWatchLogs-->>CloudWatchClient: Return event rows
  CloudWatchClient-->>QueryEvents: Return normalized EventsResult
  QueryEvents-->>Client: Return events response
Loading

Possibly related PRs

Suggested reviewers: akila-i, nilushancosta

🚥 Pre-merge checks | ✅ 3 | ❌ 2

❌ Failed checks (2 warnings)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 26.83% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
Title check ⚠️ Warning The title is relevant, but it does not follow the required Conventional Commits format. Rewrite it as Conventional Commits, for example: feat(aws-cloudwatch): add Kubernetes events query support.
✅ Passed checks (3 passed)
Check name Status Explanation
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
Description check ✅ Passed The description covers Purpose and Approach well and matches the template structure overall.
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@codecov-commenter

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 86.54709% with 30 lines in your changes missing coverage. Please review.

Files with missing lines Patch % Lines
...rvability-logs-aws-cloudwatch/internal/handlers.go 76.66% 19 Missing and 9 partials ⚠️
observability-logs-aws-cloudwatch/main.go 0.00% 2 Missing ⚠️

📢 Thoughts on this report? Let us know!

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Caution

Some comments are outside the diff and can’t be posted inline due to platform limitations.

⚠️ Outside diff range comments (3)
observability-logs-aws-cloudwatch/README.md (3)

202-209: 📐 Maintainability & Code Quality | 🟡 Minor | ⚡ Quick win

Fix "three paths" to "four paths".

The text says "The CloudWatch adapter needs permissions for three paths:" but now lists four numbered items (including the new "Kubernetes event queries over the events log group").

📝 Proposed fix
-The CloudWatch adapter needs permissions for three paths:
+The CloudWatch adapter needs permissions for four paths:
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@observability-logs-aws-cloudwatch/README.md` around lines 202 - 209, Update
the IAM permissions introduction in the README to state that the CloudWatch
adapter needs permissions for four paths, matching the four numbered items
listed below.

815-821: 📐 Maintainability & Code Quality | 🟡 Minor | ⚡ Quick win

Update "attach both" to reflect three policies.

The static-credentials section says "Create an IAM user and attach both:" but now lists three items: the Adapter IAM policy, the Setup Job IAM policy, and CloudWatchAgentServerPolicy.

📝 Proposed fix
-Create an IAM user and attach both:
+Create an IAM user and attach the following:
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@observability-logs-aws-cloudwatch/README.md` around lines 815 - 821, Update
the Step 2 heading sentence in the README from “attach both” to “attach all
three” so it accurately introduces the Adapter IAM policy, Setup Job IAM policy,
and CloudWatchAgentServerPolicy.

1387-1389: 📐 Maintainability & Code Quality | 🟡 Minor | ⚡ Quick win

Add a v0.3.x compatibility row. The README now uses module version 0.3.0 in the install commands, but the compatibility table still only lists v0.2.x → v1.1.x; add v0.3.x or update the note if 0.3.0 is still tied to v1.1.x.

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@observability-logs-aws-cloudwatch/README.md` around lines 1387 - 1389, Add a
v0.3.x entry to the README compatibility table, mapping it to the appropriate
OpenChoreo version consistent with the v0.3.0 installation commands; if it
remains compatible with v1.1.x, record that mapping explicitly.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Outside diff comments:
In `@observability-logs-aws-cloudwatch/README.md`:
- Around line 202-209: Update the IAM permissions introduction in the README to
state that the CloudWatch adapter needs permissions for four paths, matching the
four numbered items listed below.
- Around line 815-821: Update the Step 2 heading sentence in the README from
“attach both” to “attach all three” so it accurately introduces the Adapter IAM
policy, Setup Job IAM policy, and CloudWatchAgentServerPolicy.
- Around line 1387-1389: Add a v0.3.x entry to the README compatibility table,
mapping it to the appropriate OpenChoreo version consistent with the v0.3.0
installation commands; if it remains compatible with v1.1.x, record that mapping
explicitly.

ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: 462e1cbe-f2c0-4646-806b-5aa603162b12

📥 Commits

Reviewing files that changed from the base of the PR and between 397acdc and ce2d03b.

⛔ Files ignored due to path filters (2)
  • observability-logs-aws-cloudwatch/internal/api/gen/models.gen.go is excluded by !**/gen/**
  • observability-logs-aws-cloudwatch/internal/api/gen/server.gen.go is excluded by !**/gen/**
📒 Files selected for processing (22)
  • observability-events-otel-collector/README.md
  • observability-logs-aws-cloudwatch/Makefile
  • observability-logs-aws-cloudwatch/README.md
  • observability-logs-aws-cloudwatch/VERSION
  • observability-logs-aws-cloudwatch/helm/templates/_helpers.tpl
  • observability-logs-aws-cloudwatch/helm/templates/adapter/configmap.yaml
  • observability-logs-aws-cloudwatch/helm/templates/cloudwatch-setup/job.yaml
  • observability-logs-aws-cloudwatch/helm/values.yaml
  • observability-logs-aws-cloudwatch/init/setup-cloudwatch.sh
  • observability-logs-aws-cloudwatch/internal/cloudwatch/client.go
  • observability-logs-aws-cloudwatch/internal/cloudwatch/event_labels.go
  • observability-logs-aws-cloudwatch/internal/cloudwatch/event_queries.go
  • observability-logs-aws-cloudwatch/internal/cloudwatch/event_queries_test.go
  • observability-logs-aws-cloudwatch/internal/cloudwatch/event_types.go
  • observability-logs-aws-cloudwatch/internal/cloudwatch/events.go
  • observability-logs-aws-cloudwatch/internal/cloudwatch/events_test.go
  • observability-logs-aws-cloudwatch/internal/config.go
  • observability-logs-aws-cloudwatch/internal/config_test.go
  • observability-logs-aws-cloudwatch/internal/event_handlers_test.go
  • observability-logs-aws-cloudwatch/internal/handlers.go
  • observability-logs-aws-cloudwatch/internal/handlers_test.go
  • observability-logs-aws-cloudwatch/main.go

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.

2 participants