Using the OpenTelemetry Collector with Flink [Technical Preview]
The OpenTelemetry metrics reporter makes it easier and more efficient to aggregate Flink jobs' metrics to a central OpenTelemetry-compatible service using open standards.
The following dependencies need to be added to the pom.xml file.
<dependency>
<groupId>io.opentelemetry</groupId>
<artifactId>opentelemetry-sdk-metrics</artifactId>
<version>1.30.0</version>
</dependency>
<dependency>
<groupId>io.opentelemetry</groupId>
<artifactId>opentelemetry-exporter-otlp</artifactId>
<version>1.30.0</version>
</dependency>
After compiling your application you can start collecting metrics with the command line options below.
Add the following command line options to your job to start collecting metrics:
...
-yD metrics.reporters=otel \
-yD metrics.reporter.otel.factory.class=org.apache.flink.metrics.otel.OpenTelemetryMetricReporterFactory \
-yD metrics.reporter.otel.exporter.endpoint=[*** FQDN OR IP ADDRESS ***]:[*** PORT ***] \
-yD metrics.reporter.otel.service.name=[*** SERVICE NAME ***] \
-yD metrics.reporter.otel.service.version=[*** SERVICE VERSION ***] \
...
For more information on using the Flink OpenTelemetry Metrics Reporter, refer to the Apache Flink documentation.