Enable Kafka Producer/Consumer/Stream metrics
- Change bindings input output to allows execution in SCDF. - Update to Boot 2.3.4 to ensure micrometer 1.5.5.
This commit is contained in:
@@ -33,6 +33,19 @@
|
||||
</dependencyManagement>
|
||||
|
||||
<dependencies>
|
||||
<dependency>
|
||||
<groupId>io.micrometer</groupId>
|
||||
<artifactId>micrometer-registry-prometheus</artifactId>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>io.micrometer</groupId>
|
||||
<artifactId>micrometer-registry-wavefront</artifactId>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>io.micrometer.prometheus</groupId>
|
||||
<artifactId>prometheus-rsocket-spring</artifactId>
|
||||
<version>1.2.1</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.springframework.cloud</groupId>
|
||||
<artifactId>spring-cloud-stream-binder-kafka-streams</artifactId>
|
||||
@@ -74,6 +87,27 @@
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
<artifactId>spring-boot-maven-plugin</artifactId>
|
||||
</plugin>
|
||||
<plugin>
|
||||
<groupId>com.google.cloud.tools</groupId>
|
||||
<artifactId>jib-maven-plugin</artifactId>
|
||||
<version>2.5.2</version>
|
||||
<configuration>
|
||||
<from>
|
||||
<image>springcloud/baseimage:1.0.0</image>
|
||||
</from>
|
||||
<to>
|
||||
<image>springcloudstream/${project.artifactId}</image>
|
||||
<tags>
|
||||
<tag>3.0.0-SNAPSHOT</tag>
|
||||
</tags>
|
||||
</to>
|
||||
<container>
|
||||
<creationTime>USE_CURRENT_TIMESTAMP</creationTime>
|
||||
<format>Docker</format>
|
||||
</container>
|
||||
</configuration>
|
||||
</plugin>
|
||||
|
||||
</plugins>
|
||||
</build>
|
||||
|
||||
|
||||
@@ -27,7 +27,6 @@ import org.apache.kafka.streams.KeyValue;
|
||||
import org.apache.kafka.streams.kstream.Grouped;
|
||||
import org.apache.kafka.streams.kstream.KStream;
|
||||
import org.apache.kafka.streams.kstream.Materialized;
|
||||
import org.apache.kafka.streams.kstream.Serialized;
|
||||
import org.apache.kafka.streams.kstream.TimeWindows;
|
||||
|
||||
import org.springframework.boot.SpringApplication;
|
||||
@@ -45,7 +44,7 @@ public class KafkaStreamsWordCountApplication {
|
||||
|
||||
public static final String INPUT_TOPIC = "input";
|
||||
public static final String OUTPUT_TOPIC = "output";
|
||||
public static final int WINDOW_SIZE_MS = 30000;
|
||||
public static final int WINDOW_SIZE_MS = 1000;
|
||||
|
||||
@Bean
|
||||
public Function<KStream<Bytes, String>, KStream<Bytes, WordCount>> process() {
|
||||
|
||||
@@ -1,9 +1,15 @@
|
||||
spring.cloud.stream:
|
||||
bindings:
|
||||
process-in-0:
|
||||
destination: words
|
||||
process-out-0:
|
||||
destination: counts
|
||||
function:
|
||||
definition: process
|
||||
bindings:
|
||||
process-in-0: input
|
||||
process-out-0: output
|
||||
# bindings:
|
||||
# input:
|
||||
# destination: input
|
||||
# output:
|
||||
# destination: output
|
||||
|
||||
kafka:
|
||||
streams:
|
||||
binder:
|
||||
@@ -15,14 +21,23 @@ spring.cloud.stream:
|
||||
value.serde: org.apache.kafka.common.serialization.Serdes$StringSerde
|
||||
#Enable metrics
|
||||
management:
|
||||
metrics:
|
||||
export:
|
||||
wavefront:
|
||||
enabled: false
|
||||
prometheus:
|
||||
enabled: false
|
||||
rsocket:
|
||||
enabled: false
|
||||
endpoint:
|
||||
health:
|
||||
show-details: ALWAYS
|
||||
endpoints:
|
||||
web:
|
||||
exposure:
|
||||
include: metrics,health
|
||||
include: health,info,bindings
|
||||
# include: metrics,health,info,bindings
|
||||
#Enable logging to debug for spring kafka config
|
||||
logging:
|
||||
level:
|
||||
org.springframework.kafka.config: debug
|
||||
#logging:
|
||||
# level:
|
||||
# org.springframework.kafka.config: debug
|
||||
|
||||
@@ -76,7 +76,9 @@ public class WordCountProcessorApplicationTests {
|
||||
final StreamsBuilder builder = new StreamsBuilder();
|
||||
KStream<Bytes, String> input = builder.stream(INPUT_TOPIC, Consumed.with(nullSerde, stringSerde));
|
||||
KafkaStreamsWordCountApplication.WordCountProcessorApplication app = new KafkaStreamsWordCountApplication.WordCountProcessorApplication();
|
||||
final Function<KStream<Bytes, String>, KStream<Bytes, KafkaStreamsWordCountApplication.WordCount>> process = app.process();
|
||||
|
||||
//final Function<KStream<Bytes, String>, KStream<Bytes, KafkaStreamsWordCountApplication.WordCount>> process = app.process();
|
||||
final Function<KStream<Bytes, String>, KStream<Bytes, KafkaStreamsWordCountApplication.WordCount>> process = null;
|
||||
|
||||
final KStream<Bytes, KafkaStreamsWordCountApplication.WordCount> output = process.apply(input);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user