Search in sources :

Example 1 with SAMPLING_RATE_NEVER

use of org.apache.ignite.spi.tracing.TracingConfigurationParameters.SAMPLING_RATE_NEVER in project ignite by apache.

the class OpenCensusTxTracingConfigurationTest method testTxConfigurationSamplingRateNeverPreventsTxTracing.

/**
 * Ensure that in case of sampling rate equals to 0.0 (Never) no transactions are traced.
 *
 * @throws Exception If Failed.
 */
@Test
public void testTxConfigurationSamplingRateNeverPreventsTxTracing() throws Exception {
    IgniteEx client = startGrid("client");
    client.tracingConfiguration().set(new TracingConfigurationCoordinates.Builder(TX).build(), new TracingConfigurationParameters.Builder().withSamplingRate(SAMPLING_RATE_NEVER).build());
    client.transactions().txStart(PESSIMISTIC, SERIALIZABLE).commit();
    handler().flush();
    Set<String> unexpectedTxSpanNames = Arrays.stream(SpanType.values()).filter(spanType -> spanType.scope() == TX).map(SpanType::spanName).collect(Collectors.toSet());
    java.util.List<SpanData> gotSpans = handler().allSpans().filter(span -> unexpectedTxSpanNames.contains(span.getName())).collect(Collectors.toList());
    assertTrue(gotSpans.isEmpty());
}
Also used : Arrays(java.util.Arrays) SERIALIZABLE(org.apache.ignite.transactions.TransactionIsolation.SERIALIZABLE) SpanType(org.apache.ignite.internal.processors.tracing.SpanType) Transaction(org.apache.ignite.transactions.Transaction) Set(java.util.Set) IgniteEx(org.apache.ignite.internal.IgniteEx) Scope(org.apache.ignite.spi.tracing.Scope) Test(org.junit.Test) Collectors(java.util.stream.Collectors) SpanData(io.opencensus.trace.export.SpanData) OpenCensusTracingSpi(org.apache.ignite.spi.tracing.opencensus.OpenCensusTracingSpi) TX(org.apache.ignite.spi.tracing.Scope.TX) SAMPLING_RATE_ALWAYS(org.apache.ignite.spi.tracing.TracingConfigurationParameters.SAMPLING_RATE_ALWAYS) TracingConfigurationParameters(org.apache.ignite.spi.tracing.TracingConfigurationParameters) TracingSpi(org.apache.ignite.spi.tracing.TracingSpi) SpanId(io.opencensus.trace.SpanId) SAMPLING_RATE_NEVER(org.apache.ignite.spi.tracing.TracingConfigurationParameters.SAMPLING_RATE_NEVER) PESSIMISTIC(org.apache.ignite.transactions.TransactionConcurrency.PESSIMISTIC) Collections(java.util.Collections) TracingConfigurationCoordinates(org.apache.ignite.spi.tracing.TracingConfigurationCoordinates) TracingConfigurationParameters(org.apache.ignite.spi.tracing.TracingConfigurationParameters) SpanData(io.opencensus.trace.export.SpanData) IgniteEx(org.apache.ignite.internal.IgniteEx) Test(org.junit.Test)

Aggregations

SpanId (io.opencensus.trace.SpanId)1 SpanData (io.opencensus.trace.export.SpanData)1 Arrays (java.util.Arrays)1 Collections (java.util.Collections)1 Set (java.util.Set)1 Collectors (java.util.stream.Collectors)1 IgniteEx (org.apache.ignite.internal.IgniteEx)1 SpanType (org.apache.ignite.internal.processors.tracing.SpanType)1 Scope (org.apache.ignite.spi.tracing.Scope)1 TX (org.apache.ignite.spi.tracing.Scope.TX)1 TracingConfigurationCoordinates (org.apache.ignite.spi.tracing.TracingConfigurationCoordinates)1 TracingConfigurationParameters (org.apache.ignite.spi.tracing.TracingConfigurationParameters)1 SAMPLING_RATE_ALWAYS (org.apache.ignite.spi.tracing.TracingConfigurationParameters.SAMPLING_RATE_ALWAYS)1 SAMPLING_RATE_NEVER (org.apache.ignite.spi.tracing.TracingConfigurationParameters.SAMPLING_RATE_NEVER)1 TracingSpi (org.apache.ignite.spi.tracing.TracingSpi)1 OpenCensusTracingSpi (org.apache.ignite.spi.tracing.opencensus.OpenCensusTracingSpi)1 Transaction (org.apache.ignite.transactions.Transaction)1 PESSIMISTIC (org.apache.ignite.transactions.TransactionConcurrency.PESSIMISTIC)1 SERIALIZABLE (org.apache.ignite.transactions.TransactionIsolation.SERIALIZABLE)1 Test (org.junit.Test)1