Merge branch 'main' into nosqlbench-1522-moremath

This commit is contained in:
Jonathan Shook 2023-09-07 13:23:18 -05:00
commit e7b6ee9164
11 changed files with 17 additions and 25 deletions

View File

@ -54,8 +54,4 @@ public class MongoDirectCommandOp implements CycleOp<Document> {
return document;
}
@Override
public long getResultSize() {
return resultSize;
}
}

View File

@ -16,7 +16,6 @@
package io.nosqlbench.adapters.api.activityimpl;
import com.codahale.metrics.Histogram;
import com.codahale.metrics.Timer;
import groovy.lang.Binding;
import io.nosqlbench.adapters.api.activityimpl.uniform.DriverAdapter;
@ -59,7 +58,6 @@ public abstract class BaseOpDispenser<T extends Op, S> implements OpDispenser<T>
protected final DriverAdapter<T, S> adapter;
private final NBLabels labels;
private boolean instrument;
private Histogram resultSizeHistogram;
private Timer successTimer;
private Timer errorTimer;
private final String[] timerStarts;
@ -181,7 +179,6 @@ public abstract class BaseOpDispenser<T extends Op, S> implements OpDispenser<T>
final int hdrDigits = pop.getStaticConfigOr("hdr_digits", 4).intValue();
successTimer = ActivityMetrics.timer(pop, "success", hdrDigits);
errorTimer = ActivityMetrics.timer(pop, "error", hdrDigits);
resultSizeHistogram = ActivityMetrics.histogram(pop, "resultset_size", hdrDigits);
}
}
@ -191,10 +188,9 @@ public abstract class BaseOpDispenser<T extends Op, S> implements OpDispenser<T>
}
@Override
public void onSuccess(final long cycleValue, final long nanoTime, final long resultSize) {
public void onSuccess(final long cycleValue, final long nanoTime) {
if (this.instrument) {
this.successTimer.update(nanoTime, TimeUnit.NANOSECONDS);
if (-1 < resultSize) this.resultSizeHistogram.update(resultSize);
}
if (null != timerStops) ThreadLocalNamedTimers.TL_INSTANCE.get().stop(this.timerStops);
}

View File

@ -18,6 +18,6 @@ package io.nosqlbench.adapters.api.activityimpl;
public interface OpResultTracker {
void onStart(long cycleValue);
void onSuccess(long cycleValue, long nanoTime, long resultsize);
void onSuccess(long cycleValue, long nanoTime);
void onError(long cycleValue, long resultNanos, Throwable t);
}

View File

@ -33,5 +33,5 @@ package io.nosqlbench.adapters.api.activityimpl.uniform.flowtypes;
* </p>
*/
// TODO: optimize the runtime around the specific op type
public interface Op extends OpResultSize {
public interface Op {
}

View File

@ -127,7 +127,7 @@ public class StandardAction<A extends StandardActivity<R, ?>, R extends Op> impl
resultTimer.update(nanos, TimeUnit.NANOSECONDS);
if (error == null) {
resultSuccessTimer.update(nanos, TimeUnit.NANOSECONDS);
dispenser.onSuccess(cycle, nanos, op.getResultSize());
dispenser.onSuccess(cycle, nanos);
break;
} else {
ErrorDetail detail = errorHandler.handleError(error, cycle, nanos);

View File

@ -34,7 +34,7 @@ public class ExceptionCountMetrics {
public ExceptionCountMetrics(final NBLabeledElement parentLabels) {
this.parentLabels = parentLabels;
this.allerrors =ActivityMetrics.counter(parentLabels, "errorcounts.ALL");
this.allerrors =ActivityMetrics.counter(parentLabels, "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, "errorcounts." + name)
k -> ActivityMetrics.counter(this.parentLabels, "errors_" + name)
);
}
c.inc();

View File

@ -31,8 +31,8 @@ public class ExceptionExpectedResultVerificationMetrics {
public ExceptionExpectedResultVerificationMetrics(final NBLabeledElement parentLabels) {
this.parentLabels = parentLabels;
verificationRetries = ActivityMetrics.counter(parentLabels, "verificationcounts.RETRIES");
verificationErrors = ActivityMetrics.counter(parentLabels, "verificationcounts.ERRORS");
verificationRetries = ActivityMetrics.counter(parentLabels, "verificationcounts_RETRIES");
verificationErrors = ActivityMetrics.counter(parentLabels, "verificationcounts_ERRORS");
}
public void countVerificationRetries() {

View File

@ -34,7 +34,7 @@ public class ExceptionMeterMetrics {
public ExceptionMeterMetrics(final NBLabeledElement parentLabels) {
this.parentLabels = parentLabels;
this.allerrors = ActivityMetrics.meter(parentLabels, "errormeters.ALL");
this.allerrors = ActivityMetrics.meter(parentLabels, "errormeters_ALL");
}
public void mark(final String name) {
@ -42,7 +42,7 @@ public class ExceptionMeterMetrics {
if (null == c) synchronized (this.meters) {
c = this.meters.computeIfAbsent(
name,
k -> ActivityMetrics.meter(this.parentLabels, "errormeters." + name)
k -> ActivityMetrics.meter(this.parentLabels, "errormeters_" + name)
);
}
c.mark();

View File

@ -51,7 +51,7 @@ public class ExceptionTimerMetrics {
if (null == timer) synchronized (this.timers) {
timer = this.timers.computeIfAbsent(
name,
k -> ActivityMetrics.timer(this.parentLabels, "errortimers." + name, this.activityDef.getParams().getOptionalInteger("hdr_digits").orElse(4))
k -> ActivityMetrics.timer(this.parentLabels, "errortimers_" + name, this.activityDef.getParams().getOptionalInteger("hdr_digits").orElse(4))
);
}
timer.update(nanosDuration, TimeUnit.NANOSECONDS);

View File

@ -34,20 +34,20 @@ public class ActivityMetricsTest {
int extant = ActivityMetrics.getMetricRegistry().getMetrics().size();
ActivityMetrics.mountSubRegistry("aprefixhere.",r1);
ActivityMetrics.mountSubRegistry("aprefixhere_",r1);
Map<String, Metric> metrics = ActivityMetrics.getMetricRegistry().getMetrics();
assertThat(metrics).containsKey("aprefixhere.counter1");
assertThat(metrics).containsKey("aprefixhere_counter1");
assertThat(metrics).hasSize(extant+1);
r1.counter("counter2");
metrics = ActivityMetrics.getMetricRegistry().getMetrics();
assertThat(metrics).hasSize(extant+2);
assertThat(metrics).containsKey("aprefixhere.counter2");
assertThat(metrics).containsKey("aprefixhere_counter2");
r1.remove("counter1");
metrics = ActivityMetrics.getMetricRegistry().getMetrics();
assertThat(metrics).hasSize(extant+1);
assertThat(metrics).containsKey("aprefixhere.counter2");
assertThat(metrics).containsKey("aprefixhere_counter2");
r1.remove("counter2");
metrics = ActivityMetrics.getMetricRegistry().getMetrics();

View File

@ -95,7 +95,7 @@ public class Intersections {
}
public static int[] find(int[] reference, int[] sample, int limit) {
int[] result = new int[reference.length];
int[] result = new int[limit];
int a_index = 0, b_index = 0, acc_index = -1;
int a_element, b_element;
while (a_index < reference.length && a_index < limit && b_index < sample.length && b_index < limit) {
@ -119,7 +119,7 @@ public class Intersections {
return find(reference, sample, reference.length);
}
public static long[] find(long[] reference, long[] sample, int limit) {
long[] result = new long[reference.length];
long[] result = new long[limit];
int a_index = 0, b_index = 0, acc_index = -1;
long a_element, b_element;
while (a_index < reference.length && a_index < limit && b_index < sample.length && b_index < limit) {