Package org.apache.flink.metrics
Interface MetricGroup
-
- All Known Subinterfaces:
CacheMetricGroup
,OperatorCoordinatorMetricGroup
,OperatorIOMetricGroup
,OperatorMetricGroup
,SinkCommitterMetricGroup
,SinkWriterMetricGroup
,SourceReaderMetricGroup
,SplitEnumeratorMetricGroup
- All Known Implementing Classes:
AbstractMetricGroup
,ChangelogMaterializationMetricGroup
,ChangelogStorageMetricGroup
,ComponentMetricGroup
,FileMergingMetricGroup
,FrontMetricGroup
,GenericKeyMetricGroup
,GenericMetricGroup
,GenericValueMetricGroup
,InternalCacheMetricGroup
,InternalOperatorCoordinatorMetricGroup
,InternalOperatorIOMetricGroup
,InternalOperatorMetricGroup
,InternalSinkCommitterMetricGroup
,InternalSinkWriterMetricGroup
,InternalSourceReaderMetricGroup
,InternalSplitEnumeratorMetricGroup
,JobManagerJobMetricGroup
,JobManagerMetricGroup
,JobManagerOperatorMetricGroup
,JobMetricGroup
,ProcessMetricGroup
,ProxyMetricGroup
,ResourceManagerMetricGroup
,SlotManagerMetricGroup
,TaskIOMetricGroup
,TaskManagerJobMetricGroup
,TaskManagerMetricGroup
,TaskMetricGroup
,UnregisteredMetricGroups.UnregisteredJobManagerJobMetricGroup
,UnregisteredMetricGroups.UnregisteredJobManagerMetricGroup
,UnregisteredMetricGroups.UnregisteredJobMangerOperatorMetricGroup
,UnregisteredMetricGroups.UnregisteredOperatorMetricGroup
,UnregisteredMetricGroups.UnregisteredProcessMetricGroup
,UnregisteredMetricGroups.UnregisteredResourceManagerMetricGroup
,UnregisteredMetricGroups.UnregisteredSlotManagerMetricGroup
,UnregisteredMetricGroups.UnregisteredTaskManagerJobMetricGroup
,UnregisteredMetricGroups.UnregisteredTaskManagerMetricGroup
,UnregisteredMetricGroups.UnregisteredTaskMetricGroup
,UnregisteredMetricsGroup
@Public public interface MetricGroup
A MetricGroup is a named container forMetrics
and further metric subgroups.Instances of this class can be used to register new metrics with Flink and to create a nested hierarchy based on the group names.
A MetricGroup is uniquely identified by it's place in the hierarchy and name.
-
-
Method Summary
All Methods Instance Methods Abstract Methods Default Methods Modifier and Type Method Description default MetricGroup
addGroup(int name)
Creates a new MetricGroup and adds it to this groups sub-groups.MetricGroup
addGroup(String name)
Creates a new MetricGroup and adds it to this groups sub-groups.MetricGroup
addGroup(String key, String value)
Creates a new key-value MetricGroup pair.default void
addSpan(SpanBuilder spanBuilder)
default Counter
counter(int name)
Creates and registers a newCounter
with Flink.default <C extends Counter>
Ccounter(int name, C counter)
Registers aCounter
with Flink.Counter
counter(String name)
Creates and registers a newCounter
with Flink.<C extends Counter>
Ccounter(String name, C counter)
Registers aCounter
with Flink.default <T,G extends Gauge<T>>
Ggauge(int name, G gauge)
Registers a newGauge
with Flink.<T,G extends Gauge<T>>
Ggauge(String name, G gauge)
Registers a newGauge
with Flink.Map<String,String>
getAllVariables()
Returns a map of all variables and their associated value, for example{"<host>"="host-7", "<tm_id>"="taskmanager-2"}
.String
getMetricIdentifier(String metricName)
Returns the fully qualified metric name, for example"host-7.taskmanager-2.window_word_count.my-mapper.metricName"
.String
getMetricIdentifier(String metricName, CharacterFilter filter)
Returns the fully qualified metric name, for example"host-7.taskmanager-2.window_word_count.my-mapper.metricName"
.String[]
getScopeComponents()
Gets the scope as an array of the scope components, for example["host-7", "taskmanager-2", "window_word_count", "my-mapper"]
.default <H extends Histogram>
Hhistogram(int name, H histogram)
Registers a newHistogram
with Flink.<H extends Histogram>
Hhistogram(String name, H histogram)
Registers a newHistogram
with Flink.default <M extends Meter>
Mmeter(int name, M meter)
Registers a newMeter
with Flink.<M extends Meter>
Mmeter(String name, M meter)
Registers a newMeter
with Flink.
-
-
-
Method Detail
-
addSpan
@Experimental default void addSpan(SpanBuilder spanBuilder)
-
counter
default Counter counter(int name)
Creates and registers a newCounter
with Flink.- Parameters:
name
- name of the counter- Returns:
- the created counter
-
counter
Counter counter(String name)
Creates and registers a newCounter
with Flink.- Parameters:
name
- name of the counter- Returns:
- the created counter
-
counter
default <C extends Counter> C counter(int name, C counter)
Registers aCounter
with Flink.- Type Parameters:
C
- counter type- Parameters:
name
- name of the countercounter
- counter to register- Returns:
- the given counter
-
counter
<C extends Counter> C counter(String name, C counter)
Registers aCounter
with Flink.- Type Parameters:
C
- counter type- Parameters:
name
- name of the countercounter
- counter to register- Returns:
- the given counter
-
gauge
default <T,G extends Gauge<T>> G gauge(int name, G gauge)
Registers a newGauge
with Flink.- Type Parameters:
T
- return type of the gauge- Parameters:
name
- name of the gaugegauge
- gauge to register- Returns:
- the given gauge
-
gauge
<T,G extends Gauge<T>> G gauge(String name, G gauge)
Registers a newGauge
with Flink.- Type Parameters:
T
- return type of the gauge- Parameters:
name
- name of the gaugegauge
- gauge to register- Returns:
- the given gauge
-
histogram
<H extends Histogram> H histogram(String name, H histogram)
Registers a newHistogram
with Flink.- Type Parameters:
H
- histogram type- Parameters:
name
- name of the histogramhistogram
- histogram to register- Returns:
- the registered histogram
-
histogram
default <H extends Histogram> H histogram(int name, H histogram)
Registers a newHistogram
with Flink.- Type Parameters:
H
- histogram type- Parameters:
name
- name of the histogramhistogram
- histogram to register- Returns:
- the registered histogram
-
meter
<M extends Meter> M meter(String name, M meter)
Registers a newMeter
with Flink.- Type Parameters:
M
- meter type- Parameters:
name
- name of the metermeter
- meter to register- Returns:
- the registered meter
-
meter
default <M extends Meter> M meter(int name, M meter)
Registers a newMeter
with Flink.- Type Parameters:
M
- meter type- Parameters:
name
- name of the metermeter
- meter to register- Returns:
- the registered meter
-
addGroup
default MetricGroup addGroup(int name)
Creates a new MetricGroup and adds it to this groups sub-groups.- Parameters:
name
- name of the group- Returns:
- the created group
-
addGroup
MetricGroup addGroup(String name)
Creates a new MetricGroup and adds it to this groups sub-groups.- Parameters:
name
- name of the group- Returns:
- the created group
-
addGroup
MetricGroup addGroup(String key, String value)
Creates a new key-value MetricGroup pair. The key group is added to this groups sub-groups, while the value group is added to the key group's sub-groups. This method returns the value group.The only difference between calling this method and
group.addGroup(key).addGroup(value)
is thatgetAllVariables()
of the value group return an additional"<key>"="value"
pair.- Parameters:
key
- name of the first groupvalue
- name of the second group- Returns:
- the second created group
-
getScopeComponents
String[] getScopeComponents()
Gets the scope as an array of the scope components, for example["host-7", "taskmanager-2", "window_word_count", "my-mapper"]
.
-
getAllVariables
Map<String,String> getAllVariables()
Returns a map of all variables and their associated value, for example{"<host>"="host-7", "<tm_id>"="taskmanager-2"}
.- Returns:
- map of all variables and their associated value
-
getMetricIdentifier
String getMetricIdentifier(String metricName)
Returns the fully qualified metric name, for example"host-7.taskmanager-2.window_word_count.my-mapper.metricName"
.- Parameters:
metricName
- metric name- Returns:
- fully qualified metric name
-
getMetricIdentifier
String getMetricIdentifier(String metricName, CharacterFilter filter)
Returns the fully qualified metric name, for example"host-7.taskmanager-2.window_word_count.my-mapper.metricName"
.- Parameters:
metricName
- metric namefilter
- character filter which is applied to the scope components if not null.- Returns:
- fully qualified metric name
-
-