Skip to content

Commit 7a58f03

Browse files
committed
add flink kafka metrics reporter
1 parent 1327753 commit 7a58f03

File tree

9 files changed

+801
-0
lines changed

9 files changed

+801
-0
lines changed
Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
### flink-metrics-kafka
2+
3+
compile the module and move the target `flink-metrics-kafka.jar` to flink lib folder, and add metrics reporter configuration in the `flink-config.xml`. eg:
4+
5+
```xml
6+
#==============================================================================
7+
#### Kafka Metrics Reporter
8+
###==============================================================================
9+
10+
metrics.reporter.kafka.class: org.apache.flink.metrics.kafka.KafkaReporter
11+
12+
metrics.reporter.kafka.bootstrapServers: http://localhost:9092
13+
14+
metrics.reporter.kafka.topic: metrics-flink-jobs
15+
16+
metrics.reporter.kafka.acks: 0
17+
18+
metrics.reporter.kafka.compressionType: lz4
19+
20+
metrics.reporter.kafka.bufferMemory: 33554432
21+
22+
metrics.reporter.kafka.retries: 0
23+
24+
metrics.reporter.kafka.batchSize: 16384
25+
26+
metrics.reporter.kafka.lingerMs: 5
27+
28+
metrics.reporter.kafka.maxRequestSize: 1048576
29+
30+
metrics.reporter.kafka.requestTimeoutMs: 30000
31+
32+
```
Lines changed: 97 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,97 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<!--
3+
Licensed to the Apache Software Foundation (ASF) under one
4+
or more contributor license agreements. See the NOTICE file
5+
distributed with this work for additional information
6+
regarding copyright ownership. The ASF licenses this file
7+
to you under the Apache License, Version 2.0 (the
8+
"License"); you may not use this file except in compliance
9+
with the License. You may obtain a copy of the License at
10+
11+
http://www.apache.org/licenses/LICENSE-2.0
12+
13+
Unless required by applicable law or agreed to in writing,
14+
software distributed under the License is distributed on an
15+
"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
16+
KIND, either express or implied. See the License for the
17+
specific language governing permissions and limitations
18+
under the License.
19+
-->
20+
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
21+
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
22+
23+
<modelVersion>4.0.0</modelVersion>
24+
25+
<parent>
26+
<groupId>com.zhisheng.flink</groupId>
27+
<artifactId>flink-metrics</artifactId>
28+
<version>1.0-SNAPSHOT</version>
29+
</parent>
30+
31+
32+
<artifactId>flink-metrics-kafka</artifactId>
33+
34+
<dependencies>
35+
<dependency>
36+
<groupId>org.apache.flink</groupId>
37+
<artifactId>flink-annotations</artifactId>
38+
<version>1.12.0</version>
39+
<scope>provided</scope>
40+
</dependency>
41+
42+
<dependency>
43+
<groupId>org.apache.flink</groupId>
44+
<artifactId>flink-core</artifactId>
45+
<version>1.12.0</version>
46+
<scope>provided</scope>
47+
</dependency>
48+
49+
<dependency>
50+
<groupId>org.apache.flink</groupId>
51+
<artifactId>flink-runtime_${scala.binary.version}</artifactId>
52+
<version>1.12.0</version>
53+
<scope>provided</scope>
54+
</dependency>
55+
56+
<dependency>
57+
<groupId>org.apache.flink</groupId>
58+
<artifactId>flink-metrics-core</artifactId>
59+
<version>1.12.0</version>
60+
<scope>provided</scope>
61+
</dependency>
62+
63+
<dependency>
64+
<groupId>org.apache.kafka</groupId>
65+
<artifactId>kafka-clients</artifactId>
66+
<version>2.4.1</version>
67+
</dependency>
68+
69+
</dependencies>
70+
71+
<build>
72+
<plugins>
73+
<plugin>
74+
<groupId>org.apache.maven.plugins</groupId>
75+
<artifactId>maven-shade-plugin</artifactId>
76+
<executions>
77+
<execution>
78+
<id>shade-flink</id>
79+
<phase>package</phase>
80+
<goals>
81+
<goal>shade</goal>
82+
</goals>
83+
<configuration>
84+
<artifactSet>
85+
<includes>
86+
<include>org.apache.kafka:*</include>
87+
</includes>
88+
</artifactSet>
89+
</configuration>
90+
</execution>
91+
</executions>
92+
</plugin>
93+
</plugins>
94+
</build>
95+
96+
97+
</project>

0 commit comments

Comments
 (0)