Skip to content

[FLINK-39617] [runtime] Add batch aggregated subtask metrics endpoints - #29012

Open
Jackeyzhe wants to merge 1 commit into
apache:masterfrom
Jackeyzhe:feature/FLINK-39617-batch-subtask-metrics
Open

[FLINK-39617] [runtime] Add batch aggregated subtask metrics endpoints#29012
Jackeyzhe wants to merge 1 commit into
apache:masterfrom
Jackeyzhe:feature/FLINK-39617-batch-subtask-metrics

Conversation

@Jackeyzhe

Copy link
Copy Markdown
Contributor

What is the purpose of the change

This pull request adds batch REST endpoints for retrieving aggregated subtask
metrics across multiple job vertices in a single request.

The existing single-vertex endpoint remains unchanged. The new endpoints are
additive GET endpoints and use query parameters instead of request bodies:

  • /jobs/:jobid/vertices/subtasks/metrics/names?vertices=<vertexIds>&regex=<regex>
  • /jobs/:jobid/vertices/subtasks/metrics/values?vertices=<vertexIds>&get=<metrics>&agg=<aggregations>

The metric name regex parameter uses full Java regex matching, consistent with
the API-shape discussion on FLINK-39617.

Brief change log

  • Added batch aggregated subtask metric name and value REST headers, parameters,
    response body, and handlers.
  • Moved shared metric-store aggregation logic into
    AggregatedMetricsStoreHelper so both existing and batch handlers can reuse
    the same aggregation behavior.
  • Registered the new batch metric handlers in WebMonitorEndpoint.
  • Added focused tests for query parameter parsing, response marshalling,
    handler behavior, invalid input handling, and REST endpoint registration.

Verifying this change

This change added tests and can be verified as follows:

  • ./mvnw -pl flink-runtime -Dtest=AggregatingSubtasksMetricsHandlerTest,AggregatingSubtasksMetricsBatchHandlerTest,AggregatedSubtaskMetricsBatchParametersTest,AggregatedSubtaskMetricsBatchHeadersTest,AggregatedSubtaskMetricsBatchResponseBodyTest,RuntimeRestAPIVersionTest,WebMonitorEndpointTest test

The command above passed locally with 23 tests, 0 failures, 0 errors, and 0
skipped tests. Checkstyle and Spotless also passed in the same Maven run.

Does this pull request potentially affect one of the following parts:

  • Dependencies (does it add or upgrade a dependency): no
  • 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? REST API documentation is generated from the REST message headers and parameters added in this change.

Was generative AI tooling used to co-author this PR?
  • Yes (please specify the tool below)

Generated-by: OpenAI Codex (GPT-5)
The changes were reviewed by a human, and I am responsible for the code quality.

@flinkbot

flinkbot commented Aug 24, 2026

Copy link
Copy Markdown
Collaborator

CI report:

Bot commands The @flinkbot bot supports the following commands:
  • @flinkbot run azure re-run the last Azure build

@Jackeyzhe
Jackeyzhe force-pushed the feature/FLINK-39617-batch-subtask-metrics branch from 42f02c4 to e693747 Compare August 24, 2026 15:48
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