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());
}
Aggregations