Skip to content

feat(event-ledger): instance-summary API joining Pod + ICMS lanes - #1119

Open
shobham-nv wants to merge 2 commits into
mainfrom
shobham/816-fnds-instance-summary-api
Open

feat(event-ledger): instance-summary API joining Pod + ICMS lanes#1119
shobham-nv wants to merge 2 commits into
mainfrom
shobham/816-fnds-instance-summary-api

Conversation

@shobham-nv

Copy link
Copy Markdown
Contributor

Summary

Implements #816 (part of epic #809). Adds a read-only endpoint that joins the ICMSRequest lane and the Pod lane on icms_request_id in a single call, without changing ingest. /stats and /events are unchanged.

GET /v3/ledger/namespace/{namespace}/instance-summary?icms_request_id=<id>

Returns outcome (the ICMSRequest-lane summary: latest event + full history) and pod_events (Pod-lane events correlated on icms_request_id).

How the join works

events_v3 can only be queried by (namespace, context), and Pod events carry icms_request_id only in details.attributes. So the join is done on read within a namespace:

  1. GetStatsV3(namespace) lists every context (one partition read).
  2. Contexts whose canonical string contains icms_request_id=<id> are the ICMSRequest lane → folded into outcome (latest event wins).
  3. All other (Pod-lane) contexts are fetched; their events are kept only when details.attributes.icms_request_id == <id>pod_events.

Works for container and helm (MiniService grain), since both Pod lanes stamp icms_request_id into details.

Notes

Test plan

  • go build ./...
  • go vet ./cmd/...
  • gofmt clean
  • go test ./cmd/api/service/... — new: lane join + correlation filtering (excludes unrelated icms_request_id), required join key returns 400, empty namespace returns nil outcome / no pod events

Closes #816

Form the canonical event context based on object kind so ICMSRequest
rows stay distinct from Pod rows. Kind is inferred from the presence of
icms_request_id (or an explicit k8s.object.kind), requiring no collector
changes. Pod context is unchanged, and icms_request_id remains in details
for Pod events.

- Add config-driven kind->context-fields map with built-in defaults
  (Pod: cluster_id, deployment_id, gpu_specification_id, instance_id;
  ICMSRequest: cluster_id, icms_request_id, instance_id).
- Make eventContextToCanonical field-list driven and kind-aware.
- Extend GetEventsV3 to accept an icms_request_id query param.
- Guard stats_v3 upserts so older, out-of-order events cannot overwrite
  a newer latest-per-context row (single LWT and bulk paths).
- Unit tests for kind inference, kind-aware context, and config merge.

Part of epic #809.

Signed-off-by: shobham <shobham@nvidia.com>
Add a read-only GET /v3/ledger/namespace/{namespace}/instance-summary
endpoint that joins the ICMSRequest lane (outcome) and the Pod lane
(pod_events) on icms_request_id in a single call. Ingest is unchanged and
/stats and /events are untouched.

The join is performed on read within a namespace: stats_v3 lists every
context, the ICMSRequest lane carries icms_request_id in its context, and
Pod-lane events carry icms_request_id in details.attributes. This works for
container and helm (MiniService grain) functions.

- Add InstanceSummaryResponse/InstanceOutcome/InstanceSummaryEvent DTOs.
- Add parseCanonicalContext (inverse of eventContextToCanonical) and helpers.
- Register the route behind the existing read scopes and tenant auth.
- Unit tests: lane join + correlation filtering, required join key, no-data.

Part of epic #809.

Signed-off-by: shobham <shobham@nvidia.com>
@shobham-nv
shobham-nv requested a review from a team as a code owner August 24, 2026 11:34
@coderabbitai

coderabbitai Bot commented Aug 24, 2026

Copy link
Copy Markdown

Important

Review skipped

Auto reviews are disabled on base/target branches other than the default branch.

🗂️ Base branches to auto review (1)
  • main

Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Enterprise

Run ID: 97b94252-cd0e-49d2-938b-68b8328765b9

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • 🔍 Trigger review

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

@shobham-nv
shobham-nv changed the base branch from shobham/815-fnds-kind-aware-context to main August 24, 2026 17:08
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.

1 participant