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 Details

  • 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 on
      resourceID - resource ID used to disambiguate the actor name
    • getMetricQueryServiceRpcService

      @Nullable public org.apache.flink.runtime.rpc.RpcService getMetricQueryServiceRpcService()
      Returns the rpc service that the MetricQueryService runs in.
      Returns:
      rpc service of hte MetricQueryService
    • getMetricQueryServiceGatewayRpcAddress

      @Nullable public String getMetricQueryServiceGatewayRpcAddress()
      Returns the address under which the MetricQueryService is reachable.
      Specified by:
      getMetricQueryServiceGatewayRpcAddress in interface MetricRegistry
      Returns:
      address of the metric query service
    • getDelimiter

      public char getDelimiter()
      Description copied from interface: MetricRegistry
      Returns the global delimiter.
      Specified by:
      getDelimiter in interface MetricRegistry
      Returns:
      global delimiter
    • getNumberReporters

      public int getNumberReporters()
      Description copied from interface: MetricRegistry
      Returns the number of registered reporters.
      Specified by:
      getNumberReporters in interface MetricRegistry
    • getReporters

      @VisibleForTesting public List<org.apache.flink.metrics.reporter.MetricReporter> getReporters()
    • isShutdown

      public boolean isShutdown()
      Returns whether this registry has been shutdown.
      Returns:
      true, if this registry was shutdown, otherwise false
    • closeAsync

      public CompletableFuture<Void> closeAsync()
      Shuts down this registry and the associated MetricReporter.

      NOTE: This operation is asynchronous and returns a future which is completed once the shutdown operation has been completed.

      Specified by:
      closeAsync in interface org.apache.flink.util.AutoCloseableAsync
      Returns:
      Future which is completed once the MetricRegistryImpl is shut down.
    • getScopeFormats

      public ScopeFormats getScopeFormats()
      Description copied from interface: MetricRegistry
      Returns the scope formats.
      Specified by:
      getScopeFormats in interface MetricRegistry
      Returns:
      scope formats
    • addSpan

      public void addSpan(org.apache.flink.traces.SpanBuilder spanBuilder)
      Description copied from interface: MetricRegistry
      Add and log a Span.
      Specified by:
      addSpan in interface MetricRegistry
    • register

      public void register(org.apache.flink.metrics.Metric metric, String metricName, AbstractMetricGroup group)
      Description copied from interface: MetricRegistry
      Registers a new Metric with this registry.
      Specified by:
      register in interface MetricRegistry
      Parameters:
      metric - the metric that was added
      metricName - the name of the metric
      group - the group that contains the metric
    • unregister

      public void unregister(org.apache.flink.metrics.Metric metric, String metricName, AbstractMetricGroup group)
      Description copied from interface: MetricRegistry
      Un-registers the given Metric with this registry.
      Specified by:
      unregister in interface MetricRegistry
      Parameters:
      metric - the metric that should be removed
      metricName - the name of the metric
      group - the group that contains the metric