A Kafka demo project intended to re-create the business use case in the Audi Project for APM. When Kafka streams are monitored by the OneAgent, how can we read the data streams in Dynatrace?
Go to file
arnel e7ff09620f modified README.md 2023-09-06 15:21:50 +02:00
.mvn/wrapper first commit 2023-09-01 20:28:52 +02:00
src first commit 2023-09-01 20:28:52 +02:00
.gitignore first commit 2023-09-01 20:28:52 +02:00
README.md modified README.md 2023-09-06 15:21:50 +02:00
mvnw first commit 2023-09-01 20:28:52 +02:00
mvnw.cmd first commit 2023-09-01 20:28:52 +02:00
pom.xml first commit 2023-09-01 20:28:52 +02:00

README.md

kafka-demo

This project is just a sample demonstration inspired by question "How do we monitor a kafka stream with a OneAgent and see the data on Dynatrace?"

setup

You need to download kafka on your device. For this demo project the binary Scala 2.12 - kafka_2.12-3.5.1.tgz was downloaded, therefore kafka version 3.5.1 is used.

run

First you have to start and run the zookeeper server, afterwards the kafka server and finally the consumers.

bin/zookeeper-server-start.sh config/zookeeper.properties
bin/kafka-server-start.sh config/server.properties
bin/kafka-console-consumer.sh --topic TOPIC_INSTANCE --from-beginning --bootstrap-server localhost:9092
bin/kafka-console-consumer.sh --topic TOPIC_INSTANCE_JSON --from-beginning --bootstrap-server localhost:9092

NOTE: MAKE SURE YOU FOLLOW THE ORDER!

Run this project by starting the KafkaDemoApplication!

demo

Once everything is running open the following link in your browser: http://localhost:8080/api/v1/kafka/publish

If you want to produce a message then you can add the message query parameter and your value as following: http://localhost:8080/api/v1/kafka/publish?message=Madrid http://localhost:8080/api/v1/kafka/publish?message=London http://localhost:8080/api/v1/kafka/publish?=Vienna http://localhost:8080/api/v1/kafka/publish?=Pizza

On one of the consumers you will see the messages!

It is possible to send a JSON Object. To do that you will have to send a POST request via e.g. Postman. In Postman choose the POST method and use this link: http://localhost:8080/api/v1/kafka/publish

Afterward under Body, pick raw and instead Text pick JSON. In the body section you can add the following object:

{
    "id": 1,
    "vin": "V09JHY4",
    "location": "New York" 
}

Send.

You should be able to see the data in one of the consumers! If you encounter any warnings after starting the consumers you can ignore them!