Package org.apache.flink.runtime.metrics
Class MetricRegistryImpl
java.lang.Object
org.apache.flink.runtime.metrics.MetricRegistryImpl
- All Implemented Interfaces:
AutoCloseable,MetricRegistry,org.apache.flink.util.AutoCloseableAsync
public class MetricRegistryImpl
extends Object
implements MetricRegistry, org.apache.flink.util.AutoCloseableAsync
A MetricRegistry keeps track of all registered
Metrics. It serves as the
connection between MetricGroups and MetricReporters.-
Constructor Summary
ConstructorsConstructorDescriptionMetricRegistryImpl(MetricRegistryConfiguration config, Collection<ReporterSetup> reporterConfigurations) MetricRegistryImpl(MetricRegistryConfiguration config, Collection<ReporterSetup> reporterConfigurations, Collection<TraceReporterSetup> traceReporterConfigurations) Creates a new MetricRegistry and starts the configured reporter. -
Method Summary
Modifier and TypeMethodDescriptionvoidaddSpan(org.apache.flink.traces.SpanBuilder spanBuilder) Add and log aSpan.Shuts down this registry and the associatedMetricReporter.charReturns the global delimiter.Returns the address under which theMetricQueryServiceis reachable.org.apache.flink.runtime.rpc.RpcServiceReturns the rpc service that theMetricQueryServiceruns in.intReturns the number of registered reporters.List<org.apache.flink.metrics.reporter.MetricReporter>Returns the scope formats.booleanReturns whether this registry has been shutdown.voidregister(org.apache.flink.metrics.Metric metric, String metricName, AbstractMetricGroup group) Registers a newMetricwith this registry.voidstartQueryService(org.apache.flink.runtime.rpc.RpcService rpcService, ResourceID resourceID) Initializes the MetricQueryService.voidunregister(org.apache.flink.metrics.Metric metric, String metricName, AbstractMetricGroup group) Un-registers the givenMetricwith this registry.Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface org.apache.flink.util.AutoCloseableAsync
close
-
Constructor Details
-
MetricRegistryImpl
-
MetricRegistryImpl
public MetricRegistryImpl(MetricRegistryConfiguration config, Collection<ReporterSetup> reporterConfigurations) -
MetricRegistryImpl
public MetricRegistryImpl(MetricRegistryConfiguration config, Collection<ReporterSetup> reporterConfigurations, Collection<TraceReporterSetup> traceReporterConfigurations) Creates a new MetricRegistry and starts the configured reporter.
-
-
Method Details
-
startQueryService
public void startQueryService(org.apache.flink.runtime.rpc.RpcService rpcService, ResourceID resourceID) Initializes the MetricQueryService.- Parameters:
rpcService- RpcService to create the MetricQueryService onresourceID- resource ID used to disambiguate the actor name
-
getMetricQueryServiceRpcService
@Nullable public org.apache.flink.runtime.rpc.RpcService getMetricQueryServiceRpcService()Returns the rpc service that theMetricQueryServiceruns in.- Returns:
- rpc service of hte MetricQueryService
-
getMetricQueryServiceGatewayRpcAddress
Returns the address under which theMetricQueryServiceis reachable.- Specified by:
getMetricQueryServiceGatewayRpcAddressin interfaceMetricRegistry- Returns:
- address of the metric query service
-
getDelimiter
public char getDelimiter()Description copied from interface:MetricRegistryReturns the global delimiter.- Specified by:
getDelimiterin interfaceMetricRegistry- Returns:
- global delimiter
-
getNumberReporters
public int getNumberReporters()Description copied from interface:MetricRegistryReturns the number of registered reporters.- Specified by:
getNumberReportersin interfaceMetricRegistry
-
getReporters
-
isShutdown
public boolean isShutdown()Returns whether this registry has been shutdown.- Returns:
- true, if this registry was shutdown, otherwise false
-
closeAsync
Shuts down this registry and the associatedMetricReporter.NOTE: This operation is asynchronous and returns a future which is completed once the shutdown operation has been completed.
- Specified by:
closeAsyncin interfaceorg.apache.flink.util.AutoCloseableAsync- Returns:
- Future which is completed once the
MetricRegistryImplis shut down.
-
getScopeFormats
Description copied from interface:MetricRegistryReturns the scope formats.- Specified by:
getScopeFormatsin interfaceMetricRegistry- Returns:
- scope formats
-
addSpan
public void addSpan(org.apache.flink.traces.SpanBuilder spanBuilder) Description copied from interface:MetricRegistryAdd and log aSpan.- Specified by:
addSpanin interfaceMetricRegistry
-
register
public void register(org.apache.flink.metrics.Metric metric, String metricName, AbstractMetricGroup group) Description copied from interface:MetricRegistryRegisters a newMetricwith this registry.- Specified by:
registerin interfaceMetricRegistry- Parameters:
metric- the metric that was addedmetricName- the name of the metricgroup- the group that contains the metric
-
unregister
public void unregister(org.apache.flink.metrics.Metric metric, String metricName, AbstractMetricGroup group) Description copied from interface:MetricRegistryUn-registers the givenMetricwith this registry.- Specified by:
unregisterin interfaceMetricRegistry- Parameters:
metric- the metric that should be removedmetricName- the name of the metricgroup- the group that contains the metric
-