Class MetricQueryService
- java.lang.Object
-
- org.apache.flink.runtime.rpc.RpcEndpoint
-
- org.apache.flink.runtime.metrics.dump.MetricQueryService
-
- All Implemented Interfaces:
AutoCloseable
,RpcGateway
,MetricQueryServiceGateway
,AutoCloseableAsync
public class MetricQueryService extends RpcEndpoint implements MetricQueryServiceGateway
The MetricQueryService creates a key-value representation of all metrics currently registered with Flink when queried.It is realized as an actor and can be notified of - an added metric by calling
addMetric(String, Metric, AbstractMetricGroup)
- a removed metric by callingremoveMetric(Metric)
- a metric dump request by callingqueryMetrics(Duration)
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from class org.apache.flink.runtime.rpc.RpcEndpoint
RpcEndpoint.MainThreadExecutor
-
-
Field Summary
Fields Modifier and Type Field Description static String
METRIC_QUERY_SERVICE_NAME
-
Fields inherited from class org.apache.flink.runtime.rpc.RpcEndpoint
log, rpcServer
-
-
Constructor Summary
Constructors Constructor Description MetricQueryService(RpcService rpcService, String endpointId, long messageSizeLimit)
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description void
addMetric(String metricName, Metric metric, AbstractMetricGroup group)
static MetricQueryService
createMetricQueryService(RpcService rpcService, ResourceID resourceID, long maximumFrameSize)
Starts the MetricQueryService actor in the given actor system.CompletableFuture<Void>
onStop()
User overridable callback which is called fromRpcEndpoint.internalCallOnStop()
.CompletableFuture<MetricDumpSerialization.MetricSerializationResult>
queryMetrics(Duration timeout)
void
removeMetric(Metric metric)
-
Methods inherited from class org.apache.flink.runtime.rpc.RpcEndpoint
callAsync, closeAsync, getAddress, getEndpointId, getHostname, getMainThreadExecutor, getMainThreadExecutor, getRpcService, getSelfGateway, getTerminationFuture, internalCallOnStart, internalCallOnStop, isRunning, onStart, registerResource, runAsync, scheduleRunAsync, scheduleRunAsync, start, stop, unregisterResource, validateRunsInMainThread
-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface org.apache.flink.util.AutoCloseableAsync
close
-
Methods inherited from interface org.apache.flink.runtime.rpc.RpcGateway
getAddress, getHostname
-
-
-
-
Field Detail
-
METRIC_QUERY_SERVICE_NAME
public static final String METRIC_QUERY_SERVICE_NAME
- See Also:
- Constant Field Values
-
-
Constructor Detail
-
MetricQueryService
public MetricQueryService(RpcService rpcService, String endpointId, long messageSizeLimit)
-
-
Method Detail
-
onStop
public CompletableFuture<Void> onStop()
Description copied from class:RpcEndpoint
User overridable callback which is called fromRpcEndpoint.internalCallOnStop()
.This method is called when the RpcEndpoint is being shut down. The method is guaranteed to be executed in the main thread context and can be used to clean up internal state.
IMPORTANT: This method should never be called directly by the user.
- Overrides:
onStop
in classRpcEndpoint
- Returns:
- Future which is completed once all post stop actions are completed. If an error occurs this future is completed exceptionally
-
addMetric
public void addMetric(String metricName, Metric metric, AbstractMetricGroup group)
-
removeMetric
public void removeMetric(Metric metric)
-
queryMetrics
public CompletableFuture<MetricDumpSerialization.MetricSerializationResult> queryMetrics(Duration timeout)
- Specified by:
queryMetrics
in interfaceMetricQueryServiceGateway
-
createMetricQueryService
public static MetricQueryService createMetricQueryService(RpcService rpcService, ResourceID resourceID, long maximumFrameSize)
Starts the MetricQueryService actor in the given actor system.- Parameters:
rpcService
- The rpcService running the MetricQueryServiceresourceID
- resource ID to disambiguate the actor name- Returns:
- actor reference to the MetricQueryService
-
-