Search in sources :

Example 1 with VisorTracingConfigurationTaskResult

use of org.apache.ignite.internal.visor.tracing.configuration.VisorTracingConfigurationTaskResult in project ignite by apache.

the class GridCommandHandlerTracingConfigurationTest method testSetWithScopeAndLabelSetsLabelSpecificConfiguratoinAndReturnsScopeBasedConfiguration.

/**
 * Ensure that in case of "--tracing-configuration set --scope TX --label label --sampling-rate 0.123
 * --included-scopes COMMUNICATION,EXCHANGE"
 * TX label specific configuration should be updated.
 * Whole TX based configuration should be returned.
 */
@Test
public void testSetWithScopeAndLabelSetsLabelSpecificConfiguratoinAndReturnsScopeBasedConfiguration() {
    assertEquals(EXIT_CODE_OK, execute(hnd, "--tracing-configuration", "set", "--scope", "TX", "--label", "label", "--sampling-rate", "0.123", "--included-scopes", "COMMUNICATION,EXCHANGE"));
    // Check command result.
    VisorTracingConfigurationTaskResult expRes = new VisorTracingConfigurationTaskResult();
    expRes.add(TX_SCOPE_SPECIFIC_COORDINATES, SOME_SCOPE_SPECIFIC_PARAMETERS);
    expRes.add(TX_LABEL_SPECIFIC_COORDINATES, new TracingConfigurationParameters.Builder().withSamplingRate(0.123).withIncludedScopes(new HashSet<>(Arrays.asList(COMMUNICATION, EXCHANGE))).build());
    verifyResult(expRes);
}
Also used : VisorTracingConfigurationTaskResult(org.apache.ignite.internal.visor.tracing.configuration.VisorTracingConfigurationTaskResult) Test(org.junit.Test)

Example 2 with VisorTracingConfigurationTaskResult

use of org.apache.ignite.internal.visor.tracing.configuration.VisorTracingConfigurationTaskResult in project ignite by apache.

the class GridCommandHandlerTracingConfigurationTest method testResetWithScopeResetsScopeSpecificConfiguratoinAndReturnesScopeBasedConfiguration.

/**
 * Ensure that in case of "--tracing-configuration reset --scope TX"
 * TX scope specific configuration will be reseted, TX label specific configuration should stay unchanged.
 * Whole TX based configuration should be returned.
 */
@Test
public void testResetWithScopeResetsScopeSpecificConfiguratoinAndReturnesScopeBasedConfiguration() {
    assertEquals(EXIT_CODE_OK, execute(hnd, "--tracing-configuration", "reset", "--scope", "TX"));
    // Check command result.
    VisorTracingConfigurationTaskResult expRes = new VisorTracingConfigurationTaskResult();
    expRes.add(TX_SCOPE_SPECIFIC_COORDINATES, TracingConfigurationManager.DEFAULT_EXCHANGE_CONFIGURATION);
    expRes.add(TX_LABEL_SPECIFIC_COORDINATES, SOME_LABEL_SPECIFIC_PARAMETERS);
    verifyResult(expRes);
}
Also used : VisorTracingConfigurationTaskResult(org.apache.ignite.internal.visor.tracing.configuration.VisorTracingConfigurationTaskResult) Test(org.junit.Test)

Example 3 with VisorTracingConfigurationTaskResult

use of org.apache.ignite.internal.visor.tracing.configuration.VisorTracingConfigurationTaskResult 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 4 with VisorTracingConfigurationTaskResult

use of org.apache.ignite.internal.visor.tracing.configuration.VisorTracingConfigurationTaskResult in project ignite by apache.

the class GridCommandHandlerTracingConfigurationTest method testGetWithScopeAndLabelReturnsLabelSpecificConfigurationIfSuchOneExists.

/**
 * Ensure that in case of "--tracing-configuration get --scope TX --label label"
 * TX label specific and only TX label specific tracing configuration will be returned:
 * TX specific configuration not expected.
 */
@Test
public void testGetWithScopeAndLabelReturnsLabelSpecificConfigurationIfSuchOneExists() {
    assertEquals(EXIT_CODE_OK, execute(hnd, "--tracing-configuration", "get", "--scope", "TX", "--label", "label"));
    // Check command result.
    VisorTracingConfigurationTaskResult expRes = new VisorTracingConfigurationTaskResult();
    expRes.add(TX_LABEL_SPECIFIC_COORDINATES, SOME_LABEL_SPECIFIC_PARAMETERS);
    verifyResult(expRes);
}
Also used : VisorTracingConfigurationTaskResult(org.apache.ignite.internal.visor.tracing.configuration.VisorTracingConfigurationTaskResult) Test(org.junit.Test)

Example 5 with VisorTracingConfigurationTaskResult

use of org.apache.ignite.internal.visor.tracing.configuration.VisorTracingConfigurationTaskResult in project ignite by apache.

the class TracingConfigurationCommand method execute.

/**
 * Execute tracing-configuration command.
 *
 * @param clientCfg Client configuration.
 * @throws Exception If failed to execute tracing-configuration action.
 */
@Override
public Object execute(GridClientConfiguration clientCfg, Logger log) throws Exception {
    try (GridClient client = Command.startClient(clientCfg)) {
        UUID crdId = client.compute().nodes(node -> !node.isClient()).stream().min(Comparator.comparingLong(GridClientNode::order)).map(GridClientNode::nodeId).orElse(null);
        VisorTracingConfigurationTaskResult res = executeTaskByNameOnNode(client, VisorTracingConfigurationTask.class.getName(), toVisorArguments(args), crdId, clientCfg);
        printResult(res, log::info);
        return res;
    } catch (Throwable e) {
        log.severe("Failed to execute tracing-configuration command='" + args.command().text() + "'");
        throw e;
    }
}
Also used : VisorTracingConfigurationTask(org.apache.ignite.internal.visor.tracing.configuration.VisorTracingConfigurationTask) VisorTracingConfigurationTaskResult(org.apache.ignite.internal.visor.tracing.configuration.VisorTracingConfigurationTaskResult) GridClient(org.apache.ignite.internal.client.GridClient) UUID(java.util.UUID)

Aggregations

VisorTracingConfigurationTaskResult (org.apache.ignite.internal.visor.tracing.configuration.VisorTracingConfigurationTaskResult)13 Test (org.junit.Test)11 HashMap (java.util.HashMap)3 TracingConfigurationCoordinates (org.apache.ignite.spi.tracing.TracingConfigurationCoordinates)3 TracingConfigurationParameters (org.apache.ignite.spi.tracing.TracingConfigurationParameters)3 UUID (java.util.UUID)1 GridClient (org.apache.ignite.internal.client.GridClient)1 VisorTracingConfigurationTask (org.apache.ignite.internal.visor.tracing.configuration.VisorTracingConfigurationTask)1