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 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.activityCfg = activityCfg;
|
||||
|
||||
Map<String, Object> map = opTemplate.getOp().orElseThrow();
|
||||
for (Function<Map<String, Object>, Map<String, Object>> preprocessor : preprocessors) {
|
||||
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) {
|
||||
return tmap.isStatic(field,type);
|
||||
return tmap.isStatic(field, type);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -216,7 +227,7 @@ public class ParsedOp implements LongFunction<Map<String, ?>>, StaticFieldReader
|
||||
*/
|
||||
@Override
|
||||
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,
|
||||
* 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
|
||||
*/
|
||||
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
|
||||
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.Set;
|
||||
|
||||
//@Service(value=WebServiceObject.class,selector="test")
|
||||
//@Service(value=WebServiceObject.class, selector="test", maturity=Stability.Stable)
|
||||
@Singleton
|
||||
@Path("test1")
|
||||
public class TestServlet1 implements WebServiceObject {
|
||||
|
||||
@@ -8,7 +8,7 @@ import io.nosqlbench.nb.annotations.Service;
|
||||
|
||||
import java.util.Optional;
|
||||
|
||||
@Service(value = ActivityType.class, selector = "stdout")
|
||||
@Service(value= ActivityType.class, selector="stdout")
|
||||
public class StdoutActivityType implements ActivityType<StdoutActivity> {
|
||||
|
||||
@Override
|
||||
|
||||
@@ -25,7 +25,7 @@ import io.nosqlbench.engine.api.activityapi.core.ActivityType;
|
||||
import io.nosqlbench.engine.api.activityimpl.ActivityDef;
|
||||
import io.nosqlbench.nb.annotations.Service;
|
||||
|
||||
@Service(value = ActivityType.class, selector = "tcpclient")
|
||||
@Service(value= ActivityType.class, selector="tcpclient")
|
||||
public class TCPClientActivityType implements ActivityType<TCPClientActivity> {
|
||||
|
||||
@Override
|
||||
|
||||
@@ -25,7 +25,7 @@ import io.nosqlbench.engine.api.activityapi.core.ActivityType;
|
||||
import io.nosqlbench.engine.api.activityimpl.ActivityDef;
|
||||
import io.nosqlbench.nb.annotations.Service;
|
||||
|
||||
@Service(value = ActivityType.class, selector = "tcpserver")
|
||||
@Service(value= ActivityType.class, selector="tcpserver")
|
||||
public class TCPServerActivityType implements ActivityType<TCPServerActivity> {
|
||||
|
||||
@Override
|
||||
|
||||
@@ -7,7 +7,7 @@ import io.nosqlbench.engine.api.activityapi.core.ActivityType;
|
||||
import io.nosqlbench.engine.api.activityimpl.ActivityDef;
|
||||
import io.nosqlbench.nb.annotations.Service;
|
||||
|
||||
@Service(value = ActivityType.class, selector = "webdriver")
|
||||
@Service(value= ActivityType.class, selector="webdriver")
|
||||
public class WebDriverActivityType implements ActivityType<WebDriverActivity> {
|
||||
|
||||
@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.OutputType;
|
||||
import io.nosqlbench.nb.annotations.Service;
|
||||
import org.apache.logging.log4j.Logger;
|
||||
import org.apache.logging.log4j.LogManager;
|
||||
import org.apache.logging.log4j.Logger;
|
||||
|
||||
@Service(value = OutputType.class, selector = "cyclelog")
|
||||
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.OutputDispenser;
|
||||
import io.nosqlbench.nb.annotations.Service;
|
||||
import org.apache.logging.log4j.Logger;
|
||||
import org.apache.logging.log4j.LogManager;
|
||||
import org.apache.logging.log4j.Logger;
|
||||
|
||||
@Service(value = OutputDispenser.class, selector = "logging-marker")
|
||||
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.Logger;
|
||||
|
||||
@Service(value = ErrorHandler.class, selector = "stop")
|
||||
@Service(value= ErrorHandler.class, selector="stop")
|
||||
public class StopErrorHandler implements ErrorHandler {
|
||||
|
||||
private final static Logger logger = LogManager.getLogger(StopErrorHandler.class);
|
||||
|
||||
@@ -8,7 +8,7 @@ import io.nosqlbench.nb.annotations.Service;
|
||||
|
||||
import java.util.function.Supplier;
|
||||
|
||||
@Service(value = ErrorHandler.class, selector = "timer")
|
||||
@Service(value= ErrorHandler.class, selector="timer")
|
||||
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.Logger;
|
||||
|
||||
@Service(value = ErrorHandler.class, selector = "warn")
|
||||
@Service(value= ErrorHandler.class, selector="warn")
|
||||
public class WarnErrorHandler implements ErrorHandler {
|
||||
private final static Logger logger = LogManager.getLogger("ERRORS");
|
||||
|
||||
|
||||
@@ -44,7 +44,7 @@ import static io.nosqlbench.engine.api.util.Colors.*;
|
||||
* retrofitted for J11.
|
||||
* </p>
|
||||
*/
|
||||
@Service(value = TokenPool.class, selector = "threaded")
|
||||
@Service(value= TokenPool.class, selector="threaded")
|
||||
public class ThreadDrivenTokenPool implements TokenPool {
|
||||
|
||||
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.nb.annotations.Service;
|
||||
|
||||
@Service(value = InputType.class, selector = "atomicseq")
|
||||
@Service(value= InputType.class, selector="atomicseq")
|
||||
public class TargetRateInputType implements InputType {
|
||||
|
||||
@Override
|
||||
|
||||
@@ -24,7 +24,7 @@ import io.nosqlbench.nb.annotations.Service;
|
||||
/**
|
||||
* 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 {
|
||||
|
||||
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.nb.annotations.Service;
|
||||
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.Annotator;
|
||||
import io.nosqlbench.nb.api.config.params.ParamsParser;
|
||||
import io.nosqlbench.nb.api.config.standard.*;
|
||||
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.Logger;
|
||||
|
||||
|
||||
@@ -24,7 +24,7 @@ import org.apache.logging.log4j.Logger;
|
||||
|
||||
import javax.script.ScriptContext;
|
||||
|
||||
@Service(value = ScriptingPluginInfo.class, selector = "scriptingmetrics")
|
||||
@Service(value= ScriptingPluginInfo.class, selector="scriptingmetrics")
|
||||
public class ScriptingMetricsPluginData implements ScriptingPluginInfo<ScriptingMetrics> {
|
||||
|
||||
@Override
|
||||
|
||||
@@ -24,7 +24,7 @@ import java.util.Map;
|
||||
import java.util.Set;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
@Service(value = WebServiceObject.class, selector = "workload-finder")
|
||||
@Service(value= WebServiceObject.class, selector="workload-finder")
|
||||
@Singleton
|
||||
@Path("/services/workloads")
|
||||
public class WorkloadFinderEndpoint implements WebServiceObject {
|
||||
|
||||
@@ -18,7 +18,7 @@ import java.nio.file.Paths;
|
||||
import java.util.List;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
@Service(value = WebServiceObject.class, selector = "workspaces")
|
||||
@Service(value= WebServiceObject.class, selector="workspaces")
|
||||
@Path("/services/workspaces")
|
||||
@Singleton
|
||||
public class WorkspacesEndpoint implements WebServiceObject {
|
||||
|
||||
@@ -38,7 +38,7 @@ public class ActivityMetrics {
|
||||
private final static Logger logger = LogManager.getLogger(ActivityMetrics.class);
|
||||
|
||||
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 MetricRegistry registry;
|
||||
@@ -100,6 +100,7 @@ public class ActivityMetrics {
|
||||
return metric;
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* <p>Create a timer associated with an activity.</p>
|
||||
*
|
||||
@@ -145,7 +146,6 @@ public class ActivityMetrics {
|
||||
* <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>
|
||||
*
|
||||
*
|
||||
* @param activityDef an associated activity def
|
||||
* @param name a simple, descriptive name for the histogram
|
||||
* @return the histogram, perhaps a different one if it has already been registered
|
||||
@@ -245,6 +245,7 @@ public class ActivityMetrics {
|
||||
|
||||
/**
|
||||
* 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 pattern A regular expression pattern to filter out metric names for logging
|
||||
* @param filename A file to log the histogram data in
|
||||
@@ -252,11 +253,11 @@ public class ActivityMetrics {
|
||||
*/
|
||||
public static void addHistoLogger(String sessionName, String pattern, String filename, String interval) {
|
||||
if (filename.contains("_SESSION_")) {
|
||||
filename = filename.replace("_SESSION_",sessionName);
|
||||
filename = filename.replace("_SESSION_", sessionName);
|
||||
}
|
||||
Pattern compiledPattern = Pattern.compile(pattern);
|
||||
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 =
|
||||
new HistoIntervalLogger(sessionName, logfile, compiledPattern, intervalMillis);
|
||||
@@ -267,6 +268,7 @@ public class ActivityMetrics {
|
||||
|
||||
/**
|
||||
* 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 pattern A regular expression pattern to filter out metric names for logging
|
||||
* @param filename A file to log the histogram data in
|
||||
@@ -274,7 +276,7 @@ public class ActivityMetrics {
|
||||
*/
|
||||
public static void addStatsLogger(String sessionName, String pattern, String filename, String interval) {
|
||||
if (filename.contains("_SESSION_")) {
|
||||
filename = filename.replace("_SESSION_",sessionName);
|
||||
filename = filename.replace("_SESSION_", sessionName);
|
||||
}
|
||||
Pattern compiledPattern = Pattern.compile(pattern);
|
||||
File logfile = new File(filename);
|
||||
@@ -291,6 +293,7 @@ public class ActivityMetrics {
|
||||
* 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
|
||||
* same scenario.
|
||||
*
|
||||
* @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 prefix The name prefix to add to the classic histograms so that they fit into the existing metrics namespace
|
||||
@@ -301,12 +304,12 @@ public class ActivityMetrics {
|
||||
long intervalMillis = Unit.msFor(interval).orElseThrow(() -> new RuntimeException("Unable to parse interval spec:" + interval + "'"));
|
||||
|
||||
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.");
|
||||
get().addListener(classicHistoListener);
|
||||
|
||||
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.");
|
||||
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,
|
||||
* etc.
|
||||
*
|
||||
* @param showChart whether to chart metrics on console
|
||||
*/
|
||||
public static void closeMetrics(boolean showChart) {
|
||||
@@ -321,7 +325,7 @@ public class ActivityMetrics {
|
||||
for (MetricsCloseable metricsCloseable : metricsCloseables) {
|
||||
logger.trace("closing metrics closeable: " + metricsCloseable);
|
||||
metricsCloseable.closeMetrics();
|
||||
if (showChart){
|
||||
if (showChart) {
|
||||
metricsCloseable.chart();
|
||||
}
|
||||
}
|
||||
@@ -344,11 +348,11 @@ public class ActivityMetrics {
|
||||
}
|
||||
|
||||
public static void mountSubRegistry(String mountPrefix, MetricRegistry subRegistry) {
|
||||
new MetricsRegistryMount(getMetricRegistry(),subRegistry,mountPrefix);
|
||||
new MetricsRegistryMount(getMetricRegistry(), subRegistry, mountPrefix);
|
||||
}
|
||||
|
||||
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);
|
||||
}
|
||||
|
||||
|
||||
@@ -44,7 +44,6 @@ public class Template implements LongFunction<String> {
|
||||
private final static Logger logger = LogManager.getLogger(Template.class);
|
||||
private static final String EXPR_BEGIN = "[[";
|
||||
private static final String EXPR_END = "]]";
|
||||
// private final static ThreadLocal<StringBuilder> sb = ThreadLocal.withInitial(StringBuilder::new);
|
||||
private final String rawTemplate;
|
||||
private LongUnaryOperator iterOp;
|
||||
private String[] literals;
|
||||
|
||||
@@ -12,7 +12,7 @@ import jakarta.ws.rs.Produces;
|
||||
import jakarta.ws.rs.QueryParam;
|
||||
import jakarta.ws.rs.core.MediaType;
|
||||
|
||||
@Service(value = WebServiceObject.class, selector = "virtdata")
|
||||
@Service(value= WebServiceObject.class, selector="virtdata")
|
||||
@Singleton
|
||||
@Path("virtdata")
|
||||
public class VirtDataService implements WebServiceObject {
|
||||
|
||||
@@ -1,11 +1,11 @@
|
||||
package io.nosqlbench.virtdata.userlibs.docinfo;
|
||||
|
||||
import io.nosqlbench.nb.annotations.Service;
|
||||
import io.nosqlbench.docsys.api.Docs;
|
||||
import io.nosqlbench.docsys.api.DocsBinder;
|
||||
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 DocsBinder getDocs() {
|
||||
|
||||
Reference in New Issue
Block a user