Skip to content

feat(observability): make project-level log component names clickable#643

Open
kavix wants to merge 11 commits into
openchoreo:mainfrom
kavix:feat/clickable-log-components
Open

feat(observability): make project-level log component names clickable#643
kavix wants to merge 11 commits into
openchoreo:mainfrom
kavix:feat/clickable-log-components

Conversation

@kavix

@kavix kavix commented Jun 18, 2026

Copy link
Copy Markdown

Purpose

Resolves #3436

In the project-level logging view, log records include the component name as plain text. This PR makes the component name a clickable link that navigates directly to that component's logging view, making it much easier to drill down from project logs to component logs.

Goals

  • Make the componentName field in the LogEntry table a clickable React <Link>.
  • Preserve the current time range and relevant filters (e.g., environment, log level) by passing location.search to the target URL.

Approach

  • Updated LogEntry.tsx in openchoreo-observability to wrap the ComponentName field with @backstage/core-components Link.
  • Used useLocation from react-router-dom to dynamically append current URL search params to the target component's route, preserving all active filters and time ranges automatically.
  • Updated LogEntry.test.tsx to wrap the component in a <MemoryRouter> to satisfy react-router-dom hooks.
  • Added a .changeset file for the @openchoreo/backstage-plugin-openchoreo-observability package.

User stories

  • As a developer, when I see an error from component X in the project logs, I want to click the component name to navigate to all of component X's logs without having to manually navigate there or re-apply my filters.

Release note

Added clickable component names in the project-level logging view to seamlessly navigate to component-scoped logs while preserving active filters.

Documentation

N/A - Minor UI improvement to existing logging view.

Training

N/A

Certification

N/A

Marketing

N/A

Automation tests

  • Unit tests

    Updated LogEntry.test.tsx to ensure proper routing context using MemoryRouter. All existing snapshot and behavior tests pass with the new Link structure.

  • Integration tests

    No changes needed.

Security checks

Samples

N/A

Related PRs

None.

Migrations (if applicable)

N/A

Test environment

  • Tested on local k3d developer environment.

Learning

  • Explored how Backstage core components handle routing and query parameter preservation using useLocation.

Summary by CodeRabbit

  • New Features
    • Component names in the project-level logging view are now clickable, taking you to the component-scoped logging view while preserving the current time range, active filters, and URL query parameters.
  • Tests
    • Added/updated test coverage for component-name link rendering and navigation behavior, and improved reliability for confirmation-dialog and SSH key test cases.
  • Chores
    • Reduced noisy React “act” console output during test runs and updated packaging metadata for the test utilities package.

@coderabbitai

coderabbitai Bot commented Jun 18, 2026

Copy link
Copy Markdown

Review Change Stack

Note

Reviews paused

It looks like this branch is under active development. To avoid overwhelming you with review comments due to an influx of new commits, CodeRabbit has automatically paused this review. You can configure this behavior by changing the reviews.auto_review.auto_pause_after_reviewed_commits setting.

Use the following commands to manage reviews:

  • @coderabbitai resume to resume automatic reviews.
  • @coderabbitai review to trigger a single review.

Use the checkboxes below for quick actions:

  • ▶️ Resume reviews
  • 🔍 Trigger review
📝 Walkthrough

Walkthrough

LogEntry now renders the ComponentName cell as a clickable link, and runtime logs pages pass entity metadata through LogsTable. Tests add router context and link assertions, while shared test setup and a few async tests were adjusted for environment and timing behavior.

Changes

Clickable Component Names in Runtime Logs

Layer / File(s) Summary
LogEntry link construction
plugins/openchoreo-observability/src/components/RuntimeLogs/LogEntry.tsx
Adds routing imports, runtime-logs path construction, and optional entityNamespace/entityKind props. ComponentName now renders as a conditional Link that preserves the query string and stops row click propagation.
Runtime logs entity metadata wiring
plugins/openchoreo-observability/src/components/RuntimeLogs/LogsTable.tsx, plugins/openchoreo-observability/src/components/RuntimeLogs/ObservabilityProjectRuntimeLogsPage.tsx, plugins/openchoreo-observability/src/components/RuntimeLogs/ObservabilityRuntimeLogsPage.tsx
LogsTable accepts and forwards entity metadata, and both runtime logs pages supply entityNamespace and entityKind from the current entity.
Router-backed coverage and release note
plugins/openchoreo-observability/src/components/RuntimeLogs/LogEntry.test.tsx, .changeset/clickable-log-components.md
LogEntry tests use MemoryRouter and assert the generated link target, and a changeset marks the observability package for a minor release.

Test Environment Stabilization

Layer / File(s) Summary
Shared React test environment setup
plugins/openchoreo/src/setupTests.ts
Sets IS_REACT_ACT_ENVIRONMENT on available globals and wraps console.error to ignore specific CSS parsing and act-environment messages.
Async test timing and dialog assertions
plugins/openchoreo/src/components/Environments/components/SetupDetailPane.test.tsx, plugins/openchoreo/src/components/Secrets/CreateSecretDialog.test.tsx
Auto-deploy rollback tests now wait for the confirmation dialog to close after confirm, and the SSH private-key test uses an explicit longer timeout.

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~20 minutes

Suggested reviewers

  • sameerajayasoma
  • stefinie123

Poem

