mirror of
https://github.com/nosqlbench/nosqlbench.git
synced 2025-02-25 18:55:28 -06:00
formatting
This commit is contained in:
@@ -59,14 +59,25 @@ public class ParsedOp implements LongFunction<Map<String, ?>>, StaticFieldReader
|
|||||||
* @param activityCfg The activity configuration, used to resolve nested config parameters
|
* @param activityCfg The activity configuration, used to resolve nested config parameters
|
||||||
* @param preprocessors Map->Map transformers.
|
* @param preprocessors Map->Map transformers.
|
||||||
*/
|
*/
|
||||||
public ParsedOp(OpTemplate opTemplate, NBConfiguration activityCfg, List<Function<Map<String, Object>, Map<String, Object>>> preprocessors) {
|
public ParsedOp(
|
||||||
|
OpTemplate opTemplate,
|
||||||
|
NBConfiguration activityCfg,
|
||||||
|
List<Function<Map<String, Object>, Map<String, Object>>> preprocessors
|
||||||
|
) {
|
||||||
this._opTemplate = opTemplate;
|
this._opTemplate = opTemplate;
|
||||||
this.activityCfg = activityCfg;
|
this.activityCfg = activityCfg;
|
||||||
|
|
||||||
Map<String, Object> map = opTemplate.getOp().orElseThrow();
|
Map<String, Object> map = opTemplate.getOp().orElseThrow();
|
||||||
for (Function<Map<String, Object>, Map<String, Object>> preprocessor : preprocessors) {
|
for (Function<Map<String, Object>, Map<String, Object>> preprocessor : preprocessors) {
|
||||||
map = preprocessor.apply(map);
|
map = preprocessor.apply(map);
|
||||||
}
|
}
|
||||||
this.tmap = new ParsedTemplateMap(map,opTemplate.getBindings(),List.of(opTemplate.getParams(),activityCfg.getMap()));
|
|
||||||
|
this.tmap = new ParsedTemplateMap(
|
||||||
|
map,
|
||||||
|
opTemplate.getBindings(),
|
||||||
|
List.of(opTemplate.getParams(),
|
||||||
|
activityCfg.getMap())
|
||||||
|
);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -99,7 +110,7 @@ public class ParsedOp implements LongFunction<Map<String, ?>>, StaticFieldReader
|
|||||||
}
|
}
|
||||||
|
|
||||||
public boolean isStatic(String field, Class<?> type) {
|
public boolean isStatic(String field, Class<?> type) {
|
||||||
return tmap.isStatic(field,type);
|
return tmap.isStatic(field, type);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -216,7 +227,7 @@ public class ParsedOp implements LongFunction<Map<String, ?>>, StaticFieldReader
|
|||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public <T> T get(String field, long input) {
|
public <T> T get(String field, long input) {
|
||||||
return tmap.get(field,input);
|
return tmap.get(field, input);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -253,7 +264,6 @@ public class ParsedOp implements LongFunction<Map<String, ?>>, StaticFieldReader
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get a LongFunction which returns either the static value, the dynamic value, or the default value,
|
* Get a LongFunction which returns either the static value, the dynamic value, or the default value,
|
||||||
* in that order, depending on where it is found first.
|
* in that order, depending on where it is found first.
|
||||||
@@ -279,7 +289,7 @@ public class ParsedOp implements LongFunction<Map<String, ?>>, StaticFieldReader
|
|||||||
* @return A caching function which chains to the init function, with caching
|
* @return A caching function which chains to the init function, with caching
|
||||||
*/
|
*/
|
||||||
public <V> LongFunction<V> getAsCachedFunctionOr(String fieldname, String defaultValue, Function<String, V> init) {
|
public <V> LongFunction<V> getAsCachedFunctionOr(String fieldname, String defaultValue, Function<String, V> init) {
|
||||||
return tmap.getAsCachedFunctionOr(fieldname,defaultValue,init);
|
return tmap.getAsCachedFunctionOr(fieldname, defaultValue, init);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -307,7 +317,7 @@ public class ParsedOp implements LongFunction<Map<String, ?>>, StaticFieldReader
|
|||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public boolean isDefined(String field, Class<?> type) {
|
public boolean isDefined(String field, Class<?> type) {
|
||||||
return tmap.isDefined(field,type);
|
return tmap.isDefined(field, type);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@@ -13,7 +13,7 @@ import java.util.List;
|
|||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
import java.util.Set;
|
import java.util.Set;
|
||||||
|
|
||||||
//@Service(value=WebServiceObject.class,selector="test")
|
//@Service(value=WebServiceObject.class, selector="test", maturity=Stability.Stable)
|
||||||
@Singleton
|
@Singleton
|
||||||
@Path("test1")
|
@Path("test1")
|
||||||
public class TestServlet1 implements WebServiceObject {
|
public class TestServlet1 implements WebServiceObject {
|
||||||
|
|||||||
@@ -8,7 +8,7 @@ import io.nosqlbench.nb.annotations.Service;
|
|||||||
|
|
||||||
import java.util.Optional;
|
import java.util.Optional;
|
||||||
|
|
||||||
@Service(value = ActivityType.class, selector = "stdout")
|
@Service(value= ActivityType.class, selector="stdout")
|
||||||
public class StdoutActivityType implements ActivityType<StdoutActivity> {
|
public class StdoutActivityType implements ActivityType<StdoutActivity> {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|||||||
@@ -25,7 +25,7 @@ import io.nosqlbench.engine.api.activityapi.core.ActivityType;
|
|||||||
import io.nosqlbench.engine.api.activityimpl.ActivityDef;
|
import io.nosqlbench.engine.api.activityimpl.ActivityDef;
|
||||||
import io.nosqlbench.nb.annotations.Service;
|
import io.nosqlbench.nb.annotations.Service;
|
||||||
|
|
||||||
@Service(value = ActivityType.class, selector = "tcpclient")
|
@Service(value= ActivityType.class, selector="tcpclient")
|
||||||
public class TCPClientActivityType implements ActivityType<TCPClientActivity> {
|
public class TCPClientActivityType implements ActivityType<TCPClientActivity> {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|||||||
@@ -25,7 +25,7 @@ import io.nosqlbench.engine.api.activityapi.core.ActivityType;
|
|||||||
import io.nosqlbench.engine.api.activityimpl.ActivityDef;
|
import io.nosqlbench.engine.api.activityimpl.ActivityDef;
|
||||||
import io.nosqlbench.nb.annotations.Service;
|
import io.nosqlbench.nb.annotations.Service;
|
||||||
|
|
||||||
@Service(value = ActivityType.class, selector = "tcpserver")
|
@Service(value= ActivityType.class, selector="tcpserver")
|
||||||
public class TCPServerActivityType implements ActivityType<TCPServerActivity> {
|
public class TCPServerActivityType implements ActivityType<TCPServerActivity> {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|||||||
@@ -7,7 +7,7 @@ import io.nosqlbench.engine.api.activityapi.core.ActivityType;
|
|||||||
import io.nosqlbench.engine.api.activityimpl.ActivityDef;
|
import io.nosqlbench.engine.api.activityimpl.ActivityDef;
|
||||||
import io.nosqlbench.nb.annotations.Service;
|
import io.nosqlbench.nb.annotations.Service;
|
||||||
|
|
||||||
@Service(value = ActivityType.class, selector = "webdriver")
|
@Service(value= ActivityType.class, selector="webdriver")
|
||||||
public class WebDriverActivityType implements ActivityType<WebDriverActivity> {
|
public class WebDriverActivityType implements ActivityType<WebDriverActivity> {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|||||||
@@ -24,8 +24,8 @@ import io.nosqlbench.engine.api.activityapi.output.Output;
|
|||||||
import io.nosqlbench.engine.api.activityapi.output.OutputDispenser;
|
import io.nosqlbench.engine.api.activityapi.output.OutputDispenser;
|
||||||
import io.nosqlbench.engine.api.activityapi.output.OutputType;
|
import io.nosqlbench.engine.api.activityapi.output.OutputType;
|
||||||
import io.nosqlbench.nb.annotations.Service;
|
import io.nosqlbench.nb.annotations.Service;
|
||||||
import org.apache.logging.log4j.Logger;
|
|
||||||
import org.apache.logging.log4j.LogManager;
|
import org.apache.logging.log4j.LogManager;
|
||||||
|
import org.apache.logging.log4j.Logger;
|
||||||
|
|
||||||
@Service(value = OutputType.class, selector = "cyclelog")
|
@Service(value = OutputType.class, selector = "cyclelog")
|
||||||
public class CycleLogOutputType implements OutputType {
|
public class CycleLogOutputType implements OutputType {
|
||||||
|
|||||||
@@ -21,8 +21,8 @@ import io.nosqlbench.engine.api.activityapi.core.Activity;
|
|||||||
import io.nosqlbench.engine.api.activityapi.output.Output;
|
import io.nosqlbench.engine.api.activityapi.output.Output;
|
||||||
import io.nosqlbench.engine.api.activityapi.output.OutputDispenser;
|
import io.nosqlbench.engine.api.activityapi.output.OutputDispenser;
|
||||||
import io.nosqlbench.nb.annotations.Service;
|
import io.nosqlbench.nb.annotations.Service;
|
||||||
import org.apache.logging.log4j.Logger;
|
|
||||||
import org.apache.logging.log4j.LogManager;
|
import org.apache.logging.log4j.LogManager;
|
||||||
|
import org.apache.logging.log4j.Logger;
|
||||||
|
|
||||||
@Service(value = OutputDispenser.class, selector = "logging-marker")
|
@Service(value = OutputDispenser.class, selector = "logging-marker")
|
||||||
public class LoggingMarkerDispenser implements OutputDispenser {
|
public class LoggingMarkerDispenser implements OutputDispenser {
|
||||||
|
|||||||
@@ -6,7 +6,7 @@ import io.nosqlbench.nb.annotations.Service;
|
|||||||
import org.apache.logging.log4j.LogManager;
|
import org.apache.logging.log4j.LogManager;
|
||||||
import org.apache.logging.log4j.Logger;
|
import org.apache.logging.log4j.Logger;
|
||||||
|
|
||||||
@Service(value = ErrorHandler.class, selector = "stop")
|
@Service(value= ErrorHandler.class, selector="stop")
|
||||||
public class StopErrorHandler implements ErrorHandler {
|
public class StopErrorHandler implements ErrorHandler {
|
||||||
|
|
||||||
private final static Logger logger = LogManager.getLogger(StopErrorHandler.class);
|
private final static Logger logger = LogManager.getLogger(StopErrorHandler.class);
|
||||||
|
|||||||
@@ -8,7 +8,7 @@ import io.nosqlbench.nb.annotations.Service;
|
|||||||
|
|
||||||
import java.util.function.Supplier;
|
import java.util.function.Supplier;
|
||||||
|
|
||||||
@Service(value = ErrorHandler.class, selector = "timer")
|
@Service(value= ErrorHandler.class, selector="timer")
|
||||||
public class TimerErrorHandler implements ErrorHandler, ErrorMetrics.Aware {
|
public class TimerErrorHandler implements ErrorHandler, ErrorMetrics.Aware {
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -6,7 +6,7 @@ import io.nosqlbench.nb.annotations.Service;
|
|||||||
import org.apache.logging.log4j.LogManager;
|
import org.apache.logging.log4j.LogManager;
|
||||||
import org.apache.logging.log4j.Logger;
|
import org.apache.logging.log4j.Logger;
|
||||||
|
|
||||||
@Service(value = ErrorHandler.class, selector = "warn")
|
@Service(value= ErrorHandler.class, selector="warn")
|
||||||
public class WarnErrorHandler implements ErrorHandler {
|
public class WarnErrorHandler implements ErrorHandler {
|
||||||
private final static Logger logger = LogManager.getLogger("ERRORS");
|
private final static Logger logger = LogManager.getLogger("ERRORS");
|
||||||
|
|
||||||
|
|||||||
@@ -44,7 +44,7 @@ import static io.nosqlbench.engine.api.util.Colors.*;
|
|||||||
* retrofitted for J11.
|
* retrofitted for J11.
|
||||||
* </p>
|
* </p>
|
||||||
*/
|
*/
|
||||||
@Service(value = TokenPool.class, selector = "threaded")
|
@Service(value= TokenPool.class, selector="threaded")
|
||||||
public class ThreadDrivenTokenPool implements TokenPool {
|
public class ThreadDrivenTokenPool implements TokenPool {
|
||||||
|
|
||||||
private final static Logger logger = LogManager.getLogger(ThreadDrivenTokenPool.class);
|
private final static Logger logger = LogManager.getLogger(ThreadDrivenTokenPool.class);
|
||||||
|
|||||||
@@ -23,7 +23,7 @@ import io.nosqlbench.engine.api.activityapi.input.InputDispenser;
|
|||||||
import io.nosqlbench.engine.api.activityapi.input.InputType;
|
import io.nosqlbench.engine.api.activityapi.input.InputType;
|
||||||
import io.nosqlbench.nb.annotations.Service;
|
import io.nosqlbench.nb.annotations.Service;
|
||||||
|
|
||||||
@Service(value = InputType.class, selector = "atomicseq")
|
@Service(value= InputType.class, selector="atomicseq")
|
||||||
public class TargetRateInputType implements InputType {
|
public class TargetRateInputType implements InputType {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|||||||
@@ -24,7 +24,7 @@ import io.nosqlbench.nb.annotations.Service;
|
|||||||
/**
|
/**
|
||||||
* Provide a local MetricRegistryService for tests
|
* Provide a local MetricRegistryService for tests
|
||||||
*/
|
*/
|
||||||
@Service(value = MetricRegistryService.class, selector = "test-registry")
|
@Service(value= MetricRegistryService.class, selector="test-registry")
|
||||||
public class TestMetricsRegistry implements MetricRegistryService {
|
public class TestMetricsRegistry implements MetricRegistryService {
|
||||||
|
|
||||||
private final MetricRegistry metricRegistry = new MetricRegistry();
|
private final MetricRegistry metricRegistry = new MetricRegistry();
|
||||||
|
|||||||
@@ -5,12 +5,12 @@ import io.nosqlbench.engine.clients.grafana.GrafanaClientConfig;
|
|||||||
import io.nosqlbench.engine.clients.grafana.transfer.GAnnotation;
|
import io.nosqlbench.engine.clients.grafana.transfer.GAnnotation;
|
||||||
import io.nosqlbench.nb.annotations.Service;
|
import io.nosqlbench.nb.annotations.Service;
|
||||||
import io.nosqlbench.nb.api.OnError;
|
import io.nosqlbench.nb.api.OnError;
|
||||||
import io.nosqlbench.nb.api.metadata.SystemId;
|
|
||||||
import io.nosqlbench.nb.api.annotations.Annotation;
|
import io.nosqlbench.nb.api.annotations.Annotation;
|
||||||
import io.nosqlbench.nb.api.annotations.Annotator;
|
import io.nosqlbench.nb.api.annotations.Annotator;
|
||||||
import io.nosqlbench.nb.api.config.params.ParamsParser;
|
import io.nosqlbench.nb.api.config.params.ParamsParser;
|
||||||
import io.nosqlbench.nb.api.config.standard.*;
|
import io.nosqlbench.nb.api.config.standard.*;
|
||||||
import io.nosqlbench.nb.api.errors.BasicError;
|
import io.nosqlbench.nb.api.errors.BasicError;
|
||||||
|
import io.nosqlbench.nb.api.metadata.SystemId;
|
||||||
import org.apache.logging.log4j.LogManager;
|
import org.apache.logging.log4j.LogManager;
|
||||||
import org.apache.logging.log4j.Logger;
|
import org.apache.logging.log4j.Logger;
|
||||||
|
|
||||||
|
|||||||
@@ -24,7 +24,7 @@ import org.apache.logging.log4j.Logger;
|
|||||||
|
|
||||||
import javax.script.ScriptContext;
|
import javax.script.ScriptContext;
|
||||||
|
|
||||||
@Service(value = ScriptingPluginInfo.class, selector = "scriptingmetrics")
|
@Service(value= ScriptingPluginInfo.class, selector="scriptingmetrics")
|
||||||
public class ScriptingMetricsPluginData implements ScriptingPluginInfo<ScriptingMetrics> {
|
public class ScriptingMetricsPluginData implements ScriptingPluginInfo<ScriptingMetrics> {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|||||||
@@ -24,7 +24,7 @@ import java.util.Map;
|
|||||||
import java.util.Set;
|
import java.util.Set;
|
||||||
import java.util.stream.Collectors;
|
import java.util.stream.Collectors;
|
||||||
|
|
||||||
@Service(value = WebServiceObject.class, selector = "workload-finder")
|
@Service(value= WebServiceObject.class, selector="workload-finder")
|
||||||
@Singleton
|
@Singleton
|
||||||
@Path("/services/workloads")
|
@Path("/services/workloads")
|
||||||
public class WorkloadFinderEndpoint implements WebServiceObject {
|
public class WorkloadFinderEndpoint implements WebServiceObject {
|
||||||
|
|||||||
@@ -18,7 +18,7 @@ import java.nio.file.Paths;
|
|||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.stream.Collectors;
|
import java.util.stream.Collectors;
|
||||||
|
|
||||||
@Service(value = WebServiceObject.class, selector = "workspaces")
|
@Service(value= WebServiceObject.class, selector="workspaces")
|
||||||
@Path("/services/workspaces")
|
@Path("/services/workspaces")
|
||||||
@Singleton
|
@Singleton
|
||||||
public class WorkspacesEndpoint implements WebServiceObject {
|
public class WorkspacesEndpoint implements WebServiceObject {
|
||||||
|
|||||||
@@ -38,7 +38,7 @@ public class ActivityMetrics {
|
|||||||
private final static Logger logger = LogManager.getLogger(ActivityMetrics.class);
|
private final static Logger logger = LogManager.getLogger(ActivityMetrics.class);
|
||||||
|
|
||||||
public static final String HDRDIGITS_PARAM = "hdr_digits";
|
public static final String HDRDIGITS_PARAM = "hdr_digits";
|
||||||
public static final int DEFAULT_HDRDIGITS= 4;
|
public static final int DEFAULT_HDRDIGITS = 4;
|
||||||
private static int _HDRDIGITS = DEFAULT_HDRDIGITS;
|
private static int _HDRDIGITS = DEFAULT_HDRDIGITS;
|
||||||
|
|
||||||
private static MetricRegistry registry;
|
private static MetricRegistry registry;
|
||||||
@@ -100,6 +100,7 @@ public class ActivityMetrics {
|
|||||||
return metric;
|
return metric;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* <p>Create a timer associated with an activity.</p>
|
* <p>Create a timer associated with an activity.</p>
|
||||||
*
|
*
|
||||||
@@ -110,18 +111,18 @@ public class ActivityMetrics {
|
|||||||
* that only one of them succeeds.</p>
|
* that only one of them succeeds.</p>
|
||||||
*
|
*
|
||||||
* @param activityDef an associated activity def
|
* @param activityDef an associated activity def
|
||||||
* @param name a simple, descriptive name for the timer
|
* @param name a simple, descriptive name for the timer
|
||||||
* @return the timer, perhaps a different one if it has already been registered
|
* @return the timer, perhaps a different one if it has already been registered
|
||||||
*/
|
*/
|
||||||
public static Timer timer(ActivityDef activityDef, String name) {
|
public static Timer timer(ActivityDef activityDef, String name) {
|
||||||
String fullMetricName = activityDef.getAlias() + "." + name;
|
String fullMetricName = activityDef.getAlias() + "." + name;
|
||||||
Timer registeredTimer = (Timer) register(activityDef, name, () ->
|
Timer registeredTimer = (Timer) register(activityDef, name, () ->
|
||||||
new NicerTimer(fullMetricName,
|
new NicerTimer(fullMetricName,
|
||||||
new DeltaHdrHistogramReservoir(
|
new DeltaHdrHistogramReservoir(
|
||||||
fullMetricName,
|
fullMetricName,
|
||||||
activityDef.getParams().getOptionalInteger(HDRDIGITS_PARAM).orElse(_HDRDIGITS)
|
activityDef.getParams().getOptionalInteger(HDRDIGITS_PARAM).orElse(_HDRDIGITS)
|
||||||
)
|
)
|
||||||
));
|
));
|
||||||
return registeredTimer;
|
return registeredTimer;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -145,21 +146,20 @@ public class ActivityMetrics {
|
|||||||
* <p>This method ensures that if multiple threads attempt to create the same-named metric on a given activity,
|
* <p>This method ensures that if multiple threads attempt to create the same-named metric on a given activity,
|
||||||
* that only one of them succeeds.</p>
|
* that only one of them succeeds.</p>
|
||||||
*
|
*
|
||||||
*
|
|
||||||
* @param activityDef an associated activity def
|
* @param activityDef an associated activity def
|
||||||
* @param name a simple, descriptive name for the histogram
|
* @param name a simple, descriptive name for the histogram
|
||||||
* @return the histogram, perhaps a different one if it has already been registered
|
* @return the histogram, perhaps a different one if it has already been registered
|
||||||
*/
|
*/
|
||||||
public static Histogram histogram(ActivityDef activityDef, String name) {
|
public static Histogram histogram(ActivityDef activityDef, String name) {
|
||||||
String fullMetricName = activityDef.getAlias() + "." + name;
|
String fullMetricName = activityDef.getAlias() + "." + name;
|
||||||
return (Histogram) register(activityDef, name, () ->
|
return (Histogram) register(activityDef, name, () ->
|
||||||
new NicerHistogram(
|
new NicerHistogram(
|
||||||
fullMetricName,
|
fullMetricName,
|
||||||
new DeltaHdrHistogramReservoir(
|
new DeltaHdrHistogramReservoir(
|
||||||
fullMetricName,
|
fullMetricName,
|
||||||
activityDef.getParams().getOptionalInteger(HDRDIGITS_PARAM).orElse(_HDRDIGITS)
|
activityDef.getParams().getOptionalInteger(HDRDIGITS_PARAM).orElse(_HDRDIGITS)
|
||||||
)
|
)
|
||||||
));
|
));
|
||||||
}
|
}
|
||||||
|
|
||||||
public static Histogram histogram(String fullname) {
|
public static Histogram histogram(String fullname) {
|
||||||
@@ -179,7 +179,7 @@ public class ActivityMetrics {
|
|||||||
* that only one of them succeeds.</p>
|
* that only one of them succeeds.</p>
|
||||||
*
|
*
|
||||||
* @param activityDef an associated activity def
|
* @param activityDef an associated activity def
|
||||||
* @param name a simple, descriptive name for the counter
|
* @param name a simple, descriptive name for the counter
|
||||||
* @return the counter, perhaps a different one if it has already been registered
|
* @return the counter, perhaps a different one if it has already been registered
|
||||||
*/
|
*/
|
||||||
public static Counter counter(ActivityDef activityDef, String name) {
|
public static Counter counter(ActivityDef activityDef, String name) {
|
||||||
@@ -192,7 +192,7 @@ public class ActivityMetrics {
|
|||||||
* that only one of them succeeds.</p>
|
* that only one of them succeeds.</p>
|
||||||
*
|
*
|
||||||
* @param activityDef an associated activity def
|
* @param activityDef an associated activity def
|
||||||
* @param name a simple, descriptive name for the meter
|
* @param name a simple, descriptive name for the meter
|
||||||
* @return the meter, perhaps a different one if it has already been registered
|
* @return the meter, perhaps a different one if it has already been registered
|
||||||
*/
|
*/
|
||||||
public static Meter meter(ActivityDef activityDef, String name) {
|
public static Meter meter(ActivityDef activityDef, String name) {
|
||||||
@@ -224,7 +224,7 @@ public class ActivityMetrics {
|
|||||||
|
|
||||||
private static MetricRegistry lookupRegistry() {
|
private static MetricRegistry lookupRegistry() {
|
||||||
ServiceLoader<MetricRegistryService> metricRegistryServices =
|
ServiceLoader<MetricRegistryService> metricRegistryServices =
|
||||||
ServiceLoader.load(MetricRegistryService.class);
|
ServiceLoader.load(MetricRegistryService.class);
|
||||||
List<MetricRegistryService> mrss = new ArrayList<>();
|
List<MetricRegistryService> mrss = new ArrayList<>();
|
||||||
metricRegistryServices.iterator().forEachRemaining(mrss::add);
|
metricRegistryServices.iterator().forEachRemaining(mrss::add);
|
||||||
|
|
||||||
@@ -245,21 +245,22 @@ public class ActivityMetrics {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Add a histogram interval logger to matching metrics in this JVM instance.
|
* Add a histogram interval logger to matching metrics in this JVM instance.
|
||||||
|
*
|
||||||
* @param sessionName The name for the session to be annotated in the histogram log
|
* @param sessionName The name for the session to be annotated in the histogram log
|
||||||
* @param pattern A regular expression pattern to filter out metric names for logging
|
* @param pattern A regular expression pattern to filter out metric names for logging
|
||||||
* @param filename A file to log the histogram data in
|
* @param filename A file to log the histogram data in
|
||||||
* @param interval How many seconds to wait between writing each interval histogram
|
* @param interval How many seconds to wait between writing each interval histogram
|
||||||
*/
|
*/
|
||||||
public static void addHistoLogger(String sessionName, String pattern, String filename, String interval) {
|
public static void addHistoLogger(String sessionName, String pattern, String filename, String interval) {
|
||||||
if (filename.contains("_SESSION_")) {
|
if (filename.contains("_SESSION_")) {
|
||||||
filename = filename.replace("_SESSION_",sessionName);
|
filename = filename.replace("_SESSION_", sessionName);
|
||||||
}
|
}
|
||||||
Pattern compiledPattern = Pattern.compile(pattern);
|
Pattern compiledPattern = Pattern.compile(pattern);
|
||||||
File logfile = new File(filename);
|
File logfile = new File(filename);
|
||||||
long intervalMillis = Unit.msFor(interval).orElseThrow(()->new RuntimeException("Unable to parse interval spec:'" + interval + "'"));
|
long intervalMillis = Unit.msFor(interval).orElseThrow(() -> new RuntimeException("Unable to parse interval spec:'" + interval + "'"));
|
||||||
|
|
||||||
HistoIntervalLogger histoIntervalLogger =
|
HistoIntervalLogger histoIntervalLogger =
|
||||||
new HistoIntervalLogger(sessionName, logfile, compiledPattern, intervalMillis);
|
new HistoIntervalLogger(sessionName, logfile, compiledPattern, intervalMillis);
|
||||||
logger.debug("attaching " + histoIntervalLogger + " to the metrics registry.");
|
logger.debug("attaching " + histoIntervalLogger + " to the metrics registry.");
|
||||||
get().addListener(histoIntervalLogger);
|
get().addListener(histoIntervalLogger);
|
||||||
metricsCloseables.add(histoIntervalLogger);
|
metricsCloseables.add(histoIntervalLogger);
|
||||||
@@ -267,21 +268,22 @@ public class ActivityMetrics {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Add a histogram stats logger to matching metrics in this JVM instance.
|
* Add a histogram stats logger to matching metrics in this JVM instance.
|
||||||
|
*
|
||||||
* @param sessionName The name for the session to be annotated in the histogram log
|
* @param sessionName The name for the session to be annotated in the histogram log
|
||||||
* @param pattern A regular expression pattern to filter out metric names for logging
|
* @param pattern A regular expression pattern to filter out metric names for logging
|
||||||
* @param filename A file to log the histogram data in
|
* @param filename A file to log the histogram data in
|
||||||
* @param interval How many seconds to wait between writing each interval histogram
|
* @param interval How many seconds to wait between writing each interval histogram
|
||||||
*/
|
*/
|
||||||
public static void addStatsLogger(String sessionName, String pattern, String filename, String interval) {
|
public static void addStatsLogger(String sessionName, String pattern, String filename, String interval) {
|
||||||
if (filename.contains("_SESSION_")) {
|
if (filename.contains("_SESSION_")) {
|
||||||
filename = filename.replace("_SESSION_",sessionName);
|
filename = filename.replace("_SESSION_", sessionName);
|
||||||
}
|
}
|
||||||
Pattern compiledPattern = Pattern.compile(pattern);
|
Pattern compiledPattern = Pattern.compile(pattern);
|
||||||
File logfile = new File(filename);
|
File logfile = new File(filename);
|
||||||
long intervalMillis = Unit.msFor(interval).orElseThrow(() -> new RuntimeException("Unable to parse interval spec:" + interval + "'"));
|
long intervalMillis = Unit.msFor(interval).orElseThrow(() -> new RuntimeException("Unable to parse interval spec:" + interval + "'"));
|
||||||
|
|
||||||
HistoStatsLogger histoStatsLogger =
|
HistoStatsLogger histoStatsLogger =
|
||||||
new HistoStatsLogger(sessionName, logfile, compiledPattern, intervalMillis, TimeUnit.NANOSECONDS);
|
new HistoStatsLogger(sessionName, logfile, compiledPattern, intervalMillis, TimeUnit.NANOSECONDS);
|
||||||
logger.debug("attaching " + histoStatsLogger + " to the metrics registry.");
|
logger.debug("attaching " + histoStatsLogger + " to the metrics registry.");
|
||||||
get().addListener(histoStatsLogger);
|
get().addListener(histoStatsLogger);
|
||||||
metricsCloseables.add(histoStatsLogger);
|
metricsCloseables.add(histoStatsLogger);
|
||||||
@@ -291,22 +293,23 @@ public class ActivityMetrics {
|
|||||||
* Add a classic histogram in addition to the default implementation in this runtime. This is a way to
|
* Add a classic histogram in addition to the default implementation in this runtime. This is a way to
|
||||||
* get a view to both the enhanced histogram implementation as well as the classic implementation in the
|
* get a view to both the enhanced histogram implementation as well as the classic implementation in the
|
||||||
* same scenario.
|
* same scenario.
|
||||||
|
*
|
||||||
* @param sessionName The name of the session to be annotated in the classic histogram
|
* @param sessionName The name of the session to be annotated in the classic histogram
|
||||||
* @param pattern A regular expression pattern to filter out metric names for inclusion
|
* @param pattern A regular expression pattern to filter out metric names for inclusion
|
||||||
* @param prefix The name prefix to add to the classic histograms so that they fit into the existing metrics namespace
|
* @param prefix The name prefix to add to the classic histograms so that they fit into the existing metrics namespace
|
||||||
* @param interval How frequently to update the histogram
|
* @param interval How frequently to update the histogram
|
||||||
*/
|
*/
|
||||||
public static void addClassicHistos(String sessionName, String pattern, String prefix, String interval) {
|
public static void addClassicHistos(String sessionName, String pattern, String prefix, String interval) {
|
||||||
Pattern compiledPattern = Pattern.compile(pattern);
|
Pattern compiledPattern = Pattern.compile(pattern);
|
||||||
long intervalMillis = Unit.msFor(interval).orElseThrow(() -> new RuntimeException("Unable to parse interval spec:" + interval + "'"));
|
long intervalMillis = Unit.msFor(interval).orElseThrow(() -> new RuntimeException("Unable to parse interval spec:" + interval + "'"));
|
||||||
|
|
||||||
ClassicHistoListener classicHistoListener =
|
ClassicHistoListener classicHistoListener =
|
||||||
new ClassicHistoListener(get(),sessionName, prefix, compiledPattern, interval, TimeUnit.NANOSECONDS);
|
new ClassicHistoListener(get(), sessionName, prefix, compiledPattern, interval, TimeUnit.NANOSECONDS);
|
||||||
logger.debug("attaching histo listener " + classicHistoListener + " to the metrics registry.");
|
logger.debug("attaching histo listener " + classicHistoListener + " to the metrics registry.");
|
||||||
get().addListener(classicHistoListener);
|
get().addListener(classicHistoListener);
|
||||||
|
|
||||||
ClassicTimerListener classicTimerListener =
|
ClassicTimerListener classicTimerListener =
|
||||||
new ClassicTimerListener(get(),sessionName, prefix, compiledPattern, interval, TimeUnit.NANOSECONDS);
|
new ClassicTimerListener(get(), sessionName, prefix, compiledPattern, interval, TimeUnit.NANOSECONDS);
|
||||||
logger.debug("attaching timer listener " + classicTimerListener + " to the metrics registry.");
|
logger.debug("attaching timer listener " + classicTimerListener + " to the metrics registry.");
|
||||||
get().addListener(classicTimerListener);
|
get().addListener(classicTimerListener);
|
||||||
}
|
}
|
||||||
@@ -314,6 +317,7 @@ public class ActivityMetrics {
|
|||||||
/**
|
/**
|
||||||
* This should be called at the end of a process, so that open intervals can be finished, logs closed properly,
|
* This should be called at the end of a process, so that open intervals can be finished, logs closed properly,
|
||||||
* etc.
|
* etc.
|
||||||
|
*
|
||||||
* @param showChart whether to chart metrics on console
|
* @param showChart whether to chart metrics on console
|
||||||
*/
|
*/
|
||||||
public static void closeMetrics(boolean showChart) {
|
public static void closeMetrics(boolean showChart) {
|
||||||
@@ -321,7 +325,7 @@ public class ActivityMetrics {
|
|||||||
for (MetricsCloseable metricsCloseable : metricsCloseables) {
|
for (MetricsCloseable metricsCloseable : metricsCloseables) {
|
||||||
logger.trace("closing metrics closeable: " + metricsCloseable);
|
logger.trace("closing metrics closeable: " + metricsCloseable);
|
||||||
metricsCloseable.closeMetrics();
|
metricsCloseable.closeMetrics();
|
||||||
if (showChart){
|
if (showChart) {
|
||||||
metricsCloseable.chart();
|
metricsCloseable.chart();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -334,22 +338,22 @@ public class ActivityMetrics {
|
|||||||
public static void reportTo(PrintStream out) {
|
public static void reportTo(PrintStream out) {
|
||||||
out.println("==================== BEGIN-METRIC-LOG ====================");
|
out.println("==================== BEGIN-METRIC-LOG ====================");
|
||||||
ConsoleReporter consoleReporter = ConsoleReporter.forRegistry(ActivityMetrics.getMetricRegistry())
|
ConsoleReporter consoleReporter = ConsoleReporter.forRegistry(ActivityMetrics.getMetricRegistry())
|
||||||
.convertDurationsTo(TimeUnit.MICROSECONDS)
|
.convertDurationsTo(TimeUnit.MICROSECONDS)
|
||||||
.convertRatesTo(TimeUnit.SECONDS)
|
.convertRatesTo(TimeUnit.SECONDS)
|
||||||
.filter(MetricFilter.ALL)
|
.filter(MetricFilter.ALL)
|
||||||
.outputTo(out)
|
.outputTo(out)
|
||||||
.build();
|
.build();
|
||||||
consoleReporter.report();
|
consoleReporter.report();
|
||||||
out.println("==================== END-METRIC-LOG ====================");
|
out.println("==================== END-METRIC-LOG ====================");
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void mountSubRegistry(String mountPrefix, MetricRegistry subRegistry) {
|
public static void mountSubRegistry(String mountPrefix, MetricRegistry subRegistry) {
|
||||||
new MetricsRegistryMount(getMetricRegistry(),subRegistry,mountPrefix);
|
new MetricsRegistryMount(getMetricRegistry(), subRegistry, mountPrefix);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void removeActivityMetrics(ActivityDef activityDef) {
|
public static void removeActivityMetrics(ActivityDef activityDef) {
|
||||||
get().getMetrics().keySet().stream().filter(s -> s.startsWith(activityDef.getAlias()+"."))
|
get().getMetrics().keySet().stream().filter(s -> s.startsWith(activityDef.getAlias() + "."))
|
||||||
.forEach(get()::remove);
|
.forEach(get()::remove);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -44,7 +44,6 @@ public class Template implements LongFunction<String> {
|
|||||||
private final static Logger logger = LogManager.getLogger(Template.class);
|
private final static Logger logger = LogManager.getLogger(Template.class);
|
||||||
private static final String EXPR_BEGIN = "[[";
|
private static final String EXPR_BEGIN = "[[";
|
||||||
private static final String EXPR_END = "]]";
|
private static final String EXPR_END = "]]";
|
||||||
// private final static ThreadLocal<StringBuilder> sb = ThreadLocal.withInitial(StringBuilder::new);
|
|
||||||
private final String rawTemplate;
|
private final String rawTemplate;
|
||||||
private LongUnaryOperator iterOp;
|
private LongUnaryOperator iterOp;
|
||||||
private String[] literals;
|
private String[] literals;
|
||||||
|
|||||||
@@ -12,7 +12,7 @@ import jakarta.ws.rs.Produces;
|
|||||||
import jakarta.ws.rs.QueryParam;
|
import jakarta.ws.rs.QueryParam;
|
||||||
import jakarta.ws.rs.core.MediaType;
|
import jakarta.ws.rs.core.MediaType;
|
||||||
|
|
||||||
@Service(value = WebServiceObject.class, selector = "virtdata")
|
@Service(value= WebServiceObject.class, selector="virtdata")
|
||||||
@Singleton
|
@Singleton
|
||||||
@Path("virtdata")
|
@Path("virtdata")
|
||||||
public class VirtDataService implements WebServiceObject {
|
public class VirtDataService implements WebServiceObject {
|
||||||
|
|||||||
@@ -1,11 +1,11 @@
|
|||||||
package io.nosqlbench.virtdata.userlibs.docinfo;
|
package io.nosqlbench.virtdata.userlibs.docinfo;
|
||||||
|
|
||||||
import io.nosqlbench.nb.annotations.Service;
|
|
||||||
import io.nosqlbench.docsys.api.Docs;
|
import io.nosqlbench.docsys.api.Docs;
|
||||||
import io.nosqlbench.docsys.api.DocsBinder;
|
import io.nosqlbench.docsys.api.DocsBinder;
|
||||||
import io.nosqlbench.docsys.api.DocsysDynamicManifest;
|
import io.nosqlbench.docsys.api.DocsysDynamicManifest;
|
||||||
|
import io.nosqlbench.nb.annotations.Service;
|
||||||
|
|
||||||
@Service(value = DocsysDynamicManifest.class, selector = "virtdata-docs")
|
@Service(value= DocsysDynamicManifest.class, selector="virtdata-docs")
|
||||||
public class VirtdataMarkdownManifest implements DocsysDynamicManifest {
|
public class VirtdataMarkdownManifest implements DocsysDynamicManifest {
|
||||||
|
|
||||||
public DocsBinder getDocs() {
|
public DocsBinder getDocs() {
|
||||||
|
|||||||
Reference in New Issue
Block a user