Search in sources :

Example 1 with TracingConfigurationParameters

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);
}
Also used : TracingConfigurationParameters(org.apache.ignite.spi.tracing.TracingConfigurationParameters) HashMap(java.util.HashMap) TracingConfigurationCoordinates(org.apache.ignite.spi.tracing.TracingConfigurationCoordinates) VisorTracingConfigurationTaskResult(org.apache.ignite.internal.visor.tracing.configuration.VisorTracingConfigurationTaskResult) Test(org.junit.Test)

Example 2 with TracingConfigurationParameters

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);
    }
}
Also used : GridToStringExclude(org.apache.ignite.internal.util.tostring.GridToStringExclude) IgniteCheckedException(org.apache.ignite.IgniteCheckedException) IgniteException(org.apache.ignite.IgniteException) HashMap(java.util.HashMap) IgniteLogger(org.apache.ignite.IgniteLogger) Scope(org.apache.ignite.spi.tracing.Scope) Collectors(java.util.stream.Collectors) GridKernalContext(org.apache.ignite.internal.GridKernalContext) Nullable(org.jetbrains.annotations.Nullable) TracingConfigurationParameters(org.apache.ignite.spi.tracing.TracingConfigurationParameters) Map(java.util.Map) NotNull(org.jetbrains.annotations.NotNull) Collections(java.util.Collections) TracingConfigurationCoordinates(org.apache.ignite.spi.tracing.TracingConfigurationCoordinates) TracingConfigurationManager(org.apache.ignite.spi.tracing.TracingConfigurationManager) IgniteCheckedException(org.apache.ignite.IgniteCheckedException) TracingConfigurationParameters(org.apache.ignite.spi.tracing.TracingConfigurationParameters) HashMap(java.util.HashMap) IgniteException(org.apache.ignite.IgniteException) TracingConfigurationCoordinates(org.apache.ignite.spi.tracing.TracingConfigurationCoordinates) HashMap(java.util.HashMap) Map(java.util.Map)

Example 3 with TracingConfigurationParameters

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));
}
Also used : TracingConfigurationParameters(org.apache.ignite.spi.tracing.TracingConfigurationParameters) TracingConfigurationCoordinates(org.apache.ignite.spi.tracing.TracingConfigurationCoordinates) Test(org.junit.Test)

Example 4 with TracingConfigurationParameters

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()));
}
Also used : TracingConfigurationParameters(org.apache.ignite.spi.tracing.TracingConfigurationParameters) TracingConfigurationCoordinates(org.apache.ignite.spi.tracing.TracingConfigurationCoordinates) Test(org.junit.Test)

Example 5 with TracingConfigurationParameters

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);
    }
}
Also used : IgniteCheckedException(org.apache.ignite.IgniteCheckedException) TracingConfigurationParameters(org.apache.ignite.spi.tracing.TracingConfigurationParameters) HashMap(java.util.HashMap) IgniteException(org.apache.ignite.IgniteException) TracingConfigurationCoordinates(org.apache.ignite.spi.tracing.TracingConfigurationCoordinates)

Aggregations

TracingConfigurationCoordinates (org.apache.ignite.spi.tracing.TracingConfigurationCoordinates)10 TracingConfigurationParameters (org.apache.ignite.spi.tracing.TracingConfigurationParameters)10 Test (org.junit.Test)7 HashMap (java.util.HashMap)5 VisorTracingConfigurationTaskResult (org.apache.ignite.internal.visor.tracing.configuration.VisorTracingConfigurationTaskResult)3 IgniteCheckedException (org.apache.ignite.IgniteCheckedException)2 IgniteException (org.apache.ignite.IgniteException)2 Scope (org.apache.ignite.spi.tracing.Scope)2 NotNull (org.jetbrains.annotations.NotNull)2 Collections (java.util.Collections)1 HashSet (java.util.HashSet)1 Map (java.util.Map)1 Collectors (java.util.stream.Collectors)1 IgniteLogger (org.apache.ignite.IgniteLogger)1 GridKernalContext (org.apache.ignite.internal.GridKernalContext)1 DeferredSpan (org.apache.ignite.internal.processors.tracing.DeferredSpan)1 SpanImpl (org.apache.ignite.internal.processors.tracing.SpanImpl)1 GridToStringExclude (org.apache.ignite.internal.util.tostring.GridToStringExclude)1 TracingConfigurationManager (org.apache.ignite.spi.tracing.TracingConfigurationManager)1 Nullable (org.jetbrains.annotations.Nullable)1