Search in sources :

Example 1 with SQL_ITER_CLOSE

use of org.apache.ignite.internal.processors.tracing.SpanType.SQL_ITER_CLOSE in project ignite by apache.

the class OpenCensusSqlJdbcTracingTest method testSelectLocal.

/**
 * Tests tracing of local SQL SELECT query.
 *
 * @throws Exception If failed.
 */
@Test
public void testSelectLocal() throws Exception {
    String orgTable = createTableAndPopulate(Organization.class, REPLICATED, 1);
    SpanId rootSpan = executeAndCheckRootSpan("SELECT orgVal FROM " + orgTable, TEST_SCHEMA, false, false, true);
    String qryId = getAttribute(rootSpan, SQL_QRY_ID);
    assertTrue(Long.parseLong(qryId.substring(qryId.indexOf('_') + 1)) > 0);
    UUID.fromString(qryId.substring(0, qryId.indexOf('_')));
    checkChildSpan(SQL_QRY_PARSE, rootSpan);
    checkChildSpan(SQL_CURSOR_OPEN, rootSpan);
    checkChildSpan(SQL_ITER_OPEN, rootSpan);
    SpanId iterSpan = checkChildSpan(SQL_ITER_OPEN, rootSpan);
    checkChildSpan(SQL_QRY_EXECUTE, iterSpan);
    int fetchedRows = findChildSpans(SQL_PAGE_FETCH, rootSpan).stream().mapToInt(span -> Integer.parseInt(getAttribute(span, SQL_PAGE_ROWS))).sum();
    assertEquals(TEST_TABLE_POPULATION, fetchedRows);
    checkChildSpan(SQL_ITER_CLOSE, rootSpan);
    assertFalse(findChildSpans(SQL_CURSOR_CLOSE, rootSpan).isEmpty());
}
Also used : Connection(java.sql.Connection) SQL_PAGE_ROWS(org.apache.ignite.internal.processors.tracing.SpanTags.SQL_PAGE_ROWS) SQL_QRY_ID(org.apache.ignite.internal.processors.tracing.SpanTags.SQL_QRY_ID) SQL_CMD_QRY_EXECUTE(org.apache.ignite.internal.processors.tracing.SpanType.SQL_CMD_QRY_EXECUTE) IgniteEx(org.apache.ignite.internal.IgniteEx) SQLException(java.sql.SQLException) Config(org.apache.ignite.client.Config) ResultSet(java.sql.ResultSet) DriverManager.getConnection(java.sql.DriverManager.getConnection) SpanId(io.opencensus.trace.SpanId) SAMPLING_RATE_NEVER(org.apache.ignite.spi.tracing.TracingConfigurationParameters.SAMPLING_RATE_NEVER) PARTITIONED(org.apache.ignite.cache.CacheMode.PARTITIONED) TracingConfigurationCoordinates(org.apache.ignite.spi.tracing.TracingConfigurationCoordinates) SQL_ITER_OPEN(org.apache.ignite.internal.processors.tracing.SpanType.SQL_ITER_OPEN) SQL_BATCH_PROCESS(org.apache.ignite.internal.processors.tracing.SpanType.SQL_BATCH_PROCESS) SQL_CURSOR_CLOSE(org.apache.ignite.internal.processors.tracing.SpanType.SQL_CURSOR_CLOSE) SQL_ITER_CLOSE(org.apache.ignite.internal.processors.tracing.SpanType.SQL_ITER_CLOSE) Test(org.junit.Test) SQL_PAGE_FETCH(org.apache.ignite.internal.processors.tracing.SpanType.SQL_PAGE_FETCH) UUID(java.util.UUID) PreparedStatement(java.sql.PreparedStatement) SQL_QRY(org.apache.ignite.internal.processors.tracing.SpanType.SQL_QRY) REPLICATED(org.apache.ignite.cache.CacheMode.REPLICATED) Objects(java.util.Objects) List(java.util.List) DFLT_SCHEMA(org.apache.ignite.internal.processors.query.QueryUtils.DFLT_SCHEMA) SAMPLING_RATE_ALWAYS(org.apache.ignite.spi.tracing.TracingConfigurationParameters.SAMPLING_RATE_ALWAYS) TracingConfigurationParameters(org.apache.ignite.spi.tracing.TracingConfigurationParameters) SQL_CURSOR_OPEN(org.apache.ignite.internal.processors.tracing.SpanType.SQL_CURSOR_OPEN) SQL_QRY_PARSE(org.apache.ignite.internal.processors.tracing.SpanType.SQL_QRY_PARSE) SQL(org.apache.ignite.spi.tracing.Scope.SQL) SQL_QRY_EXECUTE(org.apache.ignite.internal.processors.tracing.SpanType.SQL_QRY_EXECUTE) IgniteUtils.resolveIgnitePath(org.apache.ignite.internal.util.IgniteUtils.resolveIgnitePath) SpanId(io.opencensus.trace.SpanId) Test(org.junit.Test)

Aggregations

SpanId (io.opencensus.trace.SpanId)1 Connection (java.sql.Connection)1 DriverManager.getConnection (java.sql.DriverManager.getConnection)1 PreparedStatement (java.sql.PreparedStatement)1 ResultSet (java.sql.ResultSet)1 SQLException (java.sql.SQLException)1 List (java.util.List)1 Objects (java.util.Objects)1 UUID (java.util.UUID)1 PARTITIONED (org.apache.ignite.cache.CacheMode.PARTITIONED)1 REPLICATED (org.apache.ignite.cache.CacheMode.REPLICATED)1 Config (org.apache.ignite.client.Config)1 IgniteEx (org.apache.ignite.internal.IgniteEx)1 DFLT_SCHEMA (org.apache.ignite.internal.processors.query.QueryUtils.DFLT_SCHEMA)1 SQL_PAGE_ROWS (org.apache.ignite.internal.processors.tracing.SpanTags.SQL_PAGE_ROWS)1 SQL_QRY_ID (org.apache.ignite.internal.processors.tracing.SpanTags.SQL_QRY_ID)1 SQL_BATCH_PROCESS (org.apache.ignite.internal.processors.tracing.SpanType.SQL_BATCH_PROCESS)1 SQL_CMD_QRY_EXECUTE (org.apache.ignite.internal.processors.tracing.SpanType.SQL_CMD_QRY_EXECUTE)1 SQL_CURSOR_CLOSE (org.apache.ignite.internal.processors.tracing.SpanType.SQL_CURSOR_CLOSE)1 SQL_CURSOR_OPEN (org.apache.ignite.internal.processors.tracing.SpanType.SQL_CURSOR_OPEN)1