use of org.apache.ignite.spi.tracing.TracingConfigurationParameters in project ignite by apache.
the class GridCommandHandlerTracingConfigurationTest method testResetAllWithoutScopeResetsTracingConfigurationForAllScopesAndReturnsIt.
/**
* Ensure that in case of "--tracing-configuration reset_all"
* Whole tracing configurations will be reseted and returned.
*/
@Test
public void testResetAllWithoutScopeResetsTracingConfigurationForAllScopesAndReturnsIt() {
assertEquals(EXIT_CODE_OK, execute(hnd, "--tracing-configuration", "reset_all"));
// Ensure that configuration was actually reseted.
assertEquals(Collections.singletonMap(TX_SCOPE_SPECIFIC_COORDINATES, TracingConfigurationManager.DEFAULT_TX_CONFIGURATION), grid(0).tracingConfiguration().getAll(TX));
assertEquals(Collections.singletonMap(EXCHANGE_SCOPE_SPECIFIC_COORDINATES, TracingConfigurationManager.DEFAULT_EXCHANGE_CONFIGURATION), grid(0).tracingConfiguration().getAll(EXCHANGE));
// Check command result.
Map<TracingConfigurationCoordinates, TracingConfigurationParameters> expTracingCfg = new HashMap<>(DFLT_CONFIG_MAP);
VisorTracingConfigurationTaskResult expRes = new VisorTracingConfigurationTaskResult();
expTracingCfg.forEach(expRes::add);
verifyResult(expRes);
}
use of org.apache.ignite.spi.tracing.TracingConfigurationParameters in project ignite by apache.
the class GridTracingConfigurationManager method resetAll.
/**
* {@inheritDoc}
*/
@Override
public void resetAll(@Nullable Scope scope) throws IgniteException {
HashMap<TracingConfigurationCoordinates, TracingConfigurationParameters> newTracingConfiguration;
if (scope != null) {
newTracingConfiguration = new HashMap<>(tracingConfiguration.entrySet().stream().filter(e -> e.getKey().scope() != scope).collect(Collectors.toMap(Map.Entry::getKey, Map.Entry::getValue)));
TracingConfigurationCoordinates scopeSpecificCoordinates = new TracingConfigurationCoordinates.Builder(scope).build();
newTracingConfiguration.put(scopeSpecificCoordinates, DEFAULT_CONFIGURATION_MAP.get(scopeSpecificCoordinates));
} else
newTracingConfiguration = new HashMap<>(DEFAULT_CONFIGURATION_MAP);
try {
distributedTracingConfiguration.propagate(newTracingConfiguration);
} catch (IgniteCheckedException e) {
String warningMsg = String.format(WARNING_MSG_TRACING_CONFIG_UPDATE_FAILED_SCOPE, scope);
log.warning(warningMsg, e);
throw new IgniteException(warningMsg, e);
}
}
use of org.apache.ignite.spi.tracing.TracingConfigurationParameters in project ignite by apache.
the class OpenCensusTracingConfigurationGetTest method testThatScopeSpecificConfigurationGetReturnsCustomScopeSpecific.
/**
* Ensure that scope specific configuration get returns corresponding custom specific one if it's available.
*/
@Test
public void testThatScopeSpecificConfigurationGetReturnsCustomScopeSpecific() {
TracingConfigurationCoordinates coords = new TracingConfigurationCoordinates.Builder(TX).build();
TracingConfigurationParameters expScopeSpecificParameters = new TracingConfigurationParameters.Builder().withSamplingRate(0.2).withIncludedScopes(Collections.singleton(COMMUNICATION)).build();
grid(0).tracingConfiguration().set(coords, expScopeSpecificParameters);
assertEquals(expScopeSpecificParameters, grid(0).tracingConfiguration().get(coords));
}
use of org.apache.ignite.spi.tracing.TracingConfigurationParameters in project ignite by apache.
the class OpenCensusTracingConfigurationGetTest method testThatLabelSpecificConfigurationGetReturnsCustomScopeSpecificIfLabelSpecificIsNotSet.
/**
* Ensure that label specific configuration get returns custom scope specific if there's no
* corresponding custom label specific one.
*/
@Test
public void testThatLabelSpecificConfigurationGetReturnsCustomScopeSpecificIfLabelSpecificIsNotSet() {
TracingConfigurationCoordinates coords = new TracingConfigurationCoordinates.Builder(TX).build();
TracingConfigurationParameters expScopeSpecificParameters = new TracingConfigurationParameters.Builder().withSamplingRate(0.2).withIncludedScopes(Collections.singleton(COMMUNICATION)).build();
grid(0).tracingConfiguration().set(coords, expScopeSpecificParameters);
assertEquals(expScopeSpecificParameters, grid(0).tracingConfiguration().get(new TracingConfigurationCoordinates.Builder(TX).withLabel("label").build()));
}
use of org.apache.ignite.spi.tracing.TracingConfigurationParameters in project ignite by apache.
the class GridTracingConfigurationManager method set.
/**
* {@inheritDoc}
*/
@Override
public void set(@NotNull TracingConfigurationCoordinates coordinates, @NotNull TracingConfigurationParameters parameters) {
HashMap<TracingConfigurationCoordinates, TracingConfigurationParameters> newTracingConfiguration = new HashMap<>(tracingConfiguration);
newTracingConfiguration.put(coordinates, parameters);
try {
distributedTracingConfiguration.propagate(newTracingConfiguration);
} catch (IgniteCheckedException e) {
String warningMsg = String.format(WARNING_MSG_TRACING_CONFIG_UPDATE_FAILED_COORDINATES, coordinates);
log.warning(warningMsg, e);
throw new IgniteException(warningMsg, e);
}
}
Aggregations