[flink] Add heartbeat and request-table metrics to TieringSourceEnumerator#3773
Open
XuQianJin-Stars wants to merge 1 commit into
Open
[flink] Add heartbeat and request-table metrics to TieringSourceEnumerator#3773XuQianJin-Stars wants to merge 1 commit into
XuQianJin-Stars wants to merge 1 commit into
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Purpose
TieringSourceEnumeratorin thefluss-flink-commonmodule interacts with thecoordinator via
coordinatorGateway.lakeTieringHeartbeat(...)— pulling newtiering tasks, reporting in-progress / finished / failed / force-finished
tables. Today, when heartbeat transient errors happen or when
requestTablestays empty (i.e. no new tasks returned by the coordinator), operators have to
dig through logs to figure out what's wrong. This PR adds three counters to
make these failure / empty cases observable through standard Flink metrics.
Linked issue: N/A (new observability feature)
Brief change log
Add 3 new metrics in
MetricNames:tiering.heartbeat.failure— number oflakeTieringHeartbeatcalls thatraised an exception.
tiering.request-table.empty— number of heartbeat rounds where thecoordinator returned no available tiering table.
tiering.request-table.failure— number of timesrequestTieringTableSplitsViaHeartBeatended up in the failure branch.Add new
TieringEnumeratorMetricsclass underfluss-flink/fluss-flink-common/src/main/java/org/apache/fluss/flink/tiering/source/metrics/to own the three counters and expose getter accessors. The class reuses
SplitEnumeratorMetricGroup, following the existing metrics-registrationstyle in the same module.
Refactor
TieringSourceEnumerator:waitHeartbeatResponsefrom a private static helper to an instancemethod on the new inner
HeartBeatHelperso the helper can incrementtiering.heartbeat.failureon exception.tiering.request-table.emptywhenLakeTieringHeartbeatResponse.hasTieringTable()returnsfalse.tiering.request-table.failureinsidegenerateAndAssignSplitson the failure path.
Expose
getTieringMetrics()andsetCoordinatorGateway()for tests(package-private; not part of the public API).
Tests
TieringSourceEnumeratorTest#testHeartbeatFailureMetricIncremented— usesa
java.lang.reflect.ProxyCoordinatorGatewaythat always returns afailed
CompletableFutureforlakeTieringHeartbeat, asserts theheartbeatFailurecounter is incremented.TieringSourceEnumeratorTest#testRequestTableEmptyMetricIncremented—uses a proxy gateway that returns an empty
LakeTieringHeartbeatResponse(no
tieringTable), asserts therequestTableEmptycounter is incremented.TieringSourceEnumeratorTest#testRequestTableFailureMetricIncrementedOnGenerateAndAssignSplits— verifies the
requestTableFailurecounter is incremented whengenerateAndAssignSplitsis invoked with a non-nullThrowable.TieringSourceEnumeratorTestcontinue to pass(no regression). Run on the local Fluss cluster via
FlussClusterExtension(3 tablet servers).API and Format
getTieringMetrics,setCoordinatorGateway,waitHeartbeatResponse) are package-private /@VisibleForTestingonly.mvn spotless:applyclean.var, noOptional.isEmpty, noList.of).[component] Brief description.Documentation
org.apache.fluss.metrics.MetricNamesnext to theexisting lake tiering metrics block; their javadoc / naming follows
AGENTS.md §8 Configuration Patterns.
group once the Flink runtime exports them; no additional user-facing
documentation is required beyond the metric names themselves.