Skip to content

Commit

Permalink
Load generation App Updates (#1509)
Browse files Browse the repository at this point in the history
* Adding aws_sdk_2 trace prefix

* Adding draft changes for otlp counter metric

* Removing build and format error

* Removing debug changes from PR

* Revising the rate to 1s

* Revising statsd aggregation interval

* Changing Trace Emitter OTLP Queue Size and Export time

* Reverting inadvertenet statsd changes

* Reverting some unintended changes

* Refactoring

* Use latest load-gen image

* Resolving comments - early return

* Reverting changes to prometheus config
  • Loading branch information
PaurushGarg committed Dec 20, 2023
1 parent 310159e commit a371a93
Show file tree
Hide file tree
Showing 12 changed files with 131 additions and 186 deletions.
26 changes: 9 additions & 17 deletions load-generator/README.md
Original file line number Diff line number Diff line change
@@ -1,21 +1,18 @@
### AWS OTel Collector Load Test Generator

### Parameters for Metric Generation:
1. Metric Count\
--metricCount, -m : (default=1) the number of metrics that should be generated for each metric type. This amount of metrics will be updated/exported per period.

2. Datapoint Count\
--datapointCount, -dp : (default=1) the number of data-points that should be created for each metric. Number of data-points updated/exported per period shall be equal to Metric Count * Datapoint Count.

3. Observation Interval\
--observationInterval, -o : (default=1000 ms) the interval (in ms) at which metric observations/values are updated.
1. Rate\
--rate, -r (eg, 1,000, 10,000 metric counts per second) : (default=1) the number of metrics that should be generated for each metric type. This amount of metrics will be updated/exported per period.

4. Collector Receiver Endpoint\
2. Collector Receiver Endpoint\
--url, -u

5. Data Format\
3. Data Format\
--dataFormat -d (eg, otlp, statsd)

4. Metric Type
--metricType, -mt : (default=counter) Specify the type of metric - counter or gauge.

### Parameters for Trace Generation:

1. Rate\
Expand All @@ -28,13 +25,8 @@
--dataFormat -d (eg, otlp, prometheus, xray)

### OTLP Metrics Load Test Sample Command,

The following is a list of additional optional command line arguments applicable only for configuration of OTLP metrics:
* `--flushInterval, -f` : (default=1000 ms) the metric collection export interval (in ms).
* `--metricType, -mt`: (default=counter) Specify the type of metric - counter or gauge.

```
./gradlew :load-generator:run --args="metric --metricCount=100 --datapointCount=10 --observationInterval=1000 --flushInterval=1000 --metricType=counter -u=localhost:4317 -d=otlp"
./gradlew :load-generator:run --args="metric -r=100 -u=localhost:4317 --metricType=counter -d=otlp"
```

### OTLP Trace Load Test Sample Command,
Expand All @@ -49,7 +41,7 @@ The following is a list of additional optional command line arguments applicable

### StatsD Metrics Load Test Sample Command,
```
./gradlew :load-generator:run --args="metric --metricCount=100 --datapointCount=10 --observationInterval=1000 -u=localhost:8125 -d=statsd"
./gradlew :load-generator:run --args="metric -r=100 -u=localhost:8125 --metricType=counter -d=statsd"
```

### Zipkin Trace Load Test Sample Command,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,10 @@
@Command(footer = "Common parameter options for both Metric and Trace")
public class CommonOption {

@Option(names = {"-r", "--rate"},
description = "the number of data points will be sent per second",
defaultValue = "10")
private int rate;
@Option(names = {"-u", "--url"},
description = "adot-collector receiver endpoint",
defaultValue = "localhost:4317")
Expand All @@ -35,6 +39,7 @@ public class CommonOption {

public Parameter buildParameter() {
return Parameter.builder()
.rate(rate)
.dataFormat(dataFormat)
.endpoint(endpoint)
.build();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@
import com.amazon.opentelemetry.load.generator.emitter.EmitterFactory;
import com.amazon.opentelemetry.load.generator.model.DataType;
import com.amazon.opentelemetry.load.generator.model.Parameter;
import java.util.concurrent.TimeUnit;
import lombok.SneakyThrows;
import lombok.extern.log4j.Log4j2;
import picocli.CommandLine.Command;
Expand All @@ -36,26 +35,6 @@ public class MetricCommand implements Runnable {
@Mixin
CommonOption commonOption = new CommonOption();

@Option(names = {"-f", "--flushInterval"},
description = "the metric collection export interval (in ms)",
defaultValue = "1000")
private long flushIntervalMillis;

@Option(names = {"-m", "--metricCount"},
description = "the number of metrics that should be created for each metric type",
defaultValue = "1")
private int metricCount;

@Option(names = {"-dp", "--datapointCount"},
description = "the number of datapoints that should be created for each metric",
defaultValue = "1")
private int datapointCount;

@Option(names = {"-o", "--observationInterval"},
description = "the interval (in ms) at which metric observations/values are updated",
defaultValue = "1000")
private long observationIntervalMillis;

@Option(names = {"-mt", "--metricType"},
description = "Specify the type of metric - counter or gauge",
defaultValue = "counter")
Expand All @@ -65,13 +44,8 @@ public class MetricCommand implements Runnable {
@Override
public void run() {
Parameter param = commonOption.buildParameter();
param.setFlushInterval(flushIntervalMillis);
param.setMetricCount(metricCount);
param.setDatapointCount(datapointCount);
param.setObservationInterval(observationIntervalMillis);
param.setMetricType(metricType);


log.info("param: {} " + param);

Emitter emitter = EmitterFactory.getEmitter(param, DataType.Metric);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,6 @@
import com.amazon.opentelemetry.load.generator.model.Parameter;
import lombok.SneakyThrows;
import lombok.extern.log4j.Log4j2;
import picocli.CommandLine;
import picocli.CommandLine.Command;
import picocli.CommandLine.Mixin;

Expand All @@ -35,17 +34,10 @@ public class TraceCommand implements Runnable {
@Mixin
CommonOption commonOption = new CommonOption();

@CommandLine.Option(names = {"-r", "--rate"},
description = "the number of data points will be sent per second",
defaultValue = "10")
private int rate;

@SneakyThrows
@Override
public void run() {
Parameter param = commonOption.buildParameter();
param.setRate(rate);

log.info("param: {} " + param);

Emitter emitter = EmitterFactory.getEmitter(param, DataType.Trace);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,9 @@
public interface Emitter {

int NUM_THREADS = 5;

final long FLUSH_INTERVAL = 1000;

ScheduledExecutorService scheduler = Executors.newScheduledThreadPool(NUM_THREADS);

void emitDataLoad() throws Exception;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,6 @@

@Log4j2
public abstract class MetricEmitter implements Emitter {

protected static final String DIMENSION_API_NAME = "apiName";
protected static final String DIMENSION_STATUS_CODE = "statusCode";
protected static String API_COUNTER_METRIC = "apiBytesSent";
Expand All @@ -32,8 +31,8 @@ public abstract class MetricEmitter implements Emitter {

@Override
public void start(Runnable emitter) {
log.info("Generating metrics at a rate of(ms) : {}" , this.param.getObservationInterval());
scheduler.scheduleAtFixedRate(emitter, 0, this.param.getObservationInterval(), TimeUnit.MILLISECONDS);
log.info("Generating metrics at a rate of(ms) : {}" , FLUSH_INTERVAL);
scheduler.scheduleAtFixedRate(emitter, 0, FLUSH_INTERVAL, TimeUnit.MILLISECONDS);
};

}

0 comments on commit a371a93

Please sign in to comment.