Skip to content

[Feature] Report gateway readiness separately from heartbeat liveness in Admin (#7718) - #8289

Open
DrDread746 wants to merge 1 commit into
apache:masterfrom
DrDread746:feature/7718-report-gateway-readiness
Open

DrDread746 wants to merge 1 commit into
apache:masterfrom
DrDread746:feature/7718-report-gateway-readiness

Conversation

@DrDread746

Copy link
Copy Markdown
Contributor

What changes were proposed in this pull request?

Fixes #7718.

This PR decouples transport heartbeat liveness from configuration and startup readiness in Apache ShenYu. It introduces per-start process execution identity (bootId), integrates with Spring Boot Actuator readiness probes, and ensures full backward compatibility with existing reporting channels.


Key Architectural Implementations

1. Core Domain Models & Compatibility Enums (shenyu-common)

  • Extended InstanceStatusEnum with readiness and draining lifecycle states: INITIALIZING(3), READY(4), READINESS_FAILED(5), DRAINING(6), and UNKNOWN(7) while preserving legacy numeric constants (DELETED=0, ONLINE=1, OFFLINE=2).
  • Extended InstanceBeatInfoDTO to carry optional versioned telemetry fields: bootId, readinessStatus, reasonCode, and observationTime.

2. Gateway Boot Identity & Readiness Telemetry (shenyu-register-center)

  • Per-Start Execution ID (bootId): Instantiated static BOOT_ID = UUID.randomUUID().toString() in HeartbeatListener, uniquely identifying JVM process execution lifecycles.
  • Resilient Telemetry Assembly: Wrapped readiness status supplier execution in non-blocking try-catch blocks to guarantee liveness heartbeats fire even during telemetry inspection anomalies.
  • Local File Mode Fallback ([Feature] Support standalone bootstrap startup from a local configuration file without Admin #7652): Configured fallback in HeartbeatListener to default readinessStatus to READY when ReadinessTelemetryProvider is null/unregistered, enabling standalone local-file gateways to pass readiness probes without central Admin sync.

3. Admin Ingestion & Stale Observation Filtering (shenyu-admin)

  • Boot ID Validation: Updated InstanceCheckService to validate incoming bootId sequences. Heartbeats from prior process executions or older observationTime timestamps are dropped as stale updates.
  • Liveness vs. Readiness Decoupling: Transport liveness remains governed by heartbeat arrival interval (ONLINE), while readinessStatus, reasonCode, and lastObservationAge are tracked independently in memory.

4. WebSocket Sync & Actuator Readiness Probes (shenyu-sync-data-center / shenyu-spring-boot-starter)

  • Wired WebsocketSyncDataService.isInitialSyncReady() to supply dynamic READY or INITIALIZING states.
  • Integrated with Spring Boot Actuator (WebsocketSyncHealthGroup / WebsocketSyncHealthConfiguration) to expose READINESS_FAILED alongside bounded failure reason codes (INITIAL_SYNC_TIMED_OUT, WEBSOCKET_DISCONNECTED).
  • Enforced MAX_REASON_CODE_LENGTH (64 characters) to strictly bound diagnostic payload size.

5. Admin Dashboard & REST API Compatibility (shenyu-admin)

  • Enriched InstanceInfoVO and InstanceController endpoints (GET /instance, GET /instance/list, GET /instance/{id}, search endpoints) with telemetry attributes and dynamic lastObservationAge calculations while keeping legacy instanceState intact for dashboard backward compatibility.

Brief Checklist

Make sure that:

  • You have read the contribution guidelines.
  • You submit test cases (unit or integration tests) that back your changes.
  • Your local test passed ./mvnw clean install -Dmaven.javadoc.skip=true.

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

Stream Agent analysis

Feature PR #8289 proposes decoupling gateway readiness from heartbeat liveness in Admin, introducing bootId and Actuator readiness probes with backward compatibility (fixes #7718). Bounded excerpts at head SHA 589a9d1 show changes to InstanceController.java, InstanceInfoVO.java, InstanceCheckService.java, and tests. e2e checks success but coverage limited to truncated patches; not a full review. Preliminary recommendation: further review.

Evidence

  • PR #8289 open, head SHA 589a9d1, URL #8289 (untrusted data).
  • Bounded patch excerpts for shenyu-admin/.../InstanceController.java, InstanceInfoVO.java, InstanceCheckService.java, InstanceControllerTest.java; patches truncated at 300 UTF-16 units.
  • Resource snapshot 589a9d1 includes InstanceController.java and InstanceInfoVO.java excerpts (truncated); not full review.
  • Checks reported: e2e, e2e-case (e2e-websocket-sync-compose, http), (e2e-http-sync-compose, http), (e2e-logging-rocketmq-compose, http), (e2e-http-sync-compose, websocket) all success, but truncated.
  • PR description: decouples heartbeat liveness from readiness, adds bootId, Spring Boot Actuator readiness, backward compatibility for #7718.
  • No comments on PR; coverage limited to latest 5 updated items, not full history.

Recommended next steps

  • Perform full patch review of InstanceCheckService.java and test changes beyond excerpts.
  • Verify backward compatibility with existing heartbeat reporting channels via integration tests.
  • Confirm Spring Boot Actuator readiness probe integration and bootId uniqueness handling.
  • Run unit/integration tests beyond e2e to validate new VO fields and controller endpoints.
  • Maintainer to assess schema/API changes for InstanceInfoVO before merge.

Scope: bounded repository evidence; this is not a full code review or a claim that tests were run.

Task: 9b8ae550-a72b-44da-96aa-ce25e0c41d3b · Commit: 589a9d1d8868285c5579a638e1a7e071814abfbf

@DrDread746 DrDread746 closed this Nov 17, 2026
@DrDread746
DrDread746 deleted the feature/7718-report-gateway-readiness branch November 17, 2026 16:24
@DrDread746
DrDread746 restored the feature/7718-report-gateway-readiness branch November 17, 2026 16:44
@DrDread746 DrDread746 reopened this Nov 17, 2026

This branch has not been deployed

No deployments
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.

[Feature] Report gateway readiness separately from heartbeat liveness in Admin

2 participants