Skip to content

Health panel backend#26462

Open
patrickmann wants to merge 12 commits into
masterfrom
poc/system-overview-health-panel
Open

Health panel backend#26462
patrickmann wants to merge 12 commits into
masterfrom
poc/system-overview-health-panel

Conversation

@patrickmann

@patrickmann patrickmann commented Jun 23, 2026

Copy link
Copy Markdown
Contributor

/prd Graylog2/graylog-plugin-enterprise#14591
/nocl

Spec: https://github.com/Graylog2/specs/pull/2

Adding functionality required to support health panel checks. See linked enterprise PR for details.

patrickmann and others added 9 commits June 23, 2026 17:56
Replace the mock health report with a react-query poll against
GET /plugins/org.graylog.plugins.health/cluster, implementing the ?since/204
conditional-poll contract: echo generated_at verbatim, keep the last report on
204, and treat an unsolicited 204 (no ?since sent) as an error. Polling is gated
on the existing ?health=on visibility toggle. useHealthModule/useHealthSummary
now derive from the poll; the HealthModule test mocks the new hook with the
existing mock report fixture.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
The backend now assembles a fresh full report on every request, so the
frontend polls plainly: no ?since=, no 204, no version token. Treat
generated_at as a display-only timestamp.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
…POC)

- Migrate the panel/badge visibility gate from the ?health=on URL toggle to
  the clusterhealth:read permission (Decision 6); register the permission type.
- Re-key the FE copy and mock from the old graylog.* ids to the backend's
  server.* ids so curated copy matches a live report.
- Add the FE-owned unit-noun lookup and id->title overrides (CPU, IdP Sync,
  MongoDB) that follow from the backend shipping no copy map.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
…-health-panel' into poc/system-overview-health-panel
@patrickmann patrickmann changed the title POC health panel Health panel backend Jun 29, 2026
@patrickmann patrickmann marked this pull request as ready for review June 30, 2026 09:48

Copilot AI left a comment

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.

Pull request overview

Adds core server and web-interface support needed for the upcoming “Health panel” feature, including a new polled health report fetch on the frontend and MongoDB timeout/utility improvements on the backend.

Changes:

  • Frontend: switch Health module visibility gating from URL param to clusterhealth:read permission; add useHealthReport polling hook and wire it into the module/summary UI.
  • Frontend: introduce title/unit overrides and align mock report IDs/tests with new backend-emitted IDs.
  • Backend: add client-side operation timeout (CSOT) support and introduce MongoDB utility overloads to propagate “capacity unknown” vs “0% used”.

Reviewed changes

Copilot reviewed 13 out of 14 changed files in this pull request and generated 2 comments.

Show a summary per file
File Description
graylog2-web-interface/src/components/navigation/HealthStatusBadge.tsx Removes URL-param based link behavior; badge links to System Overview directly.
graylog2-web-interface/src/components/health/useHealthReport.ts New react-query polling hook for cluster health report endpoint.
graylog2-web-interface/src/components/health/useHealthModuleVisible.ts Changes visibility gate to permission-based (clusterhealth:read).
graylog2-web-interface/src/components/health/useHealthModule.ts Replaces static mock state with polled report data and adds title overrides.
graylog2-web-interface/src/components/health/mockHealthReport.ts Updates mock IDs/titles to match new naming scheme.
graylog2-web-interface/src/components/health/HealthModule.test.tsx Adjusts tests to mock useHealthReport and updated labels/IDs.
graylog2-web-interface/src/components/health/HealthDetailsPane.tsx Applies title overrides and new “unit noun” logic to count summaries.
graylog2-web-interface/src/components/health/healthCheckDefinitions.ts Renames definition keys; adds unit nouns and title overrides helpers.
graylog2-web-interface/src/@types/graylog-web-plugin/index.d.ts Adds clusterhealth:read permission typing.
graylog2-server/src/test/java/org/graylog2/cluster/nodes/mongodb/MongodbNodeUtilsTest.java New tests covering CSOT overload and capacity=0 behavior.
graylog2-server/src/main/java/org/graylog2/database/MongoEntityCollection.java Implements withTimeout(Duration) on the MongoCollection wrapper.
graylog2-server/src/main/java/org/graylog2/database/MongoCollection.java Adds withTimeout(Duration) to the MongoCollection abstraction.
graylog2-server/src/main/java/org/graylog2/cluster/nodes/mongodb/ReplicaSetMongodbNodes.java Adds memberStates(Duration) for lightweight replica-set membership with CSOT.
graylog2-server/src/main/java/org/graylog2/cluster/nodes/mongodb/MongodbNodeUtils.java Adds CSOT overloads and distinguishes “capacity unknown” via exception propagation.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment on lines +22 to +45

import type { HealthReport } from './HealthReport.types';
import useHealthModuleVisible from './useHealthModuleVisible';

// Pinned literal path -- must match the backend resource (HealthReportResource @Path + HealthModule package).
const HEALTH_REPORT_URL = '/plugins/org.graylog.plugins.health/cluster';
const HEALTH_REPORT_QUERY_KEY = ['health', 'cluster-report'] as const;
const POLL_INTERVAL_MS = 5000;

/**
* Poll for the cluster health report.
*
* The backend assembles a fresh full report on every request, so each poll returns a complete `200`
* body -- there is no conditional polling: no `?since=`, no `204`, no version token. `generated_at` is
* a display timestamp the backend stamps at assembly time; we render it but never echo it back.
*/
const fetchHealthReport = (): Promise<HealthReport> => fetch('GET', qualifyUrl(HEALTH_REPORT_URL));

const useHealthReport = (): UseQueryResult<HealthReport> => {
// Only poll when the feature is enabled, so we don't hit the (license/permission-gated) endpoint for
// every user. Mirrors the visibility gate the consumers already apply before rendering.
const enabled = useHealthModuleVisible();

return useQuery({
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.

3 participants