removed all ActivityMetrics constructions

This commit is contained in:
Jonathan Shook
2023-10-05 15:27:15 -05:00
parent 4efd428de3
commit 57db140a94
22 changed files with 168 additions and 224 deletions

View File

@@ -155,9 +155,9 @@ public class HybridRateLimiter extends NBBaseComponent implements RateLimiter {
protected void init(final NBLabeledElement activityDef) {
delayGauge = ActivityMetrics.gauge(activityDef, this.label + "_waittime", new RateLimiters.WaitTimeGauge(this));
avgRateGauge = ActivityMetrics.gauge(activityDef, this.label + "_config_cyclerate", new RateLimiters.RateGauge(this));
burstRateGauge = ActivityMetrics.gauge(activityDef, this.label + "_config_burstrate", new RateLimiters.BurstRateGauge(this));
delayGauge = create().gauge( this.label + "_waittime", () -> (double)getTotalWaitTime());
avgRateGauge = create().gauge(this.label + "_config_cyclerate", () -> getRateSpec().opsPerSec);
burstRateGauge = create().gauge(this.label + "_config_burstrate", () -> getRateSpec().getBurstRatio() * getRateSpec().getRate());
}
@Override

View File

@@ -62,14 +62,14 @@ public class AtomicInput extends NBBaseComponent implements Input, ActivityDefOb
super(parent);
this.activityDef = activityDef;
onActivityDefUpdate(activityDef);
ActivityMetrics.gauge(new NBFunctionGauge(this, () -> (double) this.cycles_min.get(), "input_cycles_first"));
ActivityMetrics.gauge(new NBFunctionGauge(this, () -> (double) this.cycles_max.get(), "input_cycles_last"));
ActivityMetrics.gauge(new NBFunctionGauge(this, () -> (double) this.cycle_value.get(), "input_cycle"));
ActivityMetrics.gauge(new NBFunctionGauge(this, this::getTotalCycles, "input_cycles_total"));
ActivityMetrics.gauge(new NBFunctionGauge(this, () -> (double) this.recycles_min.get(), "input_recycles_first"));
ActivityMetrics.gauge(new NBFunctionGauge(this, () -> (double) this.recycles_max.get(), "input_recycles_last"));
ActivityMetrics.gauge(new NBFunctionGauge(this, () -> (double) this.recycle_value.get(), "input_recycle"));
ActivityMetrics.gauge(new NBFunctionGauge(this, this::getTotalRecycles, "input_recycles_total"));
create().gauge("input_cycles_first",() -> (double) this.cycles_min.get());
create().gauge("input_cycles_last",() -> (double) this.cycles_max.get());
create().gauge("input_cycle",() -> (double) this.cycle_value.get());
create().gauge("input_cycles_total",this::getTotalCycles);
create().gauge("input_recycles_first",() -> (double) this.recycles_min.get());
create().gauge("input_recycles_last",() -> (double) this.recycles_max.get());
create().gauge("input_recycle",() -> (double) this.recycle_value.get());
create().gauge("input_recycles_total",this::getTotalRecycles);
}
private double getTotalRecycles() {

View File

@@ -152,14 +152,12 @@ public class StandardActivity<R extends Op, S> extends SimpleActivity implements
throw new OpConfigError("Error mapping workload template to operations: " + e.getMessage(), null, e);
}
this.pendingOpsGauge = ActivityMetrics.gauge(
new NBFunctionGauge(this,() -> this.getProgressMeter().getSummary().pending(), "ops_pending")
);
this.activeOpsGauge = ActivityMetrics.gauge(
new NBFunctionGauge(this, () -> this.getProgressMeter().getSummary().current(),"ops_active")
);
this.completeOpsGauge = ActivityMetrics.gauge(
new NBFunctionGauge(this, () -> this.getProgressMeter().getSummary().complete(),"ops_complete"));
this.pendingOpsGauge = create().gauge(
"ops_pending",() -> this.getProgressMeter().getSummary().pending());
this.activeOpsGauge = create().gauge(
"ops_active",() -> this.getProgressMeter().getSummary().current());
this.completeOpsGauge = create().gauge(
"ops_complete",() -> this.getProgressMeter().getSummary().complete());
}
@Override

View File

