Search in sources :

Example 1 with SpanData

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()))));
}
Also used : SpanData(io.opentelemetry.sdk.trace.data.SpanData) Test(org.junit.Test)

Example 2 with SpanData

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)));
}
Also used : SpanData(io.opentelemetry.sdk.trace.data.SpanData) Test(org.junit.Test)

Example 3 with SpanData

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()))));
}
Also used : SpanData(io.opentelemetry.sdk.trace.data.SpanData) ServerName(org.apache.hadoop.hbase.ServerName) Test(org.junit.Test)

Example 4 with SpanData

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)));
}
Also used : SpanData(io.opentelemetry.sdk.trace.data.SpanData) Test(org.junit.Test)

Example 5 with SpanData

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));
}
Also used : TableName(org.apache.hadoop.hbase.TableName) SpanData(io.opentelemetry.sdk.trace.data.SpanData) Matchers.containsString(org.hamcrest.Matchers.containsString)

Aggregations

SpanData (io.opentelemetry.sdk.trace.data.SpanData)15 Test (org.junit.Test)13 ServiceMetricEvent (org.apache.druid.java.util.emitter.service.ServiceMetricEvent)5 HashMap (java.util.HashMap)3 InetSocketAddress (java.net.InetSocketAddress)2 ServerName (org.apache.hadoop.hbase.ServerName)2 BlockingServiceAndInterface (org.apache.hadoop.hbase.ipc.RpcServer.BlockingServiceAndInterface)2 BlockingInterface (org.apache.hadoop.hbase.shaded.ipc.protobuf.generated.TestRpcServiceProtos.TestProtobufRpcProto.BlockingInterface)2 SpanKind (io.opentelemetry.api.trace.SpanKind)1 StatusCode (io.opentelemetry.api.trace.StatusCode)1 OpenTelemetryRule (io.opentelemetry.sdk.testing.junit4.OpenTelemetryRule)1 IOException (java.io.IOException)1 CompletableFuture (java.util.concurrent.CompletableFuture)1 Configuration (org.apache.hadoop.conf.Configuration)1 HBaseClassTestRule (org.apache.hadoop.hbase.HBaseClassTestRule)1 HBaseConfiguration (org.apache.hadoop.hbase.HBaseConfiguration)1 HRegionLocation (org.apache.hadoop.hbase.HRegionLocation)1 TableName (org.apache.hadoop.hbase.TableName)1 Waiter (org.apache.hadoop.hbase.Waiter)1 UserProvider (org.apache.hadoop.hbase.security.UserProvider)1