mirror of
https://github.com/nosqlbench/nosqlbench.git
synced 2025-02-25 18:55:28 -06:00
docs updates
This commit is contained in:
parent
de2e609ff4
commit
a0862703ec
@ -70,7 +70,7 @@ public class DiagDriverAdapter extends BaseDriverAdapter<DiagOp, DiagSpace> impl
|
||||
|
||||
@Override
|
||||
public NBConfigModel getConfigModel() {
|
||||
NBConfigModel model = getConfigModel();
|
||||
NBConfigModel model = super.getConfigModel();
|
||||
model.add(DiagSpace.getStaticConfigModel());
|
||||
return model;
|
||||
}
|
||||
|
@ -137,6 +137,7 @@ public class DiagTask_gauge extends BaseDiagTask implements Gauge<Double>, NBPar
|
||||
}
|
||||
|
||||
logger.info("Registering gauge for diag task with labels:" + getParentLabels().getLabels() + " label:" + label);
|
||||
this.sampleValue=this.function.applyAsDouble(0L);
|
||||
this.gauge=parent.create().gauge(
|
||||
label,
|
||||
() -> this.sampleValue,
|
||||
|
@ -161,7 +161,8 @@ public class PromExpositionFormat {
|
||||
.append(stringValue)
|
||||
.append('\n');
|
||||
} else throw new RuntimeException(
|
||||
"Unknown label set for metric type '" + metric.getClass().getCanonicalName() + '\''
|
||||
"Unknown label set for metric value type '" + (value==null? "NULL" :
|
||||
value.getClass()) + '\''
|
||||
);
|
||||
}
|
||||
if (metric instanceof final Metered meter) {
|
||||
|
@ -44,24 +44,34 @@ public class OpCapture {
|
||||
public final static Logger logger = LogManager.getLogger(OpCapture.class);
|
||||
|
||||
public static <OP extends CycleOp<?>, SPACE extends Space> OpDispenser<? extends OP> wrapOptionally(
|
||||
DriverAdapter<? extends OP, ? extends SPACE> adapter, OpDispenser<? extends OP> dispenser,
|
||||
DriverAdapter<? extends OP, ? extends SPACE> adapter,
|
||||
OpDispenser<? extends OP> dispenser,
|
||||
ParsedOp pop
|
||||
) {
|
||||
)
|
||||
{
|
||||
|
||||
CapturePoints captures = pop.getCaptures();
|
||||
if (captures.isEmpty()) {
|
||||
return dispenser;
|
||||
}
|
||||
|
||||
for (Object captureImpl : new Object[]{dispenser, adapter}) {
|
||||
if (captureImpl instanceof UniformVariableCapture<?> captureF) {
|
||||
Function<?, Map<String, ?>> function = captureF.captureF(captures);
|
||||
return new CapturingOpDispenser(adapter, pop, dispenser, function);
|
||||
}
|
||||
}
|
||||
|
||||
OP op = dispenser.getOp(0L);
|
||||
|
||||
if (op instanceof UniformVariableCapture<?> captureF) {
|
||||
Function<?, Map<String,?>> function = captureF.captureF(captures);
|
||||
Function<?, Map<String, ?>> function = captureF.captureF(captures);
|
||||
return new CapturingOpDispenser(adapter, pop, dispenser, function);
|
||||
} else {
|
||||
throw new OpConfigError(
|
||||
"variable capture configuration failed because adapter " + adapter + " does not " +
|
||||
"implement " + UniformVariableCapture.class.getSimpleName()
|
||||
);
|
||||
}
|
||||
|
||||
throw new OpConfigError("variable capture configuration failed because adapter " + adapter
|
||||
+ " does not implement "
|
||||
+ UniformVariableCapture.class.getSimpleName());
|
||||
|
||||
}
|
||||
}
|
||||
|
@ -20,24 +20,35 @@ import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.function.Function;
|
||||
|
||||
/**
|
||||
* If an op implements VariableCapture, then it is known to be able to
|
||||
* extract variables from its result. Generally speaking, this should
|
||||
* be implemented within an Op according to the standard format
|
||||
* of {@link ParsedTemplateString#getCaptures()}. Any op implementing
|
||||
* this should use the interface below to support interop between adapters
|
||||
* and to allow for auto documentation tha the feature is supported for
|
||||
* a given adapter.
|
||||
*/
|
||||
|
||||
/// Any type implementing [[UniformVariableCapture]] will allow
|
||||
/// a caller to extract a map of names and values from it.
|
||||
/// The implementor of [[#capture(List)]] is responsible for extracting the dynamic values,
|
||||
/// but the caller is expected to use a standard component to do type verification
|
||||
/// This interface allows an op dispenser or related type to extract a set of field values from
|
||||
/// a result of [RESULT] type. Since the result type and thus the logic for reading the values out
|
||||
/// will vary by protocol or API, this optional behavior must be provided by adapter or
|
||||
/// dispenser-specific implementations.
|
||||
///
|
||||
/// In cases where a type assertion is provided, the values captured dynamically will be subject to an
|
||||
/// additional phase of type validation and coercion. If required types are not compatible a
|
||||
/// variable capture error should be thrown.
|
||||
/// A type implementing [UniformVariableCapture] is able to provide a mapping
|
||||
/// function from the [RESULT] type to the neutral [Map] of [String] to [Object] form.
|
||||
///
|
||||
/// In some cases, it may be possible for the variable capture logic to be pre-baked around a static
|
||||
/// set of fields and API calls, such as for a stable table schema. In this mode, the logic of
|
||||
/// [#captureF(CapturePoints)] will be about traversing a known result manifest and constructing a
|
||||
/// lambda which can reliably extract fields from the result type without further interpretation.
|
||||
/// This is obviously the most optimal path for result types which are idiomatically regular in
|
||||
/// structure. This can be thought of as a "pre-compiled" mode for variable capture. (This is close
|
||||
/// to the truth, actually, due to effective JIT optimization of lambdas.)
|
||||
///
|
||||
/// In other cases, it may not be possible due to the result type having a varying structure,
|
||||
/// optional fields, etc. In these cases, the logic of the [#captureF(CapturePoints)] method is
|
||||
/// to simply return an interpretive function which can walk variant result structure. This can
|
||||
/// be thought of as an "interpreted" mode for variable capture, at least to the extent that the
|
||||
/// result structure will have to be intepreted anew for each instance.
|
||||
///
|
||||
/// It is not the responsibility of the [#captureF(CapturePoints)] implementation to enforce
|
||||
/// types or projected names. A future version will likely constrain the view of CapturePoint to
|
||||
/// only include the required field names for extraction. Another layer in the NB runtime is
|
||||
/// responsible for asserting assignability to the cast types indicated by [CapturePoint#asCast]
|
||||
/// and to the projected names indicated by [CapturePoint#asName].
|
||||
public interface UniformVariableCapture<RESULT> {
|
||||
/// Return a function which can extract the variables from the [RESULT] type, specified
|
||||
/// by the given [CapturePoint#sourceName]s.
|
||||
Function<RESULT,Map<String,?>> captureF(CapturePoints<RESULT> points);
|
||||
}
|
||||
|
@ -63,12 +63,14 @@
|
||||
<option name="METHOD_BRACE_STYLE" value="5" />
|
||||
<option name="LAMBDA_BRACE_STYLE" value="5" />
|
||||
<option name="ALIGN_MULTILINE_PARAMETERS" value="false" />
|
||||
<option name="ALIGN_MULTILINE_BINARY_OPERATION" value="true" />
|
||||
<option name="ALIGN_MULTILINE_ASSIGNMENT" value="true" />
|
||||
<option name="ALIGN_MULTILINE_THROWS_LIST" value="true" />
|
||||
<option name="ALIGN_MULTILINE_EXTENDS_LIST" value="true" />
|
||||
<option name="ALIGN_MULTILINE_ARRAY_INITIALIZER_EXPRESSION" value="true" />
|
||||
<option name="CALL_PARAMETERS_WRAP" value="1" />
|
||||
<option name="CALL_PARAMETERS_LPAREN_ON_NEXT_LINE" value="true" />
|
||||
<option name="CALL_PARAMETERS_RPAREN_ON_NEXT_LINE" value="true" />
|
||||
<option name="METHOD_PARAMETERS_WRAP" value="5" />
|
||||
<option name="METHOD_PARAMETERS_LPAREN_ON_NEXT_LINE" value="true" />
|
||||
<option name="METHOD_PARAMETERS_RPAREN_ON_NEXT_LINE" value="true" />
|
||||
@ -78,11 +80,10 @@
|
||||
<option name="EXTENDS_KEYWORD_WRAP" value="1" />
|
||||
<option name="THROWS_KEYWORD_WRAP" value="1" />
|
||||
<option name="METHOD_CALL_CHAIN_WRAP" value="1" />
|
||||
<option name="PARENTHESES_EXPRESSION_LPAREN_WRAP" value="true" />
|
||||
<option name="PARENTHESES_EXPRESSION_RPAREN_WRAP" value="true" />
|
||||
<option name="BINARY_OPERATION_WRAP" value="5" />
|
||||
<option name="TERNARY_OPERATION_WRAP" value="5" />
|
||||
<option name="ARRAY_INITIALIZER_WRAP" value="5" />
|
||||
<option name="BINARY_OPERATION_WRAP" value="1" />
|
||||
<option name="BINARY_OPERATION_SIGN_ON_NEXT_LINE" value="true" />
|
||||
<option name="TERNARY_OPERATION_WRAP" value="1" />
|
||||
<option name="ARRAY_INITIALIZER_WRAP" value="1" />
|
||||
<option name="ARRAY_INITIALIZER_LBRACE_ON_NEXT_LINE" value="true" />
|
||||
<option name="ARRAY_INITIALIZER_RBRACE_ON_NEXT_LINE" value="true" />
|
||||
<option name="ASSIGNMENT_WRAP" value="1" />
|
||||
|
Loading…
Reference in New Issue
Block a user