use of io.opentelemetry.sdk.trace.data.SpanData in project hbase by apache.
the class TestAsyncRegionLocatorTracing method testGetRegionLocation.
@Test
public void testGetRegionLocation() {
conn.getLocator().getRegionLocation(TableName.META_TABLE_NAME, HConstants.EMPTY_START_ROW, RegionLocateType.CURRENT, TimeUnit.SECONDS.toNanos(1)).join();
SpanData span = waitSpan("AsyncRegionLocator.getRegionLocation");
assertThat(span, allOf(hasStatusWithCode(StatusCode.OK), hasKind(SpanKind.CLIENT), buildConnectionAttributesMatcher(conn), buildTableAttributesMatcher(TableName.META_TABLE_NAME), hasAttributes(containsEntryWithStringValuesOf("db.hbase.regions", locs.getDefaultRegionLocation().getRegion().getRegionNameAsString()))));
}
use of io.opentelemetry.sdk.trace.data.SpanData in project hbase by apache.
the class TestAsyncRegionLocatorTracing method testClearCache.
@Test
public void testClearCache() {
conn.getLocator().clearCache();
SpanData span = waitSpan("AsyncRegionLocator.clearCache");
assertThat(span, allOf(hasStatusWithCode(StatusCode.OK), hasKind(SpanKind.CLIENT), buildConnectionAttributesMatcher(conn)));
}
use of io.opentelemetry.sdk.trace.data.SpanData in project hbase by apache.
the class TestAsyncRegionLocatorTracing method testClearCacheServerName.
@Test
public void testClearCacheServerName() {
ServerName sn = ServerName.valueOf("127.0.0.1", 12345, EnvironmentEdgeManager.currentTime());
conn.getLocator().clearCache(sn);
SpanData span = waitSpan("AsyncRegionLocator.clearCache");
assertThat(span, allOf(hasStatusWithCode(StatusCode.OK), hasKind(SpanKind.CLIENT), buildConnectionAttributesMatcher(conn), hasAttributes(containsEntry("db.hbase.server.name", sn.getServerName()))));
}
use of io.opentelemetry.sdk.trace.data.SpanData in project hbase by apache.
the class TestAsyncRegionLocatorTracing method testClearCacheTableName.
@Test
public void testClearCacheTableName() {
conn.getLocator().clearCache(TableName.META_TABLE_NAME);
SpanData span = waitSpan("AsyncRegionLocator.clearCache");
assertThat(span, allOf(hasStatusWithCode(StatusCode.OK), hasKind(SpanKind.CLIENT), buildConnectionAttributesMatcher(conn), buildTableAttributesMatcher(TableName.META_TABLE_NAME)));
}
use of io.opentelemetry.sdk.trace.data.SpanData in project hbase by apache.
the class TestAsyncTableTracing method assertTrace.
private void assertTrace(String tableOperation, Matcher<SpanData> matcher) {
final TableName tableName = table.getName();
final Matcher<SpanData> spanLocator = allOf(hasName(containsString(tableOperation)), hasEnded());
final String expectedName = tableOperation + " " + tableName.getNameWithNamespaceInclAsString();
Waiter.waitFor(CONF, 1000, new MatcherPredicate<>("waiting for span to emit", () -> traceRule.getSpans(), hasItem(spanLocator)));
List<SpanData> candidateSpans = traceRule.getSpans().stream().filter(spanLocator::matches).collect(Collectors.toList());
assertThat(candidateSpans, hasSize(1));
SpanData data = candidateSpans.iterator().next();
assertThat(data, allOf(hasName(expectedName), hasKind(SpanKind.CLIENT), hasStatusWithCode(StatusCode.OK), buildConnectionAttributesMatcher(conn), buildTableAttributesMatcher(tableName), matcher));
}
Aggregations