mirror of
https://github.com/nosqlbench/nosqlbench.git
synced 2025-02-25 18:55:28 -06:00
indirect loading on nbr working
This commit is contained in:
parent
9daf06cd62
commit
61b923cfed
@ -17,12 +17,14 @@
|
||||
package io.nosqlbench.adapter.amqp;
|
||||
|
||||
import io.nosqlbench.adapter.amqp.ops.AmqpTimeTrackOp;
|
||||
import io.nosqlbench.adapter.diag.DriverAdapterLoader;
|
||||
import io.nosqlbench.api.config.standard.NBConfigModel;
|
||||
import io.nosqlbench.api.config.standard.NBConfiguration;
|
||||
import io.nosqlbench.adapters.api.activityimpl.OpMapper;
|
||||
import io.nosqlbench.adapters.api.activityimpl.uniform.BaseDriverAdapter;
|
||||
import io.nosqlbench.adapters.api.activityimpl.uniform.DriverAdapter;
|
||||
import io.nosqlbench.adapters.api.activityimpl.uniform.DriverSpaceCache;
|
||||
import io.nosqlbench.api.labels.NBLabels;
|
||||
import io.nosqlbench.components.NBComponent;
|
||||
import io.nosqlbench.nb.annotations.Service;
|
||||
import org.apache.logging.log4j.LogManager;
|
||||
@ -34,8 +36,8 @@ import java.util.function.Function;
|
||||
public class AmqpDriverAdapter extends BaseDriverAdapter<AmqpTimeTrackOp, AmqpSpace> {
|
||||
private final static Logger logger = LogManager.getLogger(AmqpDriverAdapter.class);
|
||||
|
||||
public AmqpDriverAdapter(NBComponent parentComponent) {
|
||||
super(parentComponent);
|
||||
public AmqpDriverAdapter(NBComponent parentComponent, NBLabels labels) {
|
||||
super(parentComponent, labels);
|
||||
}
|
||||
|
||||
@Override
|
||||
@ -54,4 +56,13 @@ public class AmqpDriverAdapter extends BaseDriverAdapter<AmqpTimeTrackOp, AmqpSp
|
||||
public NBConfigModel getConfigModel() {
|
||||
return super.getConfigModel().add(AmqpSpace.getConfigModel());
|
||||
}
|
||||
|
||||
@Service(value = DriverAdapterLoader.class,selector = "amqp")
|
||||
public static class Loader implements DriverAdapterLoader {
|
||||
@Override
|
||||
public AmqpDriverAdapter load(NBComponent parent, NBLabels childLabels) {
|
||||
return new AmqpDriverAdapter(parent,childLabels);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -17,12 +17,13 @@
|
||||
package io.nosqlbench.adapter.cqld4;
|
||||
|
||||
import io.nosqlbench.adapters.api.activityimpl.uniform.DriverAdapter;
|
||||
import io.nosqlbench.api.labels.NBLabels;
|
||||
import io.nosqlbench.components.NBComponent;
|
||||
import io.nosqlbench.nb.annotations.Service;
|
||||
|
||||
@Service(value = DriverAdapter.class, selector = "cql")
|
||||
public class CqlDriverAdapterStub extends Cqld4DriverAdapter {
|
||||
public CqlDriverAdapterStub(NBComponent parentComponent) {
|
||||
super(parentComponent);
|
||||
public CqlDriverAdapterStub(NBComponent parentComponent, NBLabels labels) {
|
||||
super(parentComponent, labels);
|
||||
}
|
||||
}
|
||||
|
@ -17,6 +17,7 @@
|
||||
package io.nosqlbench.adapter.cqld4;
|
||||
|
||||
import io.nosqlbench.adapter.cqld4.opmappers.Cqld4CoreOpMapper;
|
||||
import io.nosqlbench.adapter.diag.DriverAdapterLoader;
|
||||
import io.nosqlbench.api.config.standard.NBConfigModel;
|
||||
import io.nosqlbench.api.config.standard.NBConfiguration;
|
||||
import io.nosqlbench.adapters.api.activityimpl.OpMapper;
|
||||
@ -24,6 +25,7 @@ import io.nosqlbench.adapters.api.activityimpl.uniform.BaseDriverAdapter;
|
||||
import io.nosqlbench.adapters.api.activityimpl.uniform.DriverAdapter;
|
||||
import io.nosqlbench.adapters.api.activityimpl.uniform.DriverSpaceCache;
|
||||
import io.nosqlbench.adapters.api.activityimpl.uniform.flowtypes.Op;
|
||||
import io.nosqlbench.api.labels.NBLabels;
|
||||
import io.nosqlbench.components.NBComponent;
|
||||
import io.nosqlbench.nb.annotations.Service;
|
||||
import org.apache.logging.log4j.LogManager;
|
||||
@ -39,8 +41,8 @@ import java.util.function.Function;
|
||||
public class Cqld4DriverAdapter extends BaseDriverAdapter<Op, Cqld4Space> {
|
||||
private final static Logger logger = LogManager.getLogger(Cqld4DriverAdapter.class);
|
||||
|
||||
public Cqld4DriverAdapter(NBComponent parentComponent) {
|
||||
super(parentComponent);
|
||||
public Cqld4DriverAdapter(NBComponent parentComponent, NBLabels labels) {
|
||||
super(parentComponent, labels);
|
||||
}
|
||||
|
||||
@Override
|
||||
@ -106,4 +108,13 @@ public class Cqld4DriverAdapter extends BaseDriverAdapter<Op, Cqld4Space> {
|
||||
|
||||
return remappers;
|
||||
}
|
||||
|
||||
@Service(value = DriverAdapterLoader.class,selector = "cqld4")
|
||||
public static class Loader implements DriverAdapterLoader {
|
||||
@Override
|
||||
public Cqld4DriverAdapter load(NBComponent parent, NBLabels childLabels) {
|
||||
return new Cqld4DriverAdapter(parent,childLabels);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -25,8 +25,8 @@ import io.nosqlbench.adapters.api.activityimpl.OpMapper;
|
||||
import io.nosqlbench.adapters.api.activityimpl.uniform.BaseDriverAdapter;
|
||||
import io.nosqlbench.adapters.api.activityimpl.uniform.DriverAdapter;
|
||||
import io.nosqlbench.adapters.api.activityimpl.uniform.decorators.SyntheticOpTemplateProvider;
|
||||
import io.nosqlbench.api.labels.NBLabels;
|
||||
import io.nosqlbench.components.NBComponent;
|
||||
import io.nosqlbench.components.NBParentComponentInjection;
|
||||
import io.nosqlbench.nb.annotations.Service;
|
||||
import io.nosqlbench.api.config.params.NBParams;
|
||||
import io.nosqlbench.api.config.standard.NBConfigModel;
|
||||
@ -48,8 +48,8 @@ public class DiagDriverAdapter extends BaseDriverAdapter<DiagOp, DiagSpace> impl
|
||||
private DiagOpMapper mapper;
|
||||
|
||||
|
||||
public DiagDriverAdapter(NBComponent parentComponent) {
|
||||
super(parentComponent);
|
||||
public DiagDriverAdapter(NBComponent parentComponent, NBLabels labels) {
|
||||
super(parentComponent, labels);
|
||||
logger.debug("starting up");
|
||||
}
|
||||
|
||||
@ -109,4 +109,5 @@ public class DiagDriverAdapter extends BaseDriverAdapter<DiagOp, DiagSpace> impl
|
||||
public List<OpTemplate> getSyntheticOpTemplates(OpsDocList opsDocList, Map<String, Object> params) {
|
||||
return OpsLoader.loadString("log:level=INFO", OpTemplateFormat.inline, params,null).getOps();
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -0,0 +1,13 @@
|
||||
package io.nosqlbench.adapter.diag;
|
||||
|
||||
import io.nosqlbench.api.labels.NBLabels;
|
||||
import io.nosqlbench.components.NBComponent;
|
||||
import io.nosqlbench.nb.annotations.Service;
|
||||
|
||||
@Service(value = DriverAdapterLoader.class, selector = "diag")
|
||||
public class DiagDriverAdapterLoader implements DriverAdapterLoader {
|
||||
@Override
|
||||
public DiagDriverAdapter load(NBComponent parent, NBLabels childLabels) {
|
||||
return new DiagDriverAdapter(parent, childLabels);
|
||||
}
|
||||
}
|
@ -22,6 +22,7 @@ import io.nosqlbench.adapters.api.templating.ParsedOp;
|
||||
import io.nosqlbench.api.config.standard.NBConfigModel;
|
||||
import io.nosqlbench.api.config.standard.NBConfiguration;
|
||||
import io.nosqlbench.api.config.standard.NBReconfigurable;
|
||||
import io.nosqlbench.components.NBParentComponentInjection;
|
||||
import io.nosqlbench.engine.api.activityapi.ratelimits.RateLimiter;
|
||||
import io.nosqlbench.nb.annotations.ServiceSelector;
|
||||
import org.apache.logging.log4j.LogManager;
|
||||
@ -67,6 +68,9 @@ public class DiagOpDispenser extends BaseOpDispenser<DiagOp,DiagSpace> implement
|
||||
// Dynamically load the named task instance, based on the op field key AKA the taskname
|
||||
// and ensure that exactly one is found or throw an error
|
||||
DiagTask task = ServiceSelector.of(optype, ServiceLoader.load(DiagTask.class)).getOne();
|
||||
if (task instanceof NBParentComponentInjection parentAware) {
|
||||
parentAware.applyParentComponent(op);
|
||||
}
|
||||
task.setLabelsFrom(op);
|
||||
task.setName(opname);
|
||||
|
||||
|
@ -18,7 +18,6 @@ package io.nosqlbench.adapter.diag.optasks;
|
||||
|
||||
import io.nosqlbench.api.labels.NBLabeledElement;
|
||||
import io.nosqlbench.api.labels.NBLabels;
|
||||
import io.nosqlbench.components.NBBaseComponent;
|
||||
import io.nosqlbench.components.NBComponent;
|
||||
|
||||
import java.util.Map;
|
||||
|
@ -22,6 +22,7 @@ import io.nosqlbench.api.config.standard.NBConfigModel;
|
||||
import io.nosqlbench.api.config.standard.NBConfiguration;
|
||||
import io.nosqlbench.api.config.standard.Param;
|
||||
import io.nosqlbench.api.labels.NBLabels;
|
||||
import io.nosqlbench.components.NBParentComponentInjection;
|
||||
import io.nosqlbench.nb.annotations.Service;
|
||||
import io.nosqlbench.virtdata.api.bindings.VirtDataConversions;
|
||||
import io.nosqlbench.virtdata.core.bindings.DataMapper;
|
||||
@ -78,7 +79,7 @@ import java.util.function.LongToDoubleFunction;
|
||||
*
|
||||
*/
|
||||
@Service(value= DiagTask.class,selector="gauge")
|
||||
public class DiagTask_gauge extends BaseDiagTask implements Gauge<Double> {
|
||||
public class DiagTask_gauge extends BaseDiagTask implements Gauge<Double>, NBParentComponentInjection {
|
||||
private final static Logger logger = LogManager.getLogger("DIAG");
|
||||
|
||||
// TODO: allow for temporal filtering
|
||||
|
@ -17,7 +17,9 @@
|
||||
package io.nosqlbench.adapter.diag.optasks;
|
||||
|
||||
import io.nosqlbench.api.config.standard.NBConfiguration;
|
||||
import io.nosqlbench.api.config.standard.TestComponent;
|
||||
import io.nosqlbench.api.labels.NBLabeledElement;
|
||||
import io.nosqlbench.components.NBComponent;
|
||||
import org.assertj.core.data.Offset;
|
||||
import org.junit.jupiter.api.Test;
|
||||
|
||||
@ -27,9 +29,11 @@ import static org.assertj.core.api.Assertions.assertThat;
|
||||
|
||||
public class DiagTask_gaugeTest {
|
||||
|
||||
private NBComponent parent = new TestComponent("DiagTask_gaugeTest","DiagTask_gauge");
|
||||
@Test
|
||||
public void testAvg() {
|
||||
DiagTask_gauge gaugeTask = new DiagTask_gauge();
|
||||
gaugeTask.applyParentComponent(parent);
|
||||
gaugeTask.setName("test");
|
||||
gaugeTask.setLabelsFrom(NBLabeledElement.EMPTY);
|
||||
NBConfiguration taskConfig = gaugeTask.getConfigModel().apply(Map.of(
|
||||
@ -48,6 +52,7 @@ public class DiagTask_gaugeTest {
|
||||
@Test
|
||||
public void testMin() {
|
||||
DiagTask_gauge gaugeTask = new DiagTask_gauge();
|
||||
gaugeTask.applyParentComponent(parent);
|
||||
gaugeTask.setName("test");
|
||||
gaugeTask.setLabelsFrom(NBLabeledElement.EMPTY);
|
||||
NBConfiguration taskConfig = gaugeTask.getConfigModel().apply(Map.of(
|
||||
@ -67,6 +72,7 @@ public class DiagTask_gaugeTest {
|
||||
@Test
|
||||
public void testMax() {
|
||||
DiagTask_gauge gaugeTask = new DiagTask_gauge();
|
||||
gaugeTask.applyParentComponent(parent);
|
||||
gaugeTask.setName("test");
|
||||
gaugeTask.setLabelsFrom(NBLabeledElement.EMPTY);
|
||||
NBConfiguration taskConfig = gaugeTask.getConfigModel().apply(Map.of(
|
||||
|
@ -16,11 +16,13 @@
|
||||
|
||||
package io.nosqlbench.adapter.dynamodb;
|
||||
|
||||
import io.nosqlbench.adapter.diag.DriverAdapterLoader;
|
||||
import io.nosqlbench.adapter.dynamodb.optypes.DynamoDBOp;
|
||||
import io.nosqlbench.adapters.api.activityimpl.OpMapper;
|
||||
import io.nosqlbench.adapters.api.activityimpl.uniform.BaseDriverAdapter;
|
||||
import io.nosqlbench.adapters.api.activityimpl.uniform.DriverAdapter;
|
||||
import io.nosqlbench.adapters.api.activityimpl.uniform.DriverSpaceCache;
|
||||
import io.nosqlbench.api.labels.NBLabels;
|
||||
import io.nosqlbench.components.NBComponent;
|
||||
import io.nosqlbench.nb.annotations.Maturity;
|
||||
import io.nosqlbench.nb.annotations.Service;
|
||||
@ -32,8 +34,8 @@ import java.util.function.Function;
|
||||
@Service(value = DriverAdapter.class, selector = "dynamodb", maturity = Maturity.Experimental)
|
||||
public class DynamoDBDriverAdapter extends BaseDriverAdapter<DynamoDBOp, DynamoDBSpace> {
|
||||
|
||||
public DynamoDBDriverAdapter(NBComponent parentComponent) {
|
||||
super(parentComponent);
|
||||
public DynamoDBDriverAdapter(NBComponent parentComponent, NBLabels labels) {
|
||||
super(parentComponent, labels);
|
||||
}
|
||||
|
||||
@Override
|
||||
@ -52,4 +54,13 @@ public class DynamoDBDriverAdapter extends BaseDriverAdapter<DynamoDBOp, DynamoD
|
||||
public NBConfigModel getConfigModel() {
|
||||
return super.getConfigModel().add(DynamoDBSpace.getConfigModel());
|
||||
}
|
||||
|
||||
@Service(value = DriverAdapterLoader.class,selector = "dynamodb")
|
||||
public static class Loader implements DriverAdapterLoader {
|
||||
@Override
|
||||
public DynamoDBDriverAdapter load(NBComponent parent, NBLabels childLabels) {
|
||||
return new DynamoDBDriverAdapter(parent,childLabels);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -16,6 +16,7 @@
|
||||
|
||||
package io.nosqlbench.adapter.http;
|
||||
|
||||
import io.nosqlbench.adapter.diag.DriverAdapterLoader;
|
||||
import io.nosqlbench.adapter.http.core.HttpFormatParser;
|
||||
import io.nosqlbench.adapter.http.core.HttpOp;
|
||||
import io.nosqlbench.adapter.http.core.HttpOpMapper;
|
||||
@ -26,6 +27,7 @@ import io.nosqlbench.adapters.api.activityimpl.OpMapper;
|
||||
import io.nosqlbench.adapters.api.activityimpl.uniform.BaseDriverAdapter;
|
||||
import io.nosqlbench.adapters.api.activityimpl.uniform.DriverAdapter;
|
||||
import io.nosqlbench.adapters.api.activityimpl.uniform.DriverSpaceCache;
|
||||
import io.nosqlbench.api.labels.NBLabels;
|
||||
import io.nosqlbench.components.NBComponent;
|
||||
import io.nosqlbench.nb.annotations.Service;
|
||||
import io.nosqlbench.api.config.standard.NBConfigModel;
|
||||
@ -40,8 +42,8 @@ import java.util.function.Function;
|
||||
@Service(value = DriverAdapter.class, selector = "http")
|
||||
public class HttpDriverAdapter extends BaseDriverAdapter<HttpOp, HttpSpace> {
|
||||
|
||||
public HttpDriverAdapter(NBComponent parent) {
|
||||
super(parent);
|
||||
public HttpDriverAdapter(NBComponent parent, NBLabels labels) {
|
||||
super(parent, labels);
|
||||
}
|
||||
|
||||
@Override
|
||||
@ -82,4 +84,13 @@ public class HttpDriverAdapter extends BaseDriverAdapter<HttpOp, HttpSpace> {
|
||||
|
||||
return super.getConfigModel().add(HttpSpace.getConfigModel()).add(thisCfgModel);
|
||||
}
|
||||
|
||||
@Service(value = DriverAdapterLoader.class,selector = "http")
|
||||
public static class Loader implements DriverAdapterLoader {
|
||||
@Override
|
||||
public HttpDriverAdapter load(NBComponent parent, NBLabels childLabels) {
|
||||
return new HttpDriverAdapter(parent,childLabels);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -27,6 +27,7 @@ import io.nosqlbench.adapters.api.activityconfig.yaml.OpTemplateFormat;
|
||||
import io.nosqlbench.adapters.api.activityconfig.yaml.OpsDocList;
|
||||
import io.nosqlbench.adapters.api.activityimpl.uniform.DriverSpaceCache;
|
||||
import io.nosqlbench.adapters.api.templating.ParsedOp;
|
||||
import io.nosqlbench.api.labels.NBLabels;
|
||||
import io.nosqlbench.components.NBComponent;
|
||||
import org.apache.logging.log4j.LogManager;
|
||||
import org.apache.logging.log4j.Logger;
|
||||
@ -50,7 +51,7 @@ public class HttpOpMapperTest {
|
||||
@BeforeAll
|
||||
public static void initializeTestMapper() {
|
||||
HttpOpMapperTest.cfg = HttpSpace.getConfigModel().apply(Map.of());
|
||||
HttpOpMapperTest.adapter = new HttpDriverAdapter(parent);
|
||||
HttpOpMapperTest.adapter = new HttpDriverAdapter(parent, NBLabels.forKV());
|
||||
HttpOpMapperTest.adapter.applyConfig(HttpOpMapperTest.cfg);
|
||||
final DriverSpaceCache<? extends HttpSpace> cache = HttpOpMapperTest.adapter.getSpaceCache();
|
||||
HttpOpMapperTest.mapper = new HttpOpMapper(HttpOpMapperTest.adapter, HttpOpMapperTest.cfg, cache);
|
||||
|
@ -23,6 +23,7 @@ import io.nosqlbench.adapters.api.activityimpl.OpMapper;
|
||||
import io.nosqlbench.adapters.api.activityimpl.uniform.BaseDriverAdapter;
|
||||
import io.nosqlbench.adapters.api.activityimpl.uniform.DriverAdapter;
|
||||
import io.nosqlbench.adapters.api.activityimpl.uniform.DriverSpaceCache;
|
||||
import io.nosqlbench.api.labels.NBLabels;
|
||||
import io.nosqlbench.components.NBComponent;
|
||||
import io.nosqlbench.nb.annotations.Service;
|
||||
import org.apache.logging.log4j.LogManager;
|
||||
@ -34,8 +35,8 @@ import java.util.function.Function;
|
||||
public class JDBCDriverAdapter extends BaseDriverAdapter<JDBCOp, JDBCSpace> {
|
||||
private final static Logger logger = LogManager.getLogger(JDBCDriverAdapter.class);
|
||||
|
||||
public JDBCDriverAdapter(NBComponent parentComponent) {
|
||||
super(parentComponent);
|
||||
public JDBCDriverAdapter(NBComponent parentComponent, NBLabels labels) {
|
||||
super(parentComponent,labels);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -16,6 +16,7 @@
|
||||
|
||||
package io.nosqlbench.adapter.kafka;
|
||||
|
||||
import io.nosqlbench.adapter.diag.DriverAdapterLoader;
|
||||
import io.nosqlbench.adapter.kafka.ops.KafkaOp;
|
||||
import io.nosqlbench.api.config.standard.NBConfigModel;
|
||||
import io.nosqlbench.api.config.standard.NBConfiguration;
|
||||
@ -23,6 +24,7 @@ import io.nosqlbench.adapters.api.activityimpl.OpMapper;
|
||||
import io.nosqlbench.adapters.api.activityimpl.uniform.BaseDriverAdapter;
|
||||
import io.nosqlbench.adapters.api.activityimpl.uniform.DriverAdapter;
|
||||
import io.nosqlbench.adapters.api.activityimpl.uniform.DriverSpaceCache;
|
||||
import io.nosqlbench.api.labels.NBLabels;
|
||||
import io.nosqlbench.components.NBComponent;
|
||||
import io.nosqlbench.nb.annotations.Service;
|
||||
import org.apache.logging.log4j.LogManager;
|
||||
@ -34,8 +36,8 @@ import java.util.function.Function;
|
||||
public class KafkaDriverAdapter extends BaseDriverAdapter<KafkaOp, KafkaSpace> {
|
||||
private final static Logger logger = LogManager.getLogger(KafkaDriverAdapter.class);
|
||||
|
||||
public KafkaDriverAdapter(NBComponent parentComponent) {
|
||||
super(parentComponent);
|
||||
public KafkaDriverAdapter(NBComponent parentComponent, NBLabels labels) {
|
||||
super(parentComponent, labels);
|
||||
}
|
||||
|
||||
@Override
|
||||
@ -54,4 +56,12 @@ public class KafkaDriverAdapter extends BaseDriverAdapter<KafkaOp, KafkaSpace> {
|
||||
public NBConfigModel getConfigModel() {
|
||||
return super.getConfigModel().add(KafkaSpace.getConfigModel());
|
||||
}
|
||||
@Service(value = DriverAdapterLoader.class,selector = "kafka")
|
||||
public static class Loader implements DriverAdapterLoader {
|
||||
@Override
|
||||
public KafkaDriverAdapter load(NBComponent parent, NBLabels childLabels) {
|
||||
return new KafkaDriverAdapter(parent,childLabels);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -16,12 +16,14 @@
|
||||
|
||||
package io.nosqlbench.adapter.mongodb.core;
|
||||
|
||||
import io.nosqlbench.adapter.diag.DriverAdapterLoader;
|
||||
import io.nosqlbench.api.config.standard.NBConfigModel;
|
||||
import io.nosqlbench.api.config.standard.NBConfiguration;
|
||||
import io.nosqlbench.adapters.api.activityimpl.OpMapper;
|
||||
import io.nosqlbench.adapters.api.activityimpl.uniform.BaseDriverAdapter;
|
||||
import io.nosqlbench.adapters.api.activityimpl.uniform.DriverAdapter;
|
||||
import io.nosqlbench.adapters.api.activityimpl.uniform.flowtypes.Op;
|
||||
import io.nosqlbench.api.labels.NBLabels;
|
||||
import io.nosqlbench.components.NBComponent;
|
||||
import io.nosqlbench.nb.annotations.Service;
|
||||
|
||||
@ -33,8 +35,8 @@ import java.util.function.Function;
|
||||
@Service(value = DriverAdapter.class, selector = "mongodb")
|
||||
public class MongodbDriverAdapter extends BaseDriverAdapter<Op, MongoSpace> {
|
||||
|
||||
public MongodbDriverAdapter(NBComponent parentComponent) {
|
||||
super(parentComponent);
|
||||
public MongodbDriverAdapter(NBComponent parentComponent, NBLabels labels) {
|
||||
super(parentComponent, labels);
|
||||
}
|
||||
|
||||
@Override
|
||||
@ -51,4 +53,13 @@ public class MongodbDriverAdapter extends BaseDriverAdapter<Op, MongoSpace> {
|
||||
public NBConfigModel getConfigModel() {
|
||||
return super.getConfigModel().add(MongoSpace.getConfigModel());
|
||||
}
|
||||
|
||||
@Service(value = DriverAdapterLoader.class,selector = "mongodb")
|
||||
public static class Loader implements DriverAdapterLoader {
|
||||
@Override
|
||||
public MongodbDriverAdapter load(NBComponent parent, NBLabels childLabels) {
|
||||
return new MongodbDriverAdapter(parent,childLabels);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -16,6 +16,7 @@
|
||||
|
||||
package io.nosqlbench.adapter.pinecone;
|
||||
|
||||
import io.nosqlbench.adapter.diag.DriverAdapterLoader;
|
||||
import io.nosqlbench.adapter.pinecone.ops.PineconeOp;
|
||||
import io.nosqlbench.api.config.standard.NBConfigModel;
|
||||
import io.nosqlbench.api.config.standard.NBConfiguration;
|
||||
@ -23,6 +24,7 @@ import io.nosqlbench.adapters.api.activityimpl.OpMapper;
|
||||
import io.nosqlbench.adapters.api.activityimpl.uniform.BaseDriverAdapter;
|
||||
import io.nosqlbench.adapters.api.activityimpl.uniform.DriverAdapter;
|
||||
import io.nosqlbench.adapters.api.activityimpl.uniform.DriverSpaceCache;
|
||||
import io.nosqlbench.api.labels.NBLabels;
|
||||
import io.nosqlbench.components.NBComponent;
|
||||
import io.nosqlbench.nb.annotations.Service;
|
||||
|
||||
@ -31,8 +33,8 @@ import java.util.function.Function;
|
||||
@Service(value = DriverAdapter.class, selector = "pinecone")
|
||||
public class PineconeDriverAdapter extends BaseDriverAdapter<PineconeOp, PineconeSpace> {
|
||||
|
||||
public PineconeDriverAdapter(NBComponent parentComponent) {
|
||||
super(parentComponent);
|
||||
public PineconeDriverAdapter(NBComponent parentComponent, NBLabels labels) {
|
||||
super(parentComponent, labels);
|
||||
}
|
||||
|
||||
@Override
|
||||
@ -52,4 +54,12 @@ public class PineconeDriverAdapter extends BaseDriverAdapter<PineconeOp, Pinecon
|
||||
return super.getConfigModel().add(PineconeSpace.getConfigModel());
|
||||
}
|
||||
|
||||
@Service(value = DriverAdapterLoader.class,selector = "pinecone")
|
||||
public static class Loader implements DriverAdapterLoader {
|
||||
@Override
|
||||
public PineconeDriverAdapter load(NBComponent parent, NBLabels childLabels) {
|
||||
return new PineconeDriverAdapter(parent,childLabels);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -16,11 +16,13 @@
|
||||
|
||||
package io.nosqlbench.adapter.pulsar;
|
||||
|
||||
import io.nosqlbench.adapter.diag.DriverAdapterLoader;
|
||||
import io.nosqlbench.adapter.pulsar.ops.PulsarOp;
|
||||
import io.nosqlbench.adapters.api.activityimpl.OpMapper;
|
||||
import io.nosqlbench.adapters.api.activityimpl.uniform.BaseDriverAdapter;
|
||||
import io.nosqlbench.adapters.api.activityimpl.uniform.DriverAdapter;
|
||||
import io.nosqlbench.adapters.api.activityimpl.uniform.DriverSpaceCache;
|
||||
import io.nosqlbench.api.labels.NBLabels;
|
||||
import io.nosqlbench.components.NBComponent;
|
||||
import io.nosqlbench.nb.annotations.Service;
|
||||
import io.nosqlbench.api.config.standard.NBConfigModel;
|
||||
@ -35,8 +37,8 @@ public class PulsarDriverAdapter extends BaseDriverAdapter<PulsarOp, PulsarSpace
|
||||
|
||||
private final static Logger logger = LogManager.getLogger(PulsarDriverAdapter.class);
|
||||
|
||||
public PulsarDriverAdapter(NBComponent parentComponent) {
|
||||
super(parentComponent);
|
||||
public PulsarDriverAdapter(NBComponent parentComponent, NBLabels labels) {
|
||||
super(parentComponent,labels);
|
||||
}
|
||||
|
||||
@Override
|
||||
@ -55,4 +57,13 @@ public class PulsarDriverAdapter extends BaseDriverAdapter<PulsarOp, PulsarSpace
|
||||
public NBConfigModel getConfigModel() {
|
||||
return super.getConfigModel().add(PulsarSpace.getConfigModel());
|
||||
}
|
||||
|
||||
@Service(value = DriverAdapterLoader.class,selector = "pulsar")
|
||||
public static class Loader implements DriverAdapterLoader {
|
||||
@Override
|
||||
public PulsarDriverAdapter load(NBComponent parent, NBLabels childLabels) {
|
||||
return new PulsarDriverAdapter(parent,childLabels);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -16,6 +16,7 @@
|
||||
|
||||
package io.nosqlbench.adapter.s4j;
|
||||
|
||||
import io.nosqlbench.adapter.diag.DriverAdapterLoader;
|
||||
import io.nosqlbench.adapter.s4j.ops.S4JOp;
|
||||
import io.nosqlbench.api.config.standard.NBConfigModel;
|
||||
import io.nosqlbench.api.config.standard.NBConfiguration;
|
||||
@ -23,6 +24,7 @@ import io.nosqlbench.adapters.api.activityimpl.OpMapper;
|
||||
import io.nosqlbench.adapters.api.activityimpl.uniform.BaseDriverAdapter;
|
||||
import io.nosqlbench.adapters.api.activityimpl.uniform.DriverAdapter;
|
||||
import io.nosqlbench.adapters.api.activityimpl.uniform.DriverSpaceCache;
|
||||
import io.nosqlbench.api.labels.NBLabels;
|
||||
import io.nosqlbench.components.NBComponent;
|
||||
import io.nosqlbench.nb.annotations.Service;
|
||||
import org.apache.logging.log4j.LogManager;
|
||||
@ -34,8 +36,8 @@ import java.util.function.Function;
|
||||
public class S4JDriverAdapter extends BaseDriverAdapter<S4JOp, S4JSpace> {
|
||||
private final static Logger logger = LogManager.getLogger(S4JDriverAdapter.class);
|
||||
|
||||
public S4JDriverAdapter(NBComponent parentComponent) {
|
||||
super(parentComponent);
|
||||
public S4JDriverAdapter(NBComponent parentComponent, NBLabels labels) {
|
||||
super(parentComponent, labels);
|
||||
}
|
||||
|
||||
@Override
|
||||
@ -54,4 +56,13 @@ public class S4JDriverAdapter extends BaseDriverAdapter<S4JOp, S4JSpace> {
|
||||
public NBConfigModel getConfigModel() {
|
||||
return super.getConfigModel().add(S4JSpace.getConfigModel());
|
||||
}
|
||||
|
||||
@Service(value = DriverAdapterLoader.class,selector = "s4j")
|
||||
public static class Loader implements DriverAdapterLoader {
|
||||
@Override
|
||||
public S4JDriverAdapter load(NBComponent parent, NBLabels childLabels) {
|
||||
return new S4JDriverAdapter(parent,childLabels);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -16,6 +16,7 @@
|
||||
|
||||
package io.nosqlbench.adapter.stdout;
|
||||
|
||||
import io.nosqlbench.adapter.diag.DriverAdapterLoader;
|
||||
import io.nosqlbench.adapters.api.activityconfig.yaml.OpData;
|
||||
import io.nosqlbench.adapters.api.activityconfig.yaml.OpTemplate;
|
||||
import io.nosqlbench.adapters.api.activityconfig.yaml.OpsDocList;
|
||||
@ -24,6 +25,7 @@ import io.nosqlbench.adapters.api.activityimpl.uniform.BaseDriverAdapter;
|
||||
import io.nosqlbench.adapters.api.activityimpl.uniform.DriverAdapter;
|
||||
import io.nosqlbench.adapters.api.activityimpl.uniform.DriverSpaceCache;
|
||||
import io.nosqlbench.adapters.api.activityimpl.uniform.decorators.SyntheticOpTemplateProvider;
|
||||
import io.nosqlbench.api.labels.NBLabels;
|
||||
import io.nosqlbench.components.NBComponent;
|
||||
import io.nosqlbench.nb.annotations.Service;
|
||||
import io.nosqlbench.api.config.standard.ConfigModel;
|
||||
@ -41,8 +43,8 @@ import java.util.stream.Collectors;
|
||||
public class StdoutDriverAdapter extends BaseDriverAdapter<StdoutOp, StdoutSpace> implements SyntheticOpTemplateProvider {
|
||||
private final static Logger logger = LogManager.getLogger(StdoutDriverAdapter.class);
|
||||
|
||||
public StdoutDriverAdapter(NBComponent parentComponent) {
|
||||
super(parentComponent);
|
||||
public StdoutDriverAdapter(NBComponent parentComponent, NBLabels labels) {
|
||||
super(parentComponent, labels);
|
||||
}
|
||||
|
||||
@Override
|
||||
@ -114,4 +116,13 @@ public class StdoutDriverAdapter extends BaseDriverAdapter<StdoutOp, StdoutSpace
|
||||
return stmtTemplate;
|
||||
}
|
||||
|
||||
@Service(value = DriverAdapterLoader.class,selector = "stdout")
|
||||
public static class Loader implements DriverAdapterLoader {
|
||||
@Override
|
||||
public StdoutDriverAdapter load(NBComponent parent, NBLabels childLabels) {
|
||||
return new StdoutDriverAdapter(parent,childLabels);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
@ -16,6 +16,7 @@
|
||||
|
||||
package io.nosqlbench.adapter.tcpclient;
|
||||
|
||||
import io.nosqlbench.adapter.diag.DriverAdapterLoader;
|
||||
import io.nosqlbench.adapter.stdout.StdoutDriverAdapter;
|
||||
import io.nosqlbench.api.config.standard.ConfigModel;
|
||||
import io.nosqlbench.api.config.standard.NBConfigModel;
|
||||
@ -27,6 +28,7 @@ import io.nosqlbench.adapters.api.activityimpl.uniform.BaseDriverAdapter;
|
||||
import io.nosqlbench.adapters.api.activityimpl.uniform.DriverAdapter;
|
||||
import io.nosqlbench.adapters.api.activityimpl.uniform.DriverSpaceCache;
|
||||
import io.nosqlbench.adapters.api.activityimpl.uniform.decorators.SyntheticOpTemplateProvider;
|
||||
import io.nosqlbench.api.labels.NBLabels;
|
||||
import io.nosqlbench.components.NBComponent;
|
||||
import io.nosqlbench.nb.annotations.Service;
|
||||
import org.apache.logging.log4j.LogManager;
|
||||
@ -41,9 +43,9 @@ public class TcpClientDriverAdapter extends BaseDriverAdapter<TcpClientOp, TcpCl
|
||||
|
||||
private final StdoutDriverAdapter adap;
|
||||
|
||||
public TcpClientDriverAdapter(NBComponent parentComponent) {
|
||||
super(parentComponent);
|
||||
adap=new StdoutDriverAdapter(parentComponent);
|
||||
public TcpClientDriverAdapter(NBComponent parentComponent, NBLabels labels) {
|
||||
super(parentComponent,labels);
|
||||
adap=new StdoutDriverAdapter(parentComponent, labels);
|
||||
}
|
||||
|
||||
@Override
|
||||
@ -69,4 +71,12 @@ public class TcpClientDriverAdapter extends BaseDriverAdapter<TcpClientOp, TcpCl
|
||||
return adap.getSyntheticOpTemplates(opsDocList, cfg);
|
||||
}
|
||||
|
||||
@Service(value = DriverAdapterLoader.class,selector = "tcpclient")
|
||||
public static class Loader implements DriverAdapterLoader {
|
||||
@Override
|
||||
public TcpClientDriverAdapter load(NBComponent parent, NBLabels childLabels) {
|
||||
return new TcpClientDriverAdapter(parent,childLabels);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -15,6 +15,7 @@
|
||||
*/
|
||||
|
||||
package io.nosqlbench.adapter.tcpserver;
|
||||
import io.nosqlbench.adapter.diag.DriverAdapterLoader;
|
||||
import io.nosqlbench.adapter.stdout.StdoutDriverAdapter;
|
||||
import io.nosqlbench.api.config.standard.ConfigModel;
|
||||
import io.nosqlbench.api.config.standard.NBConfigModel;
|
||||
@ -26,6 +27,7 @@ import io.nosqlbench.adapters.api.activityimpl.uniform.BaseDriverAdapter;
|
||||
import io.nosqlbench.adapters.api.activityimpl.uniform.DriverAdapter;
|
||||
import io.nosqlbench.adapters.api.activityimpl.uniform.DriverSpaceCache;
|
||||
import io.nosqlbench.adapters.api.activityimpl.uniform.decorators.SyntheticOpTemplateProvider;
|
||||
import io.nosqlbench.api.labels.NBLabels;
|
||||
import io.nosqlbench.components.NBComponent;
|
||||
import io.nosqlbench.nb.annotations.Service;
|
||||
import org.apache.logging.log4j.LogManager;
|
||||
@ -40,9 +42,9 @@ public class TcpServerDriverAdapter extends BaseDriverAdapter<TcpServerOp, TcpSe
|
||||
|
||||
private final StdoutDriverAdapter adap;
|
||||
|
||||
public TcpServerDriverAdapter(NBComponent parentComponent) {
|
||||
super(parentComponent);
|
||||
adap = new StdoutDriverAdapter(parentComponent);
|
||||
public TcpServerDriverAdapter(NBComponent parentComponent, NBLabels labels) {
|
||||
super(parentComponent, labels);
|
||||
adap = new StdoutDriverAdapter(parentComponent, labels);
|
||||
}
|
||||
|
||||
@Override
|
||||
@ -67,4 +69,5 @@ public class TcpServerDriverAdapter extends BaseDriverAdapter<TcpServerOp, TcpSe
|
||||
public List<OpTemplate> getSyntheticOpTemplates(OpsDocList opsDocList, Map<String,Object> cfg) {
|
||||
return adap.getSyntheticOpTemplates(opsDocList, cfg);
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -0,0 +1,14 @@
|
||||
package io.nosqlbench.adapter.tcpserver;
|
||||
|
||||
import io.nosqlbench.adapter.diag.DriverAdapterLoader;
|
||||
import io.nosqlbench.api.labels.NBLabels;
|
||||
import io.nosqlbench.components.NBComponent;
|
||||
import io.nosqlbench.nb.annotations.Service;
|
||||
|
||||
@Service(value = DriverAdapterLoader.class, selector = "tcpserver")
|
||||
public class TcpServerDriverAdapterLoader implements DriverAdapterLoader {
|
||||
@Override
|
||||
public TcpServerDriverAdapter load(NBComponent parent, NBLabels childLabels) {
|
||||
return new TcpServerDriverAdapter(parent, childLabels);
|
||||
}
|
||||
}
|
@ -0,0 +1,28 @@
|
||||
package io.nosqlbench.adapter.diag;
|
||||
|
||||
/*
|
||||
* Copyright (c) 2022 nosqlbench
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing,
|
||||
* software distributed under the License is distributed on an
|
||||
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
||||
* KIND, either express or implied. See the License for the
|
||||
* specific language governing permissions and limitations
|
||||
* under the License.
|
||||
*/
|
||||
|
||||
|
||||
import io.nosqlbench.adapters.api.activityimpl.uniform.DriverAdapter;
|
||||
import io.nosqlbench.adapters.api.activityimpl.uniform.flowtypes.Op;
|
||||
import io.nosqlbench.api.labels.NBLabels;
|
||||
import io.nosqlbench.components.NBComponent;
|
||||
|
||||
public interface DriverAdapterLoader {
|
||||
public <A extends Op,B> DriverAdapter<A,B> load(NBComponent parent, NBLabels childLabels);
|
||||
}
|
@ -23,11 +23,9 @@ import io.nosqlbench.adapters.api.activityimpl.uniform.flowtypes.Op;
|
||||
import io.nosqlbench.adapters.api.evalcontext.*;
|
||||
import io.nosqlbench.adapters.api.metrics.ThreadLocalNamedTimers;
|
||||
import io.nosqlbench.adapters.api.templating.ParsedOp;
|
||||
import io.nosqlbench.api.labels.NBLabeledElement;
|
||||
import io.nosqlbench.api.labels.NBLabels;
|
||||
import io.nosqlbench.api.errors.OpConfigError;
|
||||
import io.nosqlbench.components.NBBaseComponent;
|
||||
import io.nosqlbench.components.NBComponent;
|
||||
import io.nosqlbench.virtdata.core.templates.ParsedTemplateString;
|
||||
import org.apache.logging.log4j.LogManager;
|
||||
import org.apache.logging.log4j.Logger;
|
||||
|
@ -20,8 +20,9 @@ import io.nosqlbench.adapters.api.activityimpl.uniform.flowtypes.Op;
|
||||
import io.nosqlbench.api.config.standard.*;
|
||||
import io.nosqlbench.adapters.api.activityimpl.uniform.fieldmappers.FieldDestructuringMapper;
|
||||
import io.nosqlbench.adapters.api.templating.ParsedOp;
|
||||
import io.nosqlbench.components.NBBaseComponent;
|
||||
import io.nosqlbench.api.labels.NBLabels;
|
||||
import io.nosqlbench.components.NBComponent;
|
||||
import io.nosqlbench.components.NBBaseComponent;
|
||||
import org.apache.logging.log4j.LogManager;
|
||||
import org.apache.logging.log4j.Logger;
|
||||
|
||||
@ -40,8 +41,8 @@ public abstract class BaseDriverAdapter<R extends Op, S> extends NBBaseComponent
|
||||
private NBConfiguration cfg;
|
||||
private LongFunction<S> spaceF;
|
||||
|
||||
public BaseDriverAdapter(NBComponent parentComponent) {
|
||||
super(parentComponent);
|
||||
public BaseDriverAdapter(NBComponent parentComponent, NBLabels labels) {
|
||||
super(parentComponent, labels);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -25,8 +25,8 @@ import io.nosqlbench.api.config.fieldreaders.StaticFieldReader;
|
||||
import io.nosqlbench.api.config.standard.NBConfigError;
|
||||
import io.nosqlbench.api.config.standard.NBConfiguration;
|
||||
import io.nosqlbench.api.errors.OpConfigError;
|
||||
import io.nosqlbench.components.NBBaseComponent;
|
||||
import io.nosqlbench.components.NBComponent;
|
||||
import io.nosqlbench.components.NBBaseComponent;
|
||||
import io.nosqlbench.engine.api.templating.ObjectCache;
|
||||
import io.nosqlbench.engine.api.templating.ParsedTemplateMap;
|
||||
import io.nosqlbench.engine.api.templating.TypeAndTarget;
|
||||
@ -300,7 +300,7 @@ import java.util.function.LongFunction;
|
||||
* in the activity parameters if needed to find a missing configuration parameter, but this will only work if
|
||||
* the specific named parameter is allowed at the activity level.</P>
|
||||
*/
|
||||
public class ParsedOp extends NBBaseComponent implements LongFunction<Map<String, ?>>, NBLabeledElement, StaticFieldReader, DynamicFieldReader {
|
||||
public class ParsedOp extends NBBaseComponent implements LongFunction<Map<String, ?>>, NBComponent, StaticFieldReader, DynamicFieldReader {
|
||||
|
||||
private static final Logger logger = LogManager.getLogger(ParsedOp.class);
|
||||
|
||||
@ -948,11 +948,6 @@ public class ParsedOp extends NBBaseComponent implements LongFunction<Map<String
|
||||
return tmap.getCaptures();
|
||||
}
|
||||
|
||||
@Override
|
||||
public NBLabels getLabels() {
|
||||
return labels;
|
||||
}
|
||||
|
||||
public Map<String, String> getBindPoints() {
|
||||
return null;
|
||||
}
|
||||
|
@ -18,8 +18,8 @@ package io.nosqlbench.engine.api.activityapi.ratelimits;
|
||||
|
||||
import com.codahale.metrics.Gauge;
|
||||
import io.nosqlbench.api.labels.NBLabeledElement;
|
||||
import io.nosqlbench.components.NBBaseComponent;
|
||||
import io.nosqlbench.components.NBComponent;
|
||||
import io.nosqlbench.components.NBBaseComponent;
|
||||
import io.nosqlbench.nb.annotations.Service;
|
||||
import org.apache.logging.log4j.LogManager;
|
||||
import org.apache.logging.log4j.Logger;
|
||||
|
@ -16,7 +16,6 @@
|
||||
|
||||
package io.nosqlbench.engine.api.activityimpl;
|
||||
|
||||
import com.codahale.metrics.Timer;
|
||||
import io.nosqlbench.components.NBComponent;
|
||||
import io.nosqlbench.components.NBBaseComponent;
|
||||
import io.nosqlbench.engine.api.activityapi.core.*;
|
||||
|
@ -18,8 +18,8 @@ package io.nosqlbench.engine.api.activityimpl.input;
|
||||
import com.codahale.metrics.Gauge;
|
||||
import io.nosqlbench.api.engine.activityimpl.ActivityDef;
|
||||
import io.nosqlbench.api.engine.activityimpl.CyclesSpec;
|
||||
import io.nosqlbench.components.NBBaseComponent;
|
||||
import io.nosqlbench.components.NBComponent;
|
||||
import io.nosqlbench.components.NBBaseComponent;
|
||||
import io.nosqlbench.engine.api.activityapi.core.ActivityDefObserver;
|
||||
import io.nosqlbench.engine.api.activityapi.cyclelog.buffers.results.CycleSegment;
|
||||
import io.nosqlbench.engine.api.activityapi.input.Input;
|
||||
|
@ -17,6 +17,7 @@
|
||||
package io.nosqlbench.engine.api.activityimpl.uniform;
|
||||
|
||||
import com.codahale.metrics.Gauge;
|
||||
import io.nosqlbench.adapter.diag.DriverAdapterLoader;
|
||||
import io.nosqlbench.adapters.api.activityconfig.OpsLoader;
|
||||
import io.nosqlbench.adapters.api.activityconfig.yaml.OpTemplate;
|
||||
import io.nosqlbench.adapters.api.activityconfig.yaml.OpsDocList;
|
||||
@ -33,6 +34,7 @@ import io.nosqlbench.api.engine.activityimpl.ActivityDef;
|
||||
import io.nosqlbench.api.errors.BasicError;
|
||||
import io.nosqlbench.api.errors.OpConfigError;
|
||||
import io.nosqlbench.api.labels.NBLabels;
|
||||
import io.nosqlbench.components.NBComponentLoader;
|
||||
import io.nosqlbench.engine.api.activityapi.planning.OpSequence;
|
||||
import io.nosqlbench.engine.api.activityimpl.SimpleActivity;
|
||||
import io.nosqlbench.nb.annotations.ServiceSelector;
|
||||
@ -75,10 +77,10 @@ public class StandardActivity<R extends Op, S> extends SimpleActivity implements
|
||||
yamlmodel = ConfigModel.of(StandardActivity.class).asReadOnly();
|
||||
}
|
||||
|
||||
ServiceLoader<DriverAdapter> adapterLoader = ServiceLoader.load(DriverAdapter.class);
|
||||
Optional<String> defaultDriverName = activityDef.getParams().getOptionalString("driver");
|
||||
Optional<DriverAdapter> defaultAdapter = defaultDriverName
|
||||
.flatMap(s -> ServiceSelector.of(s, adapterLoader).get());
|
||||
Optional<DriverAdapter> defaultAdapter = activityDef.getParams().getOptionalString("driver")
|
||||
.flatMap(name -> ServiceSelector.of(name,ServiceLoader.load(DriverAdapterLoader.class)).get())
|
||||
.map(l -> l.load(this,NBLabels.forKV()));
|
||||
|
||||
if (defaultDriverName.isPresent() && defaultAdapter.isEmpty()) {
|
||||
throw new BasicError("Unable to load default driver adapter '" + defaultDriverName.get() + '\'');
|
||||
@ -104,10 +106,14 @@ public class StandardActivity<R extends Op, S> extends SimpleActivity implements
|
||||
// .or(() -> activityDef.getParams().getOptionalString("driver"))
|
||||
// .orElseThrow(() -> new OpConfigError("Unable to identify driver name for op template:\n" + ot));
|
||||
|
||||
|
||||
|
||||
// HERE
|
||||
if (!adapters.containsKey(driverName)) {
|
||||
DriverAdapter adapter = ServiceSelector.of(driverName, adapterLoader).get().orElseThrow(
|
||||
() -> new OpConfigError("Unable to load driver adapter for name '" + driverName + '\'')
|
||||
);
|
||||
|
||||
DriverAdapter adapter = Optional.of(driverName)
|
||||
.flatMap(name -> ServiceSelector.of(name,ServiceLoader.load(DriverAdapterLoader.class)).get())
|
||||
.map(l -> l.load(this,NBLabels.forKV())).orElseThrow();
|
||||
|
||||
NBConfigModel combinedModel = yamlmodel;
|
||||
NBConfiguration combinedConfig = combinedModel.matchConfig(activityDef.getParams());
|
||||
|
@ -16,7 +16,6 @@
|
||||
|
||||
package io.nosqlbench.engine.api.activityapi.ratelimits;
|
||||
|
||||
import io.nosqlbench.api.labels.NBLabeledElement;
|
||||
import io.nosqlbench.api.testutils.Perf;
|
||||
import io.nosqlbench.api.testutils.Result;
|
||||
import io.nosqlbench.components.NBBaseComponent;
|
||||
|
@ -22,8 +22,6 @@ import io.nosqlbench.adapters.api.activityconfig.rawyaml.RawOpsLoader;
|
||||
import io.nosqlbench.api.annotations.Annotation;
|
||||
import io.nosqlbench.api.annotations.Layer;
|
||||
import io.nosqlbench.api.apps.BundledApp;
|
||||
import io.nosqlbench.components.NBBaseComponent;
|
||||
import io.nosqlbench.components.NBComponent;
|
||||
import io.nosqlbench.api.content.Content;
|
||||
import io.nosqlbench.api.content.NBIO;
|
||||
import io.nosqlbench.api.engine.metrics.ActivityMetrics;
|
||||
@ -34,11 +32,11 @@ import io.nosqlbench.api.labels.NBLabels;
|
||||
import io.nosqlbench.api.logging.NBLogLevel;
|
||||
import io.nosqlbench.api.metadata.SessionNamer;
|
||||
import io.nosqlbench.api.metadata.SystemId;
|
||||
import io.nosqlbench.components.NBBaseComponent;
|
||||
import io.nosqlbench.engine.api.activityapi.cyclelog.outputs.cyclelog.CycleLogDumperUtility;
|
||||
import io.nosqlbench.engine.api.activityapi.cyclelog.outputs.cyclelog.CycleLogImporterUtility;
|
||||
import io.nosqlbench.engine.api.activityapi.input.InputType;
|
||||
import io.nosqlbench.engine.api.activityapi.output.OutputType;
|
||||
import io.nosqlbench.engine.cli.NBCLIOptions.LoggerConfigData;
|
||||
import io.nosqlbench.engine.cli.NBCLIOptions.Mode;
|
||||
import io.nosqlbench.engine.core.annotation.Annotators;
|
||||
import io.nosqlbench.engine.core.lifecycle.ExecutionResult;
|
||||
|
@ -18,8 +18,8 @@ package io.nosqlbench.engine.core.lifecycle.scenario.context;
|
||||
import io.nosqlbench.api.config.standard.TestComponent;
|
||||
import io.nosqlbench.api.engine.activityimpl.ActivityDef;
|
||||
import io.nosqlbench.api.engine.activityimpl.ParameterMap;
|
||||
import io.nosqlbench.components.NBBaseComponent;
|
||||
import io.nosqlbench.components.NBComponent;
|
||||
import io.nosqlbench.components.NBBaseComponent;
|
||||
import io.nosqlbench.components.NBComponentErrorHandler;
|
||||
import io.nosqlbench.engine.api.activityapi.core.Activity;
|
||||
import io.nosqlbench.engine.api.activityapi.core.progress.ProgressMeterDisplay;
|
||||
|
@ -21,8 +21,8 @@ import io.nosqlbench.api.annotations.Layer;
|
||||
import io.nosqlbench.api.labels.NBLabels;
|
||||
import io.nosqlbench.api.metadata.ScenarioMetadata;
|
||||
import io.nosqlbench.api.metadata.SystemId;
|
||||
import io.nosqlbench.components.NBBaseComponent;
|
||||
import io.nosqlbench.components.NBComponent;
|
||||
import io.nosqlbench.components.NBBaseComponent;
|
||||
import io.nosqlbench.components.NBComponentErrorHandler;
|
||||
import io.nosqlbench.engine.core.annotation.Annotators;
|
||||
import io.nosqlbench.engine.core.lifecycle.activity.ActivitiesProgressIndicator;
|
||||
|
@ -18,8 +18,8 @@ package io.nosqlbench.engine.core.lifecycle.scenario.execution;
|
||||
|
||||
import io.nosqlbench.api.errors.BasicError;
|
||||
import io.nosqlbench.api.labels.NBLabels;
|
||||
import io.nosqlbench.components.NBBaseComponent;
|
||||
import io.nosqlbench.components.NBComponent;
|
||||
import io.nosqlbench.components.NBBaseComponent;
|
||||
import io.nosqlbench.engine.core.lifecycle.ExecutionMetricsResult;
|
||||
import io.nosqlbench.engine.core.lifecycle.IndexedThreadFactory;
|
||||
import io.nosqlbench.engine.core.lifecycle.scenario.context.*;
|
||||
|
@ -18,8 +18,8 @@ package io.nosqlbench.engine.core.lifecycle.session;
|
||||
|
||||
import io.nosqlbench.api.labels.NBLabeledElement;
|
||||
import io.nosqlbench.api.spi.SimpleServiceLoader;
|
||||
import io.nosqlbench.components.NBBaseComponent;
|
||||
import io.nosqlbench.components.NBComponent;
|
||||
import io.nosqlbench.components.NBBaseComponent;
|
||||
import io.nosqlbench.components.NBComponentSubScope;
|
||||
import io.nosqlbench.engine.cli.BasicScriptBuffer;
|
||||
import io.nosqlbench.engine.cli.Cmd;
|
||||
|
@ -17,8 +17,8 @@
|
||||
package io.nosqlbench.api.config.standard;
|
||||
|
||||
import io.nosqlbench.api.labels.NBLabels;
|
||||
import io.nosqlbench.components.NBBaseComponent;
|
||||
import io.nosqlbench.components.NBComponent;
|
||||
import io.nosqlbench.components.NBBaseComponent;
|
||||
import org.apache.logging.log4j.LogManager;
|
||||
import org.apache.logging.log4j.Logger;
|
||||
|
||||
|
@ -48,7 +48,7 @@ public interface NBLabeledElement {
|
||||
}
|
||||
|
||||
default String description() {
|
||||
return this.getClass().getSimpleName() + " " + this.getLabels().linearizeAsMetrics();
|
||||
return this.getClass().getSimpleName() + ((this.getLabels()!=null) ? " " + this.getLabels().linearizeAsMetrics() : " {NOLABELS}");
|
||||
}
|
||||
|
||||
|
||||
|
@ -1,20 +1,22 @@
|
||||
package io.nosqlbench.components;
|
||||
|
||||
/*
|
||||
* Copyright (c) 2023 nosqlbench
|
||||
* Copyright (c) 2022 nosqlbench
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
* Unless required by applicable law or agreed to in writing,
|
||||
* software distributed under the License is distributed on an
|
||||
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
||||
* KIND, either express or implied. See the License for the
|
||||
* specific language governing permissions and limitations
|
||||
* under the License.
|
||||
*/
|
||||
|
||||
package io.nosqlbench.components;
|
||||
|
||||
import io.nosqlbench.api.engine.metrics.instruments.NBMetric;
|
||||
import io.nosqlbench.api.labels.NBLabels;
|
||||
@ -27,14 +29,13 @@ import java.util.List;
|
||||
|
||||
public class NBBaseComponent extends NBBaseComponentMetrics implements NBComponent {
|
||||
private final static Logger logger = LogManager.getLogger("RUNTIME");
|
||||
private final NBComponent parent;
|
||||
protected final NBComponent parent;
|
||||
protected final NBLabels labels;
|
||||
private final List<NBComponent> children = new ArrayList<>();
|
||||
private final NBLabels labels;
|
||||
|
||||
public NBBaseComponent(NBComponent parentComponent) {
|
||||
this(parentComponent, NBLabels.forKV());
|
||||
this(parentComponent,NBLabels.forKV());
|
||||
}
|
||||
|
||||
public NBBaseComponent(NBComponent parentComponent, NBLabels componentSpecificLabelsOnly) {
|
||||
this.labels = componentSpecificLabelsOnly;
|
||||
if (parentComponent != null) {
|
||||
@ -76,7 +77,9 @@ public class NBBaseComponent extends NBBaseComponentMetrics implements NBCompone
|
||||
|
||||
@Override
|
||||
public NBLabels getLabels() {
|
||||
return (this.parent == null) ? labels : this.parent.getLabels().and(labels);
|
||||
NBLabels effectiveLabels = (this.parent == null ? NBLabels.forKV() : parent.getLabels());
|
||||
effectiveLabels = (this.labels == null ) ? effectiveLabels : effectiveLabels.and(this.labels);
|
||||
return effectiveLabels;
|
||||
}
|
||||
|
||||
@Override
|
||||
@ -105,7 +108,7 @@ public class NBBaseComponent extends NBBaseComponentMetrics implements NBCompone
|
||||
public NBMetric findOneMetricInTree(String pattern) {
|
||||
List<NBMetric> found = findMetricsInTree(pattern);
|
||||
if (found.size() != 1) {
|
||||
System.out.println("Runtime Components and Metrics at this time:\n"+NBComponentFormats.formatAsTree(this));
|
||||
System.out.println("Runtime Components and Metrics at this time:\n" + NBComponentFormats.formatAsTree(this));
|
||||
throw new RuntimeException("Found " + found.size() + " metrics with pattern '" + pattern + "', expected exactly 1");
|
||||
}
|
||||
return found.get(0);
|
||||
|
@ -1,6 +1,22 @@
|
||||
package io.nosqlbench.components;
|
||||
|
||||
import java.util.Iterator;
|
||||
/*
|
||||
* Copyright (c) 2022 nosqlbench
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing,
|
||||
* software distributed under the License is distributed on an
|
||||
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
||||
* KIND, either express or implied. See the License for the
|
||||
* specific language governing permissions and limitations
|
||||
* under the License.
|
||||
*/
|
||||
|
||||
|
||||
public class NBComponentFormats {
|
||||
public static String formatAsTree(NBBaseComponent base) {
|
||||
|
@ -1,21 +1,44 @@
|
||||
package io.nosqlbench.components;
|
||||
|
||||
/*
|
||||
* Copyright (c) 2022 nosqlbench
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing,
|
||||
* software distributed under the License is distributed on an
|
||||
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
||||
* KIND, either express or implied. See the License for the
|
||||
* specific language governing permissions and limitations
|
||||
* under the License.
|
||||
*/
|
||||
|
||||
|
||||
import io.nosqlbench.api.spi.SimpleServiceLoader;
|
||||
import io.nosqlbench.nb.annotations.Service;
|
||||
|
||||
import java.lang.reflect.Constructor;
|
||||
import java.lang.reflect.InvocationTargetException;
|
||||
import java.util.Arrays;
|
||||
import java.util.List;
|
||||
import java.util.ServiceLoader;
|
||||
import java.util.function.BiFunction;
|
||||
|
||||
public class NBComponentLoader {
|
||||
public static <C extends NBComponent> C load(NBComponent parent, String selector, Class<C> clazz) {
|
||||
ServiceLoader<C> loader = ServiceLoader.load(clazz);
|
||||
ServiceLoader.Provider<C> cp = loader.stream().filter(p -> {
|
||||
List<ServiceLoader.Provider<C>> providers = loader.stream().filter(p -> {
|
||||
Service service = Arrays.stream(p.type().getAnnotationsByType(Service.class)).findFirst().orElseThrow();
|
||||
return service.selector().equals(selector);
|
||||
}).findFirst().orElseThrow();
|
||||
}).toList();
|
||||
if (providers.size()!=1) {
|
||||
throw new RuntimeException("Loaded " + providers.size() + " providers for selector '" + selector + "', expected 1.");
|
||||
}
|
||||
ServiceLoader.Provider<C> cp = providers.get(0);
|
||||
try {
|
||||
Constructor<? extends C> ctor = cp.type().getConstructor(NBComponent.class);
|
||||
return ctor.newInstance(parent);
|
||||
|
@ -1,5 +1,23 @@
|
||||
package io.nosqlbench.components;
|
||||
|
||||
/*
|
||||
* Copyright (c) 2022 nosqlbench
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing,
|
||||
* software distributed under the License is distributed on an
|
||||
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
||||
* KIND, either express or implied. See the License for the
|
||||
* specific language governing permissions and limitations
|
||||
* under the License.
|
||||
*/
|
||||
|
||||
|
||||
public interface NBParentComponentInjection {
|
||||
void applyParentComponent(NBComponent component);
|
||||
}
|
||||
|
@ -19,6 +19,7 @@ package io.nosqlbench.engine.core.script;
|
||||
import com.codahale.metrics.Histogram;
|
||||
import io.nosqlbench.api.config.standard.TestComponent;
|
||||
import io.nosqlbench.components.NBComponent;
|
||||
import org.junit.jupiter.api.Disabled;
|
||||
import org.junit.jupiter.api.Test;
|
||||
|
||||
import java.io.File;
|
||||
@ -27,6 +28,7 @@ import static org.assertj.core.api.Assertions.assertThat;
|
||||
|
||||
public class MetricsIntegrationTest {
|
||||
|
||||
@Disabled("until this is reimplemented")
|
||||
@Test
|
||||
public void testHistogramLogger() {
|
||||
NBComponent parent = new TestComponent("metricstest","metricstest","alias","foo","driver","diag","op","noop");
|
||||
@ -37,7 +39,9 @@ public class MetricsIntegrationTest {
|
||||
testhistogram.getSnapshot();
|
||||
final File logfile = new File("testhisto.log");
|
||||
assertThat(logfile).exists();
|
||||
assertThat(logfile.lastModified()).isGreaterThan(System.currentTimeMillis()-10000);
|
||||
long now = System.currentTimeMillis();
|
||||
long millisAge = now - logfile.lastModified();
|
||||
assertThat(millisAge).isLessThan(10000L);
|
||||
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user