dmsolr opened a new pull request, #7878:
URL: https://github.com/apache/shenyu/pull/7878
Fixes #7720
Link Admin instance diagnostics to existing metrics, logs and trace backends
through operator-configured navigation links, instead of storing high-volume
telemetry in heartbeat payloads or the Admin database.
## What is changed
**Correlation metadata (shenyu-common)**
- Report the JVM start time as a boot identity (`bootTime`) in
`SystemInfoUtils.getSystemInfo()`. It rides the existing `instanceInfo` JSON,
so all instance reporting transports (HTTP beat, WebSocket report, HTTP
long-polling) carry it without protocol changes. Older gateways simply omit the
field.
**Admin navigation (shenyu-admin)**
- New `shenyu.observability.*` properties: `metrics-url-template`,
`logs-url-template`, `trace-url-template` for Grafana/Prometheus, logging and
tracing deployments. Supported placeholders: `{namespace}`, `{instanceIp}`,
`{instancePort}`, `{instanceType}`, `{bootTime}`, `{startTime}`, `{endTime}`,
`{startTimeIso}`, `{endTimeIso}`.
- New `InstanceDiagnosticsService` resolves templates with URL-encoded
correlation values and an explicit time window (default: last 15 minutes,
clamped to boot time when the instance booted more recently).
- New endpoint `GET /instance/{id}/diagnostics?startTime=&endTime=` behind
the existing `system:instance:edit` permission; namespace authorization is
unchanged and no access to the destination platform is implied.
**Distinct states instead of broken links**
- `READY` / `NOT_CONFIGURED` (blank template) / `MISSING_INSTANCE_DATA`
(legacy instance without boot identity - never invented) / `INVALID_TEMPLATE`
(non-http(s) scheme, malformed URL, or credentials embedded via userinfo are
rejected and never returned to the dashboard).
## Acceptance criteria mapping
- A test fixture correlates one gateway instance across its status, metrics,
access log and trace links using documented identifiers (namespace,
ip:port@type, bootTime, time window).
- Namespace/instance/time range values are URL-encoded into configured
links; templates embedding credentials are rejected.
- Missing backend configuration and missing instance data have clear states
and do not break the status page or proxy traffic (navigation only, no
telemetry storage, no new metric labels).
- Dashboard (shenyu-dashboard) can consume the stateful link API; frontend
work belongs to that repository.
## Tests
- `InstanceDiagnosticsServiceTest` (9 cases): correlation fixture, URL
encoding, not-configured, legacy instances, unparsable instance info,
credential/non-http/malformed template rejection, not-found, default window +
live heartbeat state merge, boot-time clamping.
- `InstanceControllerTest`: diagnostics endpoint success / time-range /
not-found.
- `SystemInfoUtilsTest`: boot identity is reported and stable.
Make sure that:
- [x] You have read the [contribution
guidelines](https://shenyu.apache.org/community/contributor-guide).
- [x] You submit test cases (unit or integration tests) that back your
changes.
- [x] Your local test passed `./mvnw clean install
-Dmaven.javadoc.skip=true`.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]