mirror of
https://github.com/nosqlbench/nosqlbench.git
synced 2024-12-23 15:40:44 -06:00
fix for duplicate config_cyclerate gauge when striderate is used
This commit is contained in:
parent
46917d18bd
commit
6ffa867d6c
@ -25,9 +25,13 @@ public enum RateLimiters {
|
||||
private static final Logger logger = LogManager.getLogger(RateLimiters.class);
|
||||
|
||||
public static synchronized RateLimiter createOrUpdate(final NBComponent parent, final RateLimiter extant, final SimRateSpec spec) {
|
||||
return createOrUpdate(parent, extant, spec, "cycle");
|
||||
}
|
||||
|
||||
public static synchronized RateLimiter createOrUpdate(final NBComponent parent, final RateLimiter extant, final SimRateSpec spec,final String type) {
|
||||
|
||||
if (null == extant) {
|
||||
final RateLimiter rateLimiter= new SimRate(parent, spec);
|
||||
final RateLimiter rateLimiter= new SimRate(parent, spec, type);
|
||||
|
||||
RateLimiters.logger.info(() -> "Using rate limiter: " + rateLimiter);
|
||||
return rateLimiter;
|
||||
|
@ -79,13 +79,18 @@ public class SimRate extends NBBaseComponent implements RateLimiter, Thread.Unca
|
||||
private long startTime;
|
||||
|
||||
public SimRate(NBComponent parent, SimRateSpec spec) {
|
||||
this(parent, spec, "cycle");
|
||||
}
|
||||
|
||||
public SimRate(NBComponent parent, SimRateSpec spec, String type) {
|
||||
super(parent, NBLabels.forKV());
|
||||
this.spec = spec;
|
||||
initMetrics();
|
||||
initMetrics(type);
|
||||
startFiller();
|
||||
}
|
||||
|
||||
private void initMetrics() {
|
||||
private void initMetrics(String type) {
|
||||
if (type.equalsIgnoreCase("cycle")) {
|
||||
create().gauge(
|
||||
"cycles_waittime",
|
||||
() -> (double) getWaitTimeDuration().get(ChronoUnit.NANOS),
|
||||
@ -105,6 +110,27 @@ public class SimRate extends NBBaseComponent implements RateLimiter, Thread.Unca
|
||||
MetricCategory.Config,
|
||||
"the configured burst rate as a multiplier to the configured cycle rate. ex: 1.05 means 5% faster is allowed."
|
||||
);
|
||||
} else {
|
||||
create().gauge(
|
||||
"stride_waittime",
|
||||
() -> (double) getWaitTimeDuration().get(ChronoUnit.NANOS),
|
||||
MetricCategory.Core,
|
||||
"The cumulative scheduling delay which accrues when" +
|
||||
" an activity is not able to execute operations as fast as requested."
|
||||
);
|
||||
create().gauge(
|
||||
"config_striderate",
|
||||
() -> spec.opsPerSec,
|
||||
MetricCategory.Config,
|
||||
"The configured stride rate in ops/s"
|
||||
);
|
||||
create().gauge(
|
||||
"config_burstrate",
|
||||
() -> spec.burstRatio,
|
||||
MetricCategory.Config,
|
||||
"the configured burst rate as a multiplier to the configured cycle rate. ex: 1.05 means 5% faster is allowed."
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
public long refill() {
|
||||
|
@ -89,6 +89,8 @@ public class SimpleActivity extends NBStatusComponent implements Activity, Invok
|
||||
private ActivityMetricProgressMeter progressMeter;
|
||||
private String workloadSource = "unspecified";
|
||||
private final RunStateTally tally = new RunStateTally();
|
||||
public static final String STRIDE = "stride";
|
||||
public static final String CYCLE = "cycle";
|
||||
|
||||
public SimpleActivity(NBComponent parent, ActivityDef activityDef) {
|
||||
super(parent, NBLabels.forKV("activity", activityDef.getAlias()).and(activityDef.auxLabels()));
|
||||
@ -315,11 +317,11 @@ public class SimpleActivity extends NBStatusComponent implements Activity, Invok
|
||||
}
|
||||
|
||||
public void createOrUpdateStrideLimiter(SimRateSpec spec) {
|
||||
strideLimiter = RateLimiters.createOrUpdate(this, strideLimiter, spec);
|
||||
strideLimiter = RateLimiters.createOrUpdate(this, strideLimiter, spec, STRIDE);
|
||||
}
|
||||
|
||||
public void createOrUpdateCycleLimiter(SimRateSpec spec) {
|
||||
cycleLimiter = RateLimiters.createOrUpdate(this, cycleLimiter, spec);
|
||||
cycleLimiter = RateLimiters.createOrUpdate(this, cycleLimiter, spec, CYCLE);
|
||||
}
|
||||
|
||||
/**
|
||||
|
Loading…
Reference in New Issue
Block a user