spuru9 opened a new pull request, #28564:
URL: https://github.com/apache/flink/pull/28564
## What is the purpose of the change
This pull request surfaces the TaskManager **process's own** resource usage
(CPU, memory and disk I/O) as Flink metrics and displays them on the
TaskManager Web UI.
When `metrics.system-resource` is enabled, `SystemResourcesCounter` now
additionally collects the TaskManager process's CPU usage, resident set size
and disk bytes read/written via OSHI, exposing them as the `Process.CPU.Usage`,
`Process.Memory.RSS`, `Process.IO.Read` and `Process.IO.Write` gauges. A new
"Process Usage" panel on the TaskManager metrics page renders these values.
## Brief change log
- `SystemResourcesCounter` collects per-process CPU usage, RSS and disk
read/written bytes via OSHI
- `SystemResourcesMetricsInitializer` registers the new `Process.*` gauges
- Added a "Process Usage" panel to the TaskManager metrics page in the Web
UI, querying the new gauges over the REST API
- Documented the new metrics in `docs/content/docs/ops/metrics.md` and the
zh translation
## Verifying this change
This change added unit-test coverage in `SystemResourcesCounterTest` and can
additionally be verified as follows:
- Start a cluster with `metrics.system-resource: true`, open the
TaskManager metrics page and confirm the new "Process Usage" panel shows CPU,
memory (RSS) and combined I/O.
Note: per-process I/O is only populated on platforms where OSHI supports it
(e.g. Linux via `/proc`); on macOS these counters report 0.
## Does this pull request potentially affect one of the following parts:
- Dependencies (does it add or upgrade a dependency): **no** (OSHI is
already a Flink dependency)
- The public API, i.e., is any changed class annotated with
`@Public(Evolving)`: **no**
- The serializers: **no**
- The runtime per-record code paths (performance sensitive): **no**
- Anything that affects deployment or recovery: JobManager (and its
components), Checkpointing, Kubernetes/Yarn, ZooKeeper: **no**
- The S3 file system connector: **no**
## Documentation
- Does this pull request introduce a new feature? **yes**
- If yes, how is the feature documented? **docs** (`metrics.md`, en + zh)
---
##### Was generative AI tooling used to co-author this PR?
- [X] Yes (Claude Code)
Generated-by: Claude Code
--
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]