Skip to content

Commit

Permalink
Revising the rate to 1s
Browse files Browse the repository at this point in the history
  • Loading branch information
PaurushGarg committed Nov 28, 2023
1 parent 10ad682 commit 2d5df9e
Show file tree
Hide file tree
Showing 4 changed files with 7 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@

@Log4j2
public abstract class MetricEmitter implements Emitter {
protected static final long FLUSH_INTERVAL = 5000;
protected static final long FLUSH_INTERVAL = 1000;
protected static final String DIMENSION_API_NAME = "apiName";
protected static final String DIMENSION_STATUS_CODE = "statusCode";
protected static String API_COUNTER_METRIC = "apiBytesSent";
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ public void nextDataPoint() {
}
break;
case "gauge":
for (int i = 0; i < param.getRate() * 5; i++) {
for (int i = 0; i < param.getRate(); i++) {
this.gaugeValues[i] = ThreadLocalRandom.current().nextLong(-100, 100);
}
break;
Expand Down Expand Up @@ -105,8 +105,8 @@ public void setupProvider() {
private void createCounters(Meter meter) {
if (meter != null) {
log.info("Registering counter metrics...");
counters = new LongCounter[param.getRate() * 5];
for (int i = 0; i < param.getRate() * 5; i++) {
counters = new LongCounter[param.getRate()];
for (int i = 0; i < param.getRate(); i++) {
counters[i] = meter.counterBuilder(API_COUNTER_METRIC + i)
.setDescription("API request load sent in bytes")
.setUnit("one")
Expand All @@ -120,7 +120,7 @@ private void createCounters(Meter meter) {
private void createGauges(Meter meter) {
if (meter != null) {
log.info("Registering gauge metrics...");
gaugeValues = new long[param.getRate() * 5];
gaugeValues = new long[param.getRate()];
int id = 0;
for (long gaugeValue : gaugeValues) {
meter.gaugeBuilder(API_LATENCY_METRIC + id++)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ public void sendStatsd() throws IOException {
payload = new StringBuilder();
String attributes = "#mykey:myvalue,datapoint_id:";
log.debug("Updating metrics...");
for (int i = 0; i < this.param.getRate() * 5; i++) {
for (int i = 0; i < this.param.getRate(); i++) {
payload.append("statsdTestMetric").append(i).append(":")
.append(ThreadLocalRandom.current().nextInt(-100, 100))
.append("|g|").append(attributes).append(i).append("\n");
Expand Down
2 changes: 1 addition & 1 deletion terraform/testcases/prometheus_mock/otconfig.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ receivers:
prometheus:
config:
global:
scrape_interval: 15s
scrape_interval: 1s
scrape_configs:
- job_name: "test-pipeline-job"
static_configs:
Expand Down

0 comments on commit 2d5df9e

Please sign in to comment.