@@ -17,8 +17,8 @@
package io.nosqlbench.engine.api.metrics;
import com.codahale.metrics.Counter;
import io.nosqlbench.api.labels.NBLabeledElement;
import io.nosqlbench.api.engine.metrics.ActivityMetrics;
import io.nosqlbench.components.NBComponent;
import java.util.ArrayList;
import java.util.List;
@@ -30,11 +30,11 @@ import java.util.concurrent.ConcurrentHashMap;
public class ExceptionCountMetrics {
private final ConcurrentHashMap<String, Counter> counters = new ConcurrentHashMap<>();
private final Counter allerrors;
private final NBLabeledElement parentLabels;
private final NBComponent parent;
public ExceptionCountMetrics(final NBLabeledElement parentLabels) {
this.parentLabels = parentLabels;
this.allerrors =ActivityMetrics.counter(parentLabels, "errors_ALL");
public ExceptionCountMetrics(final NBComponent parent) {
this.parent = parent;
this.allerrors=parent.create().counter( "errors_ALL");
}
public void count(final String name) {
@@ -42,7 +42,7 @@ public class ExceptionCountMetrics {
if (null == c) synchronized (this.counters) {
c = this.counters.computeIfAbsent(
name,
k -> ActivityMetrics.counter(this.parentLabels, "errors_" + name)
k -> parent.create().counter("errors_" + name)
);
}
c.inc();

View File

@@ -17,22 +17,21 @@
package io.nosqlbench.engine.api.metrics;
import com.codahale.metrics.Counter;
import io.nosqlbench.api.labels.NBLabeledElement;
import io.nosqlbench.api.engine.metrics.ActivityMetrics;
import io.nosqlbench.components.NBComponent;
/**
* Use this to provide exception metering during expected result verification.
*/
public class ExceptionExpectedResultVerificationMetrics {
private final NBLabeledElement parentLabels;
private final NBComponent parent;
private final Counter verificationErrors;
private final Counter verificationRetries;
public ExceptionExpectedResultVerificationMetrics(final NBLabeledElement parentLabels) {
this.parentLabels = parentLabels;
verificationRetries = ActivityMetrics.counter(parentLabels, "verificationcounts_RETRIES");
verificationErrors = ActivityMetrics.counter(parentLabels, "verificationcounts_ERRORS");
public ExceptionExpectedResultVerificationMetrics(final NBComponent parent) {
this.parent = parent;
this.verificationRetries=parent.create().counter("verificationcounts_RETRIES");
this.verificationErrors=parent.create().counter( "verificationcounts_ERRORS");
}
public void countVerificationRetries() {

View File

@@ -20,6 +20,7 @@ import com.codahale.metrics.Histogram;
import io.nosqlbench.api.labels.NBLabeledElement;
import io.nosqlbench.api.engine.activityimpl.ActivityDef;
import io.nosqlbench.api.engine.metrics.ActivityMetrics;
import io.nosqlbench.components.NBComponent;
import java.util.ArrayList;
import java.util.List;
@@ -33,13 +34,13 @@ import java.util.concurrent.ConcurrentHashMap;
public class ExceptionHistoMetrics {
private final ConcurrentHashMap<String, Histogram> histos = new ConcurrentHashMap<>();
private final Histogram allerrors;
private final NBLabeledElement parentLabels;
private final NBComponent parent;
private final ActivityDef activityDef;
public ExceptionHistoMetrics(final NBLabeledElement parentLabels, final ActivityDef activityDef) {
this.parentLabels = parentLabels;
public ExceptionHistoMetrics(final NBComponent parent, final ActivityDef activityDef) {
this.parent = parent;
this.activityDef = activityDef;
this.allerrors = ActivityMetrics.histogram(parentLabels, "errorhistos_ALL", activityDef.getParams().getOptionalInteger("hdr_digits").orElse(4));
this.allerrors = parent.create().histogram( "errorhistos_ALL", activityDef.getParams().getOptionalInteger("hdr_digits").orElse(4));
}
public void update(final String name, final long magnitude) {
@@ -47,7 +48,7 @@ public class ExceptionHistoMetrics {
if (null == h) synchronized (this.histos) {
h = this.histos.computeIfAbsent(
name,
errName -> ActivityMetrics.histogram(this.parentLabels, "errorhistos_"+errName, this.activityDef.getParams().getOptionalInteger("hdr_digits").orElse(4))
errName -> parent.create().histogram( "errorhistos_"+errName, this.activityDef.getParams().getOptionalInteger("hdr_digits").orElse(4))
);
}
h.update(magnitude);

View File

@@ -19,6 +19,7 @@ package io.nosqlbench.engine.api.metrics;
import com.codahale.metrics.Meter;
import io.nosqlbench.api.labels.NBLabeledElement;
import io.nosqlbench.api.engine.metrics.ActivityMetrics;
import io.nosqlbench.components.NBComponent;
import java.util.ArrayList;
import java.util.List;
@@ -30,11 +31,11 @@ import java.util.concurrent.ConcurrentHashMap;
public class ExceptionMeterMetrics {
private final ConcurrentHashMap<String, Meter> meters = new ConcurrentHashMap<>();
private final Meter allerrors;
private final NBLabeledElement parentLabels;
private final NBComponent parent;
public ExceptionMeterMetrics(final NBLabeledElement parentLabels) {
this.parentLabels = parentLabels;
this.allerrors = ActivityMetrics.meter(parentLabels, "errormeters_ALL");
public ExceptionMeterMetrics(final NBComponent parent) {
this.parent = parent;
this.allerrors = parent.create().meter("errormeters_ALL");
}
public void mark(final String name) {
@@ -42,7 +43,7 @@ public class ExceptionMeterMetrics {
if (null == c) synchronized (this.meters) {
c = this.meters.computeIfAbsent(
name,
k -> ActivityMetrics.meter(this.parentLabels, "errormeters_" + name)
k -> parent.create().meter("errormeters_" + name)
);
}
c.mark();