allow labels to be provided at the activity level

This commit is contained in:
Jonathan Shook
2023-08-28 16:15:24 -05:00
parent def7e99ed8
commit 5ae230ebce
2 changed files with 9 additions and 1 deletions

View File

@@ -154,6 +154,7 @@ public abstract class BaseDriverAdapter<R extends Op, S> implements DriverAdapte
public NBConfigModel getConfigModel() {
return ConfigModel.of(BaseDriverAdapter.class)
.add(Param.optional("alias"))
.add(Param.optional("labels",String.class,"Labels which will apply to metrics and annotations for this activity only"))
.add(Param.defaultTo("strict", true, "strict op field mode, which requires that provided op fields are recognized and used"))
.add(Param.optional(List.of("op", "stmt", "statement"), String.class, "op template in statement form"))
.add(Param.optional("tags", String.class, "tags to be used to filter operations"))

View File

@@ -17,6 +17,7 @@
package io.nosqlbench.engine.api.activityimpl;
import com.codahale.metrics.Timer;
import io.nosqlbench.api.config.NBLabelSpec;
import io.nosqlbench.engine.api.activityapi.core.*;
import io.nosqlbench.engine.api.activityapi.core.progress.ActivityMetricProgressMeter;
import io.nosqlbench.engine.api.activityapi.core.progress.ProgressMeterDisplay;
@@ -93,7 +94,13 @@ public class SimpleActivity implements Activity {
private final NBLabels labels;
public SimpleActivity(ActivityDef activityDef, NBLabeledElement parentLabels) {
labels = parentLabels.getLabels().and("activity",activityDef.getAlias());
NBLabels activityLabels = parentLabels.getLabels()
.andTypes("activity", activityDef.getAlias());
Optional<String> auxLabelSpec = activityDef.getParams().getOptionalString("labels");
if (auxLabelSpec.isPresent()) {
activityLabels = activityLabels.and(NBLabelSpec.parseLabels(auxLabelSpec.get()));
}
this.labels = activityLabels;
this.activityDef = activityDef;
this.parentLabels = parentLabels;
if (activityDef.getAlias().equals(ActivityDef.DEFAULT_ALIAS)) {