Flink allows reporting metrics to external systems. For more information about Flink’s metric system go to the metric system documentation.
Metrics can be exposed to an external system by configuring one or several reporters in
reporters will be instantiated on each job and task manager when they are started.
metrics.reporter.<name>.<config>: Generic setting
<config>for the reporter named
metrics.reporter.<name>.class: The reporter class to use for the reporter named
metrics.reporter.<name>.factory.class: The reporter factory class to use for the reporter named
metrics.reporter.<name>.interval: The reporter interval to use for the reporter named
metrics.reporter.<name>.scope.delimiter: The delimiter to use for the identifier (default value use
metrics.scope.delimiter) for the reporter named
metrics.reporter.<name>.scope.variables.excludes: (optional) A semi-colon (;) separate list of variables that should be ignored by tag-based reporters (e.g., Prometheus, InfluxDB).
metrics.reporters: (optional) A comma-separated include list of reporter names. By default all configured reporters will be used.
All reporters must at least have either the
factory.class property. Which property may/should be used depends on the reporter implementation. See the individual reporter configuration sections for more information.
Some reporters (referred to as
Scheduled) allow specifying a reporting
Below more settings specific to each reporter will be listed.
Example reporter configuration that specifies multiple reporters:
Important: The jar containing the reporter must be accessible when Flink is started. Reporters that support the
factory.class property can be loaded as plugins. Otherwise the jar must be placed
in the /lib folder. Reporters that are shipped with Flink (i.e., all reporters documented on this page) are available
You can write your own
Reporter by implementing the
If the Reporter should send out reports regularly you have to implement the
Scheduled interface as well.
By additionally implementing a
MetricReporterFactory your reporter can also be loaded as a plugin.
The following sections list the supported reporters.
You don’t have to include an additional dependency since the JMX reporter is available by default but not activated.
port- (optional) the port on which JMX listens for connections. In order to be able to run several instances of the reporter on one host (e.g. when one TaskManager is colocated with the JobManager) it is advisable to use a port range like
9250-9260. When a range is specified the actual port is shown in the relevant job or task manager log. If this setting is set Flink will start an extra JMX connector for the given port/range. Metrics are always available on the default local JMX interface.
Metrics exposed through JMX are identified by a domain and a list of key-properties, which together form the object name.
The domain always begins with
org.apache.flink followed by a generalized metric identifier. In contrast to the usual
identifier it is not affected by scope-formats, does not contain any variables and is constant across jobs.
An example for such a domain would be
The key-property list contains the values for all variables, regardless of configured scope formats, that are associated
with a given metric.
An example for such a list would be
The domain thus identifies a metric class, while the key-property list identifies one (or multiple) instances of that metric.
host- the Graphite server host
port- the Graphite server port
protocol- protocol to use (TCP/UDP)
In order to use this reporter you must copy
/opt/flink-metrics-influxdb-1.12.3.jar into the
of your Flink distribution.
|10000||Integer||(optional) the InfluxDB connect timeout for metrics|
EnumPossible values: [ALL, ANY, ONE, QUORUM]
|(optional) the InfluxDB consistency level for metrics|
|(none)||String||the InfluxDB database to store metrics|
|(none)||String||the InfluxDB server host|
|(none)||String||(optional) InfluxDB username's password used for authentication|
|8086||Integer||the InfluxDB server port|
|(none)||String||(optional) the InfluxDB retention policy for metrics|
EnumPossible values: [http, https]
|the InfluxDB schema|
|(none)||String||(optional) InfluxDB username used for authentication|
|10000||Integer||(optional) the InfluxDB write timeout for metrics|
The reporter would send metrics using http protocol to the InfluxDB server with the specified retention policy (or the default policy specified on the server). All Flink metrics variables (see List of all Variables) are exported as InfluxDB tags.
port- (optional) the port the Prometheus exporter listens on, defaults to 9249. In order to be able to run several instances of the reporter on one host (e.g. when one TaskManager is colocated with the JobManager) it is advisable to use a port range like
filterLabelValueCharacters- (optional) Specifies whether to filter label value characters. If enabled, all characters not matching [a-zA-Z0-9:_] will be removed, otherwise no characters will be removed. Before disabling this option please ensure that your label values meet the Prometheus requirements.
Flink metric types are mapped to Prometheus metric types as follows:
|Counter||Gauge||Prometheus counters cannot be decremented.|
|Gauge||Gauge||Only numbers and booleans are supported.|
|Histogram||Summary||Quantiles .5, .75, .95, .98, .99 and .999|
|Meter||Gauge||The gauge exports the meter’s rate.|
All Flink metrics variables (see List of all Variables) are exported to Prometheus as labels.
|true||Boolean||Specifies whether to delete metrics from the PushGateway on shutdown.|
|true||Boolean||Specifies whether to filter label value characters. If enabled, all characters not matching [a-zA-Z0-9:_] will be removed, otherwise no characters will be removed. Before disabling this option please ensure that your label values meet the Prometheus requirements.|
|(none)||String||Specifies the grouping key which is the group and global labels of all metrics. The label name and value are separated by '=', and labels are separated by ';', e.g.,
|(none)||String||The PushGateway server host.|
|(none)||String||The job name under which metrics will be pushed|
|-1||Integer||The PushGateway server port.|
|true||Boolean||Specifies whether a random suffix should be appended to the job name.|
The PrometheusPushGatewayReporter pushes metrics to a Pushgateway, which can be scraped by Prometheus.
Please see the Prometheus documentation for use-cases.
host- the StatsD server host
port- the StatsD server port
Note any variables in Flink metrics, such as
will be sent to Datadog as tags. Tags will look like
Note Histograms are exposed as a series of gauges following the naming convention of Datadog histograms (
min aggregation is reported by default, whereas
sum is not available.
In contrast to Datadog-provided Histograms the reported aggregations are not computed for a specific reporting interval.
apikey- the Datadog API key
tags- (optional) the global tags that will be applied to metrics when sending to Datadog. Tags should be separated by comma only
proxyHost- (optional) The proxy host to use when sending to Datadog.
proxyPort- (optional) The proxy port to use when sending to Datadog, defaults to 8080.
dataCenter- (optional) The data center (
US) to connect to, defaults to
maxMetricsPerRequest- (optional) The maximum number of metrics to include in each request, defaults to 2000.