🐇 Hop, hop—through logs I dart,
Each component name now links with heart.
Query strings tucked in my fluffy pouch,
Tests stand ready on the couch.
Act alerts hush; the bunny beams,
While runtime logs now follow streams.

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly summarizes the main change: making project-level log component names clickable.
Description check ✅ Passed The description follows the template well and covers purpose, goals, approach, tests, and release notes.
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.
✨ 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.

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

Actionable comments posted: 1

🧹 Nitpick comments (1)
plugins/openchoreo-observability/src/components/RuntimeLogs/LogEntry.test.tsx (1)

52-56: ⚡ Quick win

Add a route-preservation assertion for location.search.

The router wrapper is correct, but this setup still doesn’t protect the core behavior added in LogEntry (carrying query params to the component link). Consider using MemoryRouter initialEntries with a query string and asserting the rendered href includes it.

🤖 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/openchoreo-observability/src/components/RuntimeLogs/LogEntry.test.tsx`
around lines 52 - 56, The MemoryRouter wrapper in the render function needs to
be configured to pass a query string via initialEntries, and the test needs an
assertion to verify that the rendered LogEntry component's link href includes
those query parameters. Modify the MemoryRouter to include an initialEntries
prop with a URL containing a query string (e.g., path with ?param=value), then
add an assertion that checks the href attribute of the rendered link element in
LogEntry includes that query string parameter to ensure the component properly
preserves route search parameters.
🤖 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.

Inline comments:
In `@plugins/openchoreo-observability/src/components/RuntimeLogs/LogEntry.tsx`:
- Line 155: The route being built in the `to` prop at line 155 hardcodes
`default/component` in the URL path, but the runtime-logs route requires dynamic
namespace and kind values to work correctly for entities outside the default
namespace. Replace the hardcoded `default/component` with actual entityNamespace
and entityKind values obtained from parent context or a canonical entity
reference, using `default/component` only as an explicit fallback when these
values are not available. This ensures the navigation route correctly matches
the entity's actual namespace and kind.

---

Nitpick comments:
In
`@plugins/openchoreo-observability/src/components/RuntimeLogs/LogEntry.test.tsx`:
- Around line 52-56: The MemoryRouter wrapper in the render function needs to be
configured to pass a query string via initialEntries, and the test needs an
assertion to verify that the rendered LogEntry component's link href includes
those query parameters. Modify the MemoryRouter to include an initialEntries
prop with a URL containing a query string (e.g., path with ?param=value), then
add an assertion that checks the href attribute of the rendered link element in
LogEntry includes that query string parameter to ensure the component properly
preserves route search parameters.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: d556478f-92ec-4957-b67e-e8f0a4dc32e6

📥 Commits

Reviewing files that changed from the base of the PR and between 8381554 and f1d26ab.

📒 Files selected for processing (3)
  • .changeset/clickable-log-components.md
  • plugins/openchoreo-observability/src/components/RuntimeLogs/LogEntry.test.tsx
  • plugins/openchoreo-observability/src/components/RuntimeLogs/LogEntry.tsx

Comment thread plugins/openchoreo-observability/src/components/RuntimeLogs/LogEntry.tsx Outdated
Comment thread plugins/openchoreo-observability/src/components/RuntimeLogs/LogEntry.tsx Outdated
… link and add tests

Signed-off-by: kavix <kavix@yahoo.com>
@kavix
kavix requested a review from stefinie123 June 19, 2026 10:34
@stefinie123

Copy link
Copy Markdown
Contributor

@kavix Tests are failing. Shall we fix the failing tests and update the PR

@kavix
kavix force-pushed the feat/clickable-log-components branch 2 times, most recently from bca59c4 to fdeefdd Compare June 25, 2026 06:54
@kavix

kavix commented Jun 25, 2026

Copy link
Copy Markdown
Author

@stefinie123 Can you check Now?

@stefinie123

stefinie123 commented Jun 26, 2026

Copy link
Copy Markdown
Contributor

@kavix tests and linter are failing again. Run yarn lint and yarn run test <relative path to test> locally to check the issues and fix them

…g noise

Signed-off-by: kavix <kavix@yahoo.com>
@kavix
kavix force-pushed the feat/clickable-log-components branch 2 times, most recently from dfc746c to 79767f8 Compare June 26, 2026 18:55
Fix ESLint failures in the openchoreo plugin.

ESLint Failure 1: @backstage/no-mixed-plugin-imports
- Warning: @openchoreo/backstage-plugin (frontend-plugin) uses forbidden import from @openchoreo/test-utils (node-library).
- Reason for change: Changed the package backstage role of @openchoreo/test-utils from "node-library" to "common-library" (and removed the unused @backstage/backend-test-utils dependency). This permits frontend plugins to import the shared test utilities.

ESLint Failure 2: no-console
- Error: Unexpected console statement in setupTests.ts.
- Reason for change: Added /* eslint-disable no-console */ at the top of setupTests.ts to allow overriding console.error to filter out specific act and CSS parsing test environment warnings.

Signed-off-by: kavix <kavix@yahoo.com>
@kavix
kavix force-pushed the feat/clickable-log-components branch from 79767f8 to ddda7aa Compare June 26, 2026 18:57
kavix added 4 commits July 1, 2026 07:33
…ppage

Signed-off-by: kavix <kavix@yahoo.com>
… entry from test-utils workspace

Signed-off-by: kavix <kavix@yahoo.com>
Signed-off-by: kavix <kavix@yahoo.com>
@kavix
kavix force-pushed the feat/clickable-log-components branch from 74730e4 to 3bbf3b8 Compare July 1, 2026 02:03
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