This application is designed to monitor in a light way confluent clusters. Among the monitoring capabilities you will find the following capabilities:
check_latencyCheck the latency of Kafka producers by running various scenarios defined in a YAML configuration file. It calculates P90, P95, and P99 latency metrics for each scenario and batch, and saves the results in a structured format.
This file contains the Kafka cluster configuration. Ensure the following fields are correctly set:
bootstrap_servers: The Kafka bootstrap server address.sasl_mechanism: The SASL mechanism used for authentication.security_protocol: The security protocol used.sasl_plain_username: The username for SASL authentication.sasl_plain_password: The password for SASL authentication.
This file defines the scenarios to be forced agaisnt a cluster during monitoring time. Each scenario should have the following parameters:
msgs: Number of messages to send in each batch.batches: Number of times to repeat the scenario.timeout: Timeout for each message send operation.max_threads: Maximum number of threads to use for sending messages.message: The message content to send.
Example:
latency:
- scenario_1:
msgs: 1000 # number of messages used by this test in each batch
batches: 2 # number of batches
timeout: 10 # max timeout before a error hit. Errors will not be part of the latency calculation.
max_threads: 10 # max number of threads used by the application to send mesages in parallel
message:
value: {'attr1': 'value_attr1', 'attr2': 'value_attr2'} # value of message to be producedConfluent Cloud is a fully managed Apache Kafka service that allows you to focus on building your applications without the operational overhead of managing Kafka infrastructure. It provides scalability, security, and reliability out of the box.
Confluent Platform is a self-managed distribution of Apache Kafka that includes additional tools and services to enhance Kafka's capabilities. It allows for on-premises deployment and provides features like schema registry, ksqlDB, and Kafka Connect.
To start the Confluent Platform using Docker, use the following command:
make cpThis command will initialize and start the Confluent Platform services defined in the docker-compose.yml file.
To create a Confluent Cloud environment using Terraform, you can use the following make command:
make ccThis command will initialize and apply the Terraform configuration defined in the platforms/cc/tf directory. It uses the secret.tfvars file to provide necessary variables such as your Confluent Cloud API key information. Ensure that this file is correctly set up before running the command.
-
Install the required dependencies:
pip install -r requirements.txt
-
File up the
cluster.propertiesfile with the access information about your cluster. -
Run the latency checker (Only metric available so far). Use the flag --platform to decide between cc or cp:
python kafka_latency_checker.py check-latency --platform cc
-
Check the results in the
.resultsfolder. The results will be saved in the.resultsdirectory, with each run having its own subdirectory named by the epoch time.
To run latency metrics on the Confluent Platform, use the following command:
make cp-latency-metricsor for all available metrics (TODO)
make cp-metricsto extract all the metrics.
This will execute the latency checker for the Confluent Platform.
To run latency metrics on Confluent Cloud, use the following command:
make cc-latency-metricsor for all available metrics (TODO)
make cc-metricsThis will execute the latency checker for Confluent Cloud.
- Create a
secret.tfvarsfile with your CC api key information. Use the template file to make your life easier. - Initialize terraform
cd platforms/cc/tf
terraform init- Plan and apply your changes. This command will create a new cluster at your CC enviroment.
terraform plan -var-file="secret.tfvars"
terraform apply -var-file="secret.tfvars" - Get the terraform output file u the
cluster.propertiesfile.
terraform outputNow you are ready to run a first metric agains a confluent cloud cluster.
To run this application, you need to have the following tools installed:
Terraform is used for managing infrastructure as code. You can install it by following the instructions on the Terraform website.
Python is required to run the latency checker script. You can download and install Python from the official Python website.
Docker is used to run the Confluent Platform services. You can install Docker by following the instructions on the Docker website.
Make is used to automate the execution of tasks defined in the Makefile. It is typically pre-installed on macOS and Linux. For Windows, you can use Make for Windows or install it via WSL.
- Terraform: After installation, you can use Terraform by running commands like
terraform init,terraform plan, andterraform applyin your terminal to manage infrastructure. - Python: Use Python to run scripts and manage dependencies. You can execute a Python script using
python script_name.py. - Docker: Use Docker to manage containers. You can start a container using
docker runand manage it with commands likedocker start,docker stop, anddocker ps. - Make: Use Make to automate tasks defined in a Makefile. Run
make target_nameto execute a specific target.