refactor(observability): hide Wirelogs tab unless an environment runs Cilium#650
refactor(observability): hide Wirelogs tab unless an environment runs Cilium#650akila-i wants to merge 2 commits into
Conversation
The component-level Wirelogs tab was always rendered, showing a "Cilium is not configured" banner for core OpenChoreo setups with no Cilium DataPlanes. Hide the tab unless the component's project has at least one environment whose DataPlane runs Cilium (the source of Hubble wirelogs), so core users don't see an unusable tab. - Stamp openchoreo.io/wirelogs-enabled on Component entities during catalog sync (full refresh + event-driven path), derived from project -> pipeline envs -> DataPlane networkpolicyprovider - Gate the Wirelogs tab on the annotation in EntityPage.tsx and align the NFS EntityContentBlueprint filter - Add shared wirelogs util (cilium index + per-project resolver) with unit tests, plus a translation assertion and a changeset Signed-off-by: Akila-I <akila.99g@gmail.com>
Builds on the wirelogs-enabled annotation: instead of waiting for the periodic full sync, react to DataPlane/ClusterDataPlane events so the component Wirelogs tab flips within seconds of a Cilium change. - On a DataPlane event, walk the catalog relation graph (Environment -> DeploymentPipeline -> project -> Component), recompute each affected project's value once, and re-emit only the Components whose openchoreo.io/wirelogs-enabled actually changes - Add a wirelogsEnabledOverride arg to refreshComponent so the cascade reuses the project-level value instead of recomputing per component - Best-effort and guarded: no CatalogService/auth wired, or any error, falls back to the periodic full sync; runs on create/update only - Add EventDeltaApplier tests for the flip and the unchanged (no-op) cases; expand the changeset to cover the event-driven path Signed-off-by: Akila-I <akila.99g@gmail.com>
📝 WalkthroughWalkthroughAdds ChangesWirelogs Cilium-based tab gating
Sequence Diagram(s)sequenceDiagram
participant API as OpenChoreo API
participant Provider as OpenChoreoEntityProvider.runNew()
participant Index as WirelogsCiliumIndex
participant Translate as translateNewComponentToEntity
participant Catalog as Backstage Catalog
Provider->>API: fetch Environments
API-->>Provider: envs with DataPlane refs
Provider->>Index: store envDpRefByNs
Provider->>API: fetch DataPlanes + ClusterDataPlanes
API-->>Provider: dataplanes with Cilium annotations
Provider->>Index: store ciliumByDpKey
Provider->>API: fetch DeploymentPipelines
API-->>Provider: pipelines with promotionPaths
Provider->>Index: store pipelineEnvsByKey
loop per Component
Provider->>Index: projectHasCiliumEnvironment()
Index-->>Provider: wirelogsEnabled boolean
Provider->>Translate: translateNewComponentToEntity(..., wirelogsEnabled)
Translate-->>Provider: Component entity with annotation
end
Provider->>Catalog: upsert Component entities
sequenceDiagram
participant Event as DataPlane event
participant Applier as EventDeltaApplier
participant Catalog as CatalogService
participant API as OpenChoreo API
Event->>Applier: handleEvent(DataPlane change)
Applier->>Applier: refreshDataPlane() → upsert entity
Applier->>Applier: cascadeWirelogsForDataPlane()
Applier->>Catalog: query Environments by DataPlane ref
Catalog-->>Applier: matching Environments
Applier->>Catalog: traverse Env→Pipeline→System→Project relations
Catalog-->>Applier: Project entities
loop per Project
Applier->>API: fetch DeploymentPipeline + Environments + DataPlanes
API-->>Applier: resolved resources
Applier->>Applier: computeWirelogsEnabled()
Applier->>Catalog: query Components in Project
Catalog-->>Applier: Component entities
loop Component annotation flips
Applier->>Applier: refreshComponent(..., wirelogsEnabledOverride)
Applier->>Catalog: upsert Component with updated annotation
end
end
Estimated code review effort🎯 4 (Complex) | ⏱️ ~60 minutes Possibly related PRs
Suggested reviewers
🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches🧪 Generate unit tests (beta)
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. Comment |
Codecov Report❌ Patch coverage is 📢 Thoughts on this report? Let us know! |
|
@CodeRabbit review |
✅ Action performedReview finished.
|
There was a problem hiding this comment.
🧹 Nitpick comments (1)
plugins/catalog-backend-module-openchoreo/src/provider/EventDeltaApplier.ts (1)
487-495: 📐 Maintainability & Code Quality | 🔵 Trivial | 💤 Low valueClarify the doc comment to distinguish computation from cascading.
The sentence "Changes to a DataPlane's Cilium status are picked up by the periodic sync rather than cascaded here" is confusing in the context of a PR whose purpose is to cascade DataPlane changes via events. Consider rephrasing to make it clear that this function is a computation-only helper and does not itself trigger cascades, while
cascadeWirelogsForDataPlanehandles the event-driven propagation.📝 Suggested doc comment revision
/** * Single-component equivalent of the periodic sync's wirelogs gate: returns * true when any environment of the component's project resolves to a * DataPlane running Cilium. Walks project → deployment pipeline → * environments → DataPlanes via the API. Best-effort — any fetch failure - * yields the safe default of `false` (Wirelogs tab hidden); the next full - * sync re-evaluates. Changes to a DataPlane's Cilium status are picked up by - * the periodic sync rather than cascaded here. + * yields the safe default of `false` (Wirelogs tab hidden); the next full + * sync re-evaluates. This is a computation-only helper and does not trigger + * cascades; see `cascadeWirelogsForDataPlane` for event-driven propagation. */🤖 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 `@plugins/catalog-backend-module-openchoreo/src/provider/EventDeltaApplier.ts` around lines 487 - 495, The doc comment for the method (which appears to be a wirelogs gate computation helper) contains confusing language about cascading. Clarify the documentation by revising the sentence about DataPlane Cilium status changes to explicitly state that this function is a computation-only helper that does not trigger cascades itself, and that the event-driven propagation of DataPlane changes is handled separately by the `cascadeWirelogsForDataPlane` function. This will remove ambiguity about the function's role in the event-based change propagation flow.
🤖 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.
Nitpick comments:
In `@plugins/catalog-backend-module-openchoreo/src/provider/EventDeltaApplier.ts`:
- Around line 487-495: The doc comment for the method (which appears to be a
wirelogs gate computation helper) contains confusing language about cascading.
Clarify the documentation by revising the sentence about DataPlane Cilium status
changes to explicitly state that this function is a computation-only helper that
does not trigger cascades itself, and that the event-driven propagation of
DataPlane changes is handled separately by the `cascadeWirelogsForDataPlane`
function. This will remove ambiguity about the function's role in the
event-based change propagation flow.
ℹ️ Review info
⚙️ Run configuration
Configuration used: defaults
Review profile: CHILL
Plan: Pro
Run ID: 17920043-7bbb-45d1-9250-d2caebfd148c
📒 Files selected for processing (11)
.changeset/hide-wirelogs-tab-without-cilium.mdpackages/app/src/components/catalog/EntityPage.tsxplugins/catalog-backend-module-openchoreo/src/provider/EventDeltaApplier.test.tsplugins/catalog-backend-module-openchoreo/src/provider/EventDeltaApplier.tsplugins/catalog-backend-module-openchoreo/src/provider/OpenChoreoEntityProvider.tsplugins/catalog-backend-module-openchoreo/src/utils/entityTranslation.test.tsplugins/catalog-backend-module-openchoreo/src/utils/entityTranslation.tsplugins/catalog-backend-module-openchoreo/src/utils/wirelogs.test.tsplugins/catalog-backend-module-openchoreo/src/utils/wirelogs.tsplugins/openchoreo-common/src/constants.tsplugins/openchoreo-observability/src/alpha.tsx
| * a DataPlane deletion early-returns before this and is reconciled by the | ||
| * full sync. | ||
| */ | ||
| private async cascadeWirelogsForDataPlane( |
There was a problem hiding this comment.
This cascade function only triggers for Dataplane/ClusterDataplane CR changes, what happens if an Environment change the dataplaneRef from a cilium enabled dataplane to a non cilium dataplane? That event will not be captured right ?
Purpose
Wirelogs stream from Cilium Hubble, so the component-level Wirelogs tab is only useful when a project's environments run on a Cilium DataPlane. Today the tab is always rendered and shows a "Cilium is not configured" banner — for a core OpenChoreo setup (no Cilium DataPlanes) that's a dead tab with no usable content. This PR hides the tab unless at least one of the component's project environments is backed by a Cilium DataPlane, and keeps that visibility up to date when a DataPlane's Cilium configuration changes.
Goals
Approach
Stamp at sync time. The catalog provider resolves each project's environments → DataPlanes →
openchoreo.dev/networkpolicyproviderand stampsopenchoreo.io/wirelogs-enabled('true' | 'false') on every Component entity. Covered in both the periodic full sync (OpenChoreoEntityProvider) and the event-driven path (EventDeltaApplier). A small shared util (utils/wirelogs.ts) holds the pure resolver and is unit-tested.Gate the tab. The UI reads the annotation synchronously: an
ifpredicate on the Wirelogs route inEntityPage.tsx(the live render path), with the NFSEntityContentBlueprintfilter kept aligned.Live cascade. On a DataPlane / ClusterDataPlane event, the applier walks the already-synced catalog relation graph (Environment → DeploymentPipeline → project → Component), recomputes each affected project's value once, and re-emits only the Components whose stamped value actually flips. It's best-effort and guarded — with no
CatalogServicewired, or on any error, it falls back to the periodic full sync; it runs on create/update.No upstream change required. The OpenChoreo event-forwarder already emits
updatedevents on annotation-only DataPlane changes (unfiltered informer), so the cascade is triggered without any change toopenchoreo/openchoreo.Screen Recording
Screen.Recording.2026-06-23.at.09.09.35.mov
Verified end-to-end locally: event-forwarder → Backstage events HTTP ingress → cascade → the Wirelogs tab flips on a live Cilium annotation change.
User stories
Release note
Hide the component-level Wirelogs tab unless one of the project's environments runs on a Cilium DataPlane, and update tab visibility live when a DataPlane's Cilium configuration changes.
Documentation
No documentation changes required.
Training
N/A
Certification
N/A
🤖 Generated with Claude Code
Summary by CodeRabbit
New Features
Bug Fixes
Improvements