Skip to content

refactor(observability): hide Wirelogs tab unless an environment runs Cilium#650

Open
akila-i wants to merge 2 commits into
openchoreo:mainfrom
akila-i:wirelogs-fixes
Open

refactor(observability): hide Wirelogs tab unless an environment runs Cilium#650
akila-i wants to merge 2 commits into
openchoreo:mainfrom
akila-i:wirelogs-fixes

Conversation

@akila-i

@akila-i akila-i commented Jun 23, 2026

Copy link
Copy Markdown
Contributor

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

  • Stop rendering the Wirelogs tab when none of the project's environments can stream wirelogs.
  • Decide tab visibility synchronously from catalog data — no flicker, no extra tab rendered for core users.
  • React to DataPlane Cilium changes within seconds instead of waiting for the periodic full sync.

Approach

  • Stamp at sync time. The catalog provider resolves each project's environments → DataPlanes → openchoreo.dev/networkpolicyprovider and stamps openchoreo.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 if predicate on the Wirelogs route in EntityPage.tsx (the live render path), with the NFS EntityContentBlueprint filter 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 CatalogService wired, 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 updated events on annotation-only DataPlane changes (unfiltered informer), so the cascade is triggered without any change to openchoreo/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

  • As a core OpenChoreo user (no Cilium), I no longer see a Wirelogs tab I can't use — one fewer tab on every component.
  • As an operator enabling Cilium on a DataPlane, the Wirelogs tab appears on the affected projects' components within seconds, without a catalog re-sync.

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

    • Wirelogs tab visibility is now dynamically controlled based on Cilium configuration in the component's environment.
  • Bug Fixes

    • Replaced "Cilium is not configured" message with automatic tab visibility—the tab no longer appears when Cilium is unavailable.
  • Improvements

    • Wirelogs availability automatically synchronizes with environment configuration changes in real-time.

akila-i added 2 commits June 23, 2026 07:00
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>
@coderabbitai

coderabbitai Bot commented Jun 23, 2026

Copy link
Copy Markdown

Review Change Stack

📝 Walkthrough

Walkthrough

Adds openchoreo.io/wirelogs-enabled to CHOREO_ANNOTATIONS and stamps it on Component entities during catalog sync (both periodic full sync and event-driven DataPlane cascades) based on whether any project environment has a Cilium-backed DataPlane. The Wirelogs UI tab is conditionally shown using this annotation.

Changes

Wirelogs Cilium-based tab gating

Layer / File(s) Summary
WIRELOGS_ENABLED annotation constant
plugins/openchoreo-common/src/constants.ts
Adds WIRELOGS_ENABLED: 'openchoreo.io/wirelogs-enabled' to CHOREO_ANNOTATIONS, establishing the shared annotation key used by both the backend sync and the frontend UI.
Wirelogs utility module
plugins/catalog-backend-module-openchoreo/src/utils/wirelogs.ts, plugins/catalog-backend-module-openchoreo/src/utils/wirelogs.test.ts
Introduces CILIUM_NETPOL_PROVIDER_ANNOTATION, dataPlaneRunsCilium, dataPlaneKey, collectPipelineEnvNames, WirelogsCiliumIndex, and projectHasCiliumEnvironment with full Jest coverage.
translateNewComponentToEntity: stamp wirelogs annotation
plugins/catalog-backend-module-openchoreo/src/utils/entityTranslation.ts, ...entityTranslation.test.ts
Adds wirelogsEnabled: boolean = false parameter that stamps openchoreo.io/wirelogs-enabled as 'true'/'false' in entity.metadata.annotations; new test covers both truthy and default cases.
Full sync: build WirelogsCiliumIndex
plugins/catalog-backend-module-openchoreo/src/provider/OpenChoreoEntityProvider.ts
During runNew(), constructs a wirelogsIndex while fetching environments, DataPlanes, ClusterDataPlanes, and pipelines; computes wirelogsEnabled per component and passes it to translation. Removes the now-redundant later ClusterDataPlane fetch.
Event-driven cascade on DataPlane change
plugins/catalog-backend-module-openchoreo/src/provider/EventDeltaApplier.ts, ...EventDeltaApplier.test.ts
Adds computeWirelogsEnabled, collectRelationTargets, and cascadeWirelogsForDataPlane to traverse Environment→Pipeline→Project after any DataPlane refresh, re-emitting only Components whose annotation value flips. refreshComponent gains an optional override to skip recomputation. Two new test cases cover the cascade and the no-op path.
UI: conditional Wirelogs tab
packages/app/src/components/catalog/EntityPage.tsx, plugins/openchoreo-observability/src/alpha.tsx
Adds hasWirelogsEnabled predicate; applies if={hasWirelogsEnabled} to /wirelogs routes for service and generic component pages. Updates the observability plugin blueprint filter to require wirelogs-enabled === 'true'.
Changeset
.changeset/hide-wirelogs-tab-without-cilium.md
Release note documenting the new annotation-driven Wirelogs tab visibility behavior.

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
Loading
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
Loading

