Skip to content

Commit

Permalink
v0.0.7 (#6)
Browse files Browse the repository at this point in the history
Added the ability to use a single test topic
  • Loading branch information
dhoard authored Feb 23, 2023
1 parent 4f35d55 commit a8e4586
Show file tree
Hide file tree
Showing 11 changed files with 188 additions and 173 deletions.
37 changes: 22 additions & 15 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,15 +15,22 @@ mvn clean package

## Kafka Topic Configuration

You need to create a unique test topic per application instance with enough partitions to span all brokers
Create a topic for the application to use with enough partitions to span all brokers

- a topic can be shared with multiple application instances


- topic partition count increases are automatically handled
- It may take up to 60000 ms to reflect the new topic partition count


- It may take up to 60000 ms to reflect the topic partition count changes

### Self-Managed Kafka

The configuration `test.properties` in https://github.com/dhoard/k-synthetic-test/blob/main/configuration/test.properties should be self-explanatory

- the example `test.properties` documents configuration values

### Confluent Cloud

**Step 1**
Expand Down Expand Up @@ -61,16 +68,8 @@ kcat -b ${CCLOUD_BROKERS} -L \

**Notes**

- This application uses manual partition assignment
- dynamic Kafka partition increases are currently not handle


- Example topic name is `k-synthetic-test-<id>`
- where `<id>` matches the `id` in your test properties


- Example retention time is `300,000` ms (5 minutes)
- old messages provide no value, so are skipped
- Suggested retention time is `300,000` ms (5 minutes)
- old records provide no value, so are skipped


## Run
Expand All @@ -79,12 +78,14 @@ kcat -b ${CCLOUD_BROKERS} -L \

Copy `configuration/test.properties` and edit to match your environment

- Configuration value `id` should be unique per application instance

**Step 2**

Run

```shell
java -jar target/k-synthetic-test-0.0.6.jar configuration/test.properties
java -jar target/k-synthetic-test-0.0.7.jar configuration/test.properties
```

**NOTES**
Expand All @@ -98,7 +99,12 @@ java -jar target/k-synthetic-test-0.0.6.jar configuration/test.properties

## Metrics

Access Prometheus metrics using `http://<http.server.address>:<http.server.port>`
Access Prometheus metrics using `http://<ip address or hostname>:<http.server.port>`

- Configuration value `http.server.address` detemines the IP address to service Prometheus metrics requests

- To bind to all IP addresses use `0.0.0.0`


Example URL (based on `test.properties`:

Expand All @@ -118,7 +124,8 @@ k_synthetic_test_round_trip_time{id="source-10.0.0.1",bootstrap_servers="cp-1:90

**Notes**

- A test message is sent to every partition based on the configured `period.ms` value

- A record is sent to every partition based on the configured `period.ms` value


- A negative value indicates that a metric hasn't been updated within the configured `metric.expiration.period.ms` value
Expand Down
6 changes: 3 additions & 3 deletions configuration/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ Configuration scenario
Usage

```shell
java -jar target/k-synthetic-test-0.0.6.jar configuration/test.properties
java -jar target/k-synthetic-test-0.0.7.jar configuration/test.properties
```

---
Expand All @@ -36,7 +36,7 @@ Configuration scenario
java \
-Djavax.net.ssl.keyStore=configuration/keystore.pkcs12 \
-Djavax.net.ssl.keyStorePassword=changeit \
-jar target/k-synthetic-test-0.0.6.jar configuration/test.ssl.properties
-jar target/k-synthetic-test-0.0.7.jar configuration/test.ssl.properties
```

---
Expand All @@ -56,5 +56,5 @@ Configuration scenario
java \
-Djavax.net.ssl.keyStore=configuration/keystore.pkcs12 \
-Djavax.net.ssl.keyStorePassword=changeit \
-jar target/k-synthetic-test-0.0.6.jar configuration/test.confluent-cloud.properties
-jar target/k-synthetic-test-0.0.7.jar configuration/test.confluent-cloud.properties
```
23 changes: 4 additions & 19 deletions configuration/test.confluent-cloud.properties
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Test instance id
# Application instance id
id=source-10.0.0.1

# Delay period before starting production of test messages
Expand All @@ -7,7 +7,6 @@ delay.ms=0
# Producer period for test messages
period.ms=1000

#
# Metric expiration TTL (expire data "value = -1.0" if not update within TTL period)
#
# This should be a multiple of "period.ms"
Expand Down Expand Up @@ -43,28 +42,14 @@ http.server.basic.authentication.password=secret

# HTTPS support (optional)
#
# If enabled, Java keystore / truststore system properties
# If enabled, Java keystore system properties
# must be defined along with the certificate alias
#
http.server.ssl.enabled=true
http.server.ssl.certificate.alias=localhost

#
# Topic for test messages
#
# The most common naming pattern would be "k-synthetic-test-<id>"
#
# Example:
#
# id=source-10.0.0.1
# topic=k-synthetic-test-source-10.0.0.1
#
# Example 2:
#
# id=us-east1.project-1.network-1.ip-1.2.3.4
# topic=k-synthetic-test-us-east1.project-1.network-1.ip-1.2.3.4
#
topic=k-synthetic-test-source-10.0.0.1
# Kafka topic for test messages
topic=k-synthetic-test

# Confluent Cloud properties
bootstrap.servers=<Confluent Cloud bootstrap servers>
Expand Down
23 changes: 4 additions & 19 deletions configuration/test.properties
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
# HTTP authentication disabled
# HTTPS disabled

# Test instance id
# Application instance id
id=source-10.0.0.1

# Delay period before starting production of test messages
Expand All @@ -14,7 +14,6 @@ delay.ms=0
# Producer period for test messages
period.ms=1000

#
# Metric expiration TTL (expire data "value = -1.0" if not update within TTL period)
#
# This should be a multiple of "period.ms"
Expand Down Expand Up @@ -50,28 +49,14 @@ http.server.basic.authentication.password=secret

# HTTPS support (optional)
#
# If enabled, Java keystore / truststore system properties
# If enabled, Java keystore system properties
# must be defined along with the certificate alias
#
http.server.ssl.enabled=false
http.server.ssl.certificate.alias=localhost

#
# Topic for test messages
#
# The most common naming pattern would be "k-synthetic-test-<id>"
#
# Example:
#
# id=source-10.0.0.1
# topic=k-synthetic-test-source-10.0.0.1
#
# Example 2:
#
# id=us-east1.project-1.network-1.ip-1.2.3.4
# topic=k-synthetic-test-us-east1.project-1.network-1.ip-1.2.3.4
#
topic=k-synthetic-test-source-10.0.0.1
# Kafka topic for test messages
topic=k-synthetic-test

# Kafka properties
bootstrap.servers=cp-1:9092,cp-2:9092,cp-3:9092
23 changes: 4 additions & 19 deletions configuration/test.ssl.properties
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
# HTTP authentication enabled
# HTTPS enabled

# Test instance id
# Application instance id
id=source-10.0.0.1

# Delay period before starting production of test messages
Expand All @@ -14,7 +14,6 @@ delay.ms=0
# Producer period for test messages
period.ms=1000

#
# Metric expiration TTL (expire data "value = -1.0" if not update within TTL period)
#
# This should be a multiple of "period.ms"
Expand Down Expand Up @@ -50,28 +49,14 @@ http.server.basic.authentication.password=secret

# HTTPS support (optional)
#
# If enabled, Java keystore / truststore system properties
# If enabled, Java keystore system properties
# must be defined along with the certificate alias
#
http.server.ssl.enabled=true
http.server.ssl.certificate.alias=localhost

#
# Topic for test messages
#
# The most common naming pattern would be "k-synthetic-test-<id>"
#
# Example:
#
# id=source-10.0.0.1
# topic=k-synthetic-test-source-10.0.0.1
#
# Example 2:
#
# id=us-east1.project-1.network-1.ip-1.2.3.4
# topic=k-synthetic-test-us-east1.project-1.network-1.ip-1.2.3.4
#
topic=k-synthetic-test-source-10.0.0.1
# Kafka topic for test messages
topic=k-synthetic-test

# Kafka properties
bootstrap.servers=cp-1:9092,cp-2:9092,cp-3:9092
3 changes: 2 additions & 1 deletion pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@

<groupId>com.github.dhoard</groupId>
<artifactId>k-synthetic-test</artifactId>
<version>0.0.6</version>
<version>0.0.7</version>

<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
Expand Down Expand Up @@ -55,6 +55,7 @@
<filter>
<artifact>*:*</artifact>
<excludes>
<exclude>module-info.class</exclude>
<exclude>META-INF/MANIFEST.MF</exclude>
</excludes>
</filter>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,11 +16,7 @@

package com.github.dhoard.k.synthetic.test;

import io.prometheus.client.Collector;
import io.prometheus.client.DoubleAdder;
import io.prometheus.client.GaugeMetricFamily;
import io.prometheus.client.SimpleCollector;
import io.prometheus.client.Summary;
import io.prometheus.client.*;

import java.io.Closeable;
import java.util.ArrayList;
Expand Down
Loading

0 comments on commit a8e4586

Please sign in to comment.