afedulov commented on a change in pull request #15054:
URL: https://github.com/apache/flink/pull/15054#discussion_r603346290
##########
File path:
flink-runtime/src/main/java/org/apache/flink/runtime/webmonitor/WebMonitorEndpoint.java
##########
@@ -216,6 +227,49 @@ public WebMonitorEndpoint(
this.leaderElectionService =
Preconditions.checkNotNull(leaderElectionService);
this.fatalErrorHandler = Preconditions.checkNotNull(fatalErrorHandler);
+
+ this.threadInfoOperatorTracker = initializeThreadInfoTracker(executor);
+ }
+
+ private ThreadInfoOperatorTracker<OperatorThreadInfoStats>
initializeThreadInfoTracker(
+ ScheduledExecutorService executor) {
+ final Duration akkaTimeout;
+ try {
+ akkaTimeout = AkkaUtils.getTimeout(clusterConfiguration);
+ } catch (NumberFormatException e) {
+ throw new
IllegalConfigurationException(AkkaUtils.formatDurationParsingErrorMessage());
+ }
+
+ final int flameGraphCleanUpInterval =
+
clusterConfiguration.getInteger(WebOptions.FLAMEGRAPH_CLEANUP_INTERVAL);
+ final ThreadInfoRequestCoordinator threadInfoRequestCoordinator =
+ new ThreadInfoRequestCoordinator(executor,
akkaTimeout.toMillis());
+ final ThreadInfoOperatorTracker<OperatorThreadInfoStats>
threadInfoOperatorTracker =
+ ThreadInfoOperatorTracker.newBuilder(
+ resourceManagerRetriever, Function.identity(),
executor)
+ .setCoordinator(threadInfoRequestCoordinator)
+ .setCleanUpInterval(flameGraphCleanUpInterval)
+ .setNumSamples(
+
clusterConfiguration.getInteger(WebOptions.FLAMEGRAPH_NUM_SAMPLES))
+ .setStatsRefreshInterval(
+ clusterConfiguration.getInteger(
+
WebOptions.FLAMEGRAPH_REFRESH_INTERVAL))
+ .setDelayBetweenSamples(
+ Time.milliseconds(
+ clusterConfiguration.getInteger(
+ WebOptions.FLAMEGRAPH_DELAY)))
+ .setMaxThreadInfoDepth(
+ clusterConfiguration.getInteger(
+
WebOptions.FLAMEGRAPH_STACK_TRACE_DEPTH))
+ .build();
+
+ executor.scheduleWithFixedDelay(
Review comment:
I understand this as:
1. pass in the `executor` as it is done now
2. schedule the cleanup in the constructor of the tracker.
Right?
--
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.
For queries about this service, please contact Infrastructure at:
[email protected]