Estimated code review effort

🎯 4 (Complex) | ⏱️ ~60 minutes

Possibly related PRs

  • openchoreo/backstage-plugins#604: Modifies the same /wirelogs route in EntityPage.tsx; #604 initially adds the Wirelogs tab, while this PR further gates it behind the openchoreo.io/wirelogs-enabled annotation.

Suggested reviewers

  • sameerajayasoma
  • stefinie123
  • Mirage20
  • kaviththiranga

🐇 A hop through the catalog, a check on the planes,
No Cilium found? The tab quietly wanes.
But when Hubble runs, the annotation flips 'true',
And wirelogs appear in the component's view!
The rabbit stamps annotations with care,
So only the ready components dare to share. 🌿

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Title check ✅ Passed The title accurately and concisely describes the main change: hiding the Wirelogs tab under the condition of no Cilium-backed environments.
Description check ✅ Passed The description comprehensively covers Purpose, Goals, Approach, User stories, and Release note sections; some optional sections like Training and Certification are marked N/A with justification.
Docstring Coverage ✅ Passed Docstring coverage is 100.00% which is sufficient. The required threshold is 80.00%.
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.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ 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

codecov Bot commented Jun 23, 2026

Copy link
Copy Markdown

@akila-i

akila-i commented Jun 23, 2026

Copy link
Copy Markdown
Contributor Author

@CodeRabbit review

@coderabbitai

coderabbitai Bot commented Jun 23, 2026

Copy link
Copy Markdown
✅ Action performed

Review finished.

Note: CodeRabbit is an incremental review system and does not re-review already reviewed commits. This command is applicable only when automatic reviews are paused.

@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.

🧹 Nitpick comments (1)
plugins/catalog-backend-module-openchoreo/src/provider/EventDeltaApplier.ts (1)

487-495: 📐 Maintainability & Code Quality | 🔵 Trivial | 💤 Low value

Clarify 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 cascadeWirelogsForDataPlane handles 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

📥 Commits

Reviewing files that changed from the base of the PR and between ef85b98 and c7b84c8.

📒 Files selected for processing (11)
  • .changeset/hide-wirelogs-tab-without-cilium.md
  • packages/app/src/components/catalog/EntityPage.tsx
  • plugins/catalog-backend-module-openchoreo/src/provider/EventDeltaApplier.test.ts
  • plugins/catalog-backend-module-openchoreo/src/provider/EventDeltaApplier.ts
  • plugins/catalog-backend-module-openchoreo/src/provider/OpenChoreoEntityProvider.ts
  • plugins/catalog-backend-module-openchoreo/src/utils/entityTranslation.test.ts
  • plugins/catalog-backend-module-openchoreo/src/utils/entityTranslation.ts
  • plugins/catalog-backend-module-openchoreo/src/utils/wirelogs.test.ts
  • plugins/catalog-backend-module-openchoreo/src/utils/wirelogs.ts
  • plugins/openchoreo-common/src/constants.ts
  • plugins/openchoreo-observability/src/alpha.tsx

@akila-i akila-i marked this pull request as ready for review June 23, 2026 03:51
* a DataPlane deletion early-returns before this and is reconciled by the
* full sync.
*/
private async cascadeWirelogsForDataPlane(

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

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 ?

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