Search in sources :

Example 6 with TracingConfigurationCoordinates

use of org.apache.ignite.spi.tracing.TracingConfigurationCoordinates in project ignite by apache.

the class GridCommandHandlerTracingConfigurationTest method testTracingConfigurationWithoutSubCommandsReturnsTracingConfiguratoinForAllScopes.

/**
 * Ensure that in case of "--tracing-configuration" without arguments
 * tracing configuration for all scopes will be returned.
 */
@Test
public void testTracingConfigurationWithoutSubCommandsReturnsTracingConfiguratoinForAllScopes() {
    assertEquals(EXIT_CODE_OK, execute(hnd, "--tracing-configuration"));
    Map<TracingConfigurationCoordinates, TracingConfigurationParameters> expTracingCfg = new HashMap<>(DFLT_CONFIG_MAP);
    expTracingCfg.put(TX_SCOPE_SPECIFIC_COORDINATES, SOME_SCOPE_SPECIFIC_PARAMETERS);
    expTracingCfg.put(TX_LABEL_SPECIFIC_COORDINATES, SOME_LABEL_SPECIFIC_PARAMETERS);
    expTracingCfg.put(EXCHANGE_SCOPE_SPECIFIC_COORDINATES, SOME_SCOPE_SPECIFIC_PARAMETERS);
    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 7 with TracingConfigurationCoordinates

use of org.apache.ignite.spi.tracing.TracingConfigurationCoordinates 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)

Example 8 with TracingConfigurationCoordinates

use of org.apache.ignite.spi.tracing.TracingConfigurationCoordinates in project ignite by apache.

the class OpenCensusTracingConfigurationGetTest method testThatScopeSpecificConfigurationGetReturnsScopeSpecificEventIfLabelSpecificIsSet.

/**
 * Ensure that scope specific configuration get returns corresponding custom specific one if it's available
 * and ignores label specific one.
 */
@Test
public void testThatScopeSpecificConfigurationGetReturnsScopeSpecificEventIfLabelSpecificIsSet() {
    TracingConfigurationCoordinates scopeSpecificCoords = new TracingConfigurationCoordinates.Builder(TX).build();
    TracingConfigurationCoordinates lbSpecificCoords = new TracingConfigurationCoordinates.Builder(TX).withLabel("label").build();
    TracingConfigurationParameters expScopeSpecificParameters = new TracingConfigurationParameters.Builder().withSamplingRate(0.35).withIncludedScopes(Collections.singleton(COMMUNICATION)).build();
    grid(0).tracingConfiguration().set(lbSpecificCoords, expScopeSpecificParameters);
    assertEquals(TracingConfigurationManager.DEFAULT_TX_CONFIGURATION, grid(0).tracingConfiguration().get(scopeSpecificCoords));
}
Also used : TracingConfigurationParameters(org.apache.ignite.spi.tracing.TracingConfigurationParameters) TracingConfigurationCoordinates(org.apache.ignite.spi.tracing.TracingConfigurationCoordinates) Test(org.junit.Test)

Example 9 with TracingConfigurationCoordinates

use of org.apache.ignite.spi.tracing.TracingConfigurationCoordinates in project ignite by apache.

the class OpenCensusTracingConfigurationGetTest method testThatLabelSpecificConfigurationGetReturnsLabelSpecificOne.

/**
 * Ensure that label specific configuration get returns custom label specific is such one is present.
 */
@Test
public void testThatLabelSpecificConfigurationGetReturnsLabelSpecificOne() {
    TracingConfigurationCoordinates coords = new TracingConfigurationCoordinates.Builder(TX).withLabel("label").build();
    TracingConfigurationParameters expScopeSpecificParameters = new TracingConfigurationParameters.Builder().withSamplingRate(0.35).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)

Aggregations

TracingConfigurationCoordinates (org.apache.ignite.spi.tracing.TracingConfigurationCoordinates)9 TracingConfigurationParameters (org.apache.ignite.spi.tracing.TracingConfigurationParameters)9 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 Collections (java.util.Collections)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 GridToStringExclude (org.apache.ignite.internal.util.tostring.GridToStringExclude)1 Scope (org.apache.ignite.spi.tracing.Scope)1 TracingConfigurationManager (org.apache.ignite.spi.tracing.TracingConfigurationManager)1 NotNull (org.jetbrains.annotations.NotNull)1 Nullable (org.jetbrains.annotations.Nullable)1