Package org.apache.flink.metrics
Interface MetricGroup
-
- All Known Subinterfaces:
CacheMetricGroup,OperatorCoordinatorMetricGroup,OperatorIOMetricGroup,OperatorMetricGroup,SinkCommitterMetricGroup,SinkWriterMetricGroup,SourceReaderMetricGroup,SourceSplitMetricGroup,SplitEnumeratorMetricGroup
- All Known Implementing Classes:
UnregisteredMetricsGroup
@Public public interface MetricGroupA MetricGroup is a named container forMetricsand 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 voidaddEvent(EventBuilder eventBuilder)default MetricGroupaddGroup(int name)Creates a new MetricGroup and adds it to this groups sub-groups.MetricGroupaddGroup(String name)Creates a new MetricGroup and adds it to this groups sub-groups.MetricGroupaddGroup(String key, String value)Creates a new key-value MetricGroup pair.default voidaddSpan(SpanBuilder spanBuilder)default Countercounter(int name)Creates and registers a newCounterwith Flink.default <C extends Counter>
Ccounter(int name, C counter)Registers aCounterwith Flink.Countercounter(String name)Creates and registers a newCounterwith Flink.<C extends Counter>
Ccounter(String name, C counter)Registers aCounterwith Flink.default <T,G extends Gauge<T>>
Ggauge(int name, G gauge)Registers a newGaugewith Flink.<T,G extends Gauge<T>>
Ggauge(String name, G gauge)Registers a newGaugewith Flink.Map<String,String>getAllVariables()Returns a map of all variables and their associated value, for example{"<host>"="host-7", "<tm_id>"="taskmanager-2"}.StringgetMetricIdentifier(String metricName)Returns the fully qualified metric name, for example"host-7.taskmanager-2.window_word_count.my-mapper.metricName".StringgetMetricIdentifier(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 newHistogramwith Flink.<H extends Histogram>
Hhistogram(String name, H histogram)Registers a newHistogramwith Flink.default <M extends Meter>
Mmeter(int name, M meter)Registers a newMeterwith Flink.<M extends Meter>
Mmeter(String name, M meter)Registers a newMeterwith Flink.
-
-
-
Method Detail
-
addSpan
@Experimental default void addSpan(SpanBuilder spanBuilder)
-
addEvent
@Experimental default void addEvent(EventBuilder eventBuilder)
-
counter
default Counter counter(int name)
Creates and registers a newCounterwith Flink.- Parameters:
name- name of the counter- Returns:
- the created counter
-
counter
Counter counter(String name)
Creates and registers a newCounterwith Flink.- Parameters:
name- name of the counter- Returns:
- the created counter
-
counter
default <C extends Counter> C counter(int name, C counter)
Registers aCounterwith 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 aCounterwith 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 newGaugewith 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 newGaugewith 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 newHistogramwith 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 newHistogramwith 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 newMeterwith 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 newMeterwith 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
-
-