Skip to content
Merged
Show file tree
Hide file tree
Changes from 8 commits
Commits
Show all changes
24 commits
Select commit Hold shift + click to select a range
750e307
feat: Add support for HBase versions 2.0.0 to 2.5.0.
YaoYingLong Apr 24, 2026
6772032
Merge branch 'main' into feature/hbase-2.0.0
YaoYingLong Apr 24, 2026
85e0cff
feat: Code review issue optimization and repeated test code merging.
YaoYingLong Apr 24, 2026
074d553
Merge branch 'main' into feature/hbase-2.0.0
YaoYingLong Apr 26, 2026
df40828
Merge branch 'main' into feature/hbase-2.0.0
trask May 2, 2026
4101651
fix: Fix the bug causing the failed check
YaoYingLong May 12, 2026
bf11f65
Fix: spotlessJavaCheck execution failure
YaoYingLong May 13, 2026
dcd7d0b
Fix: Fix the issue where VirtualField has an overly broad scope.
YaoYingLong May 13, 2026
9b3fd85
feat: Optimize code review issues
YaoYingLong May 22, 2026
334e01c
Merge branch 'main' into feature/hbase-2.0.0
YaoYingLong May 22, 2026
bfba82a
fix: Fix fossa‑configuration‑check failure
YaoYingLong May 22, 2026
1c9ef26
Merge remote-tracking branch 'origin/feature/hbase-2.0.0' into featur…
YaoYingLong May 22, 2026
79d54f2
fix: remove :instrumentation:hbase:hbase-common:javaagent from .fossa…
YaoYingLong May 25, 2026
0408afc
feat: Optimize code comments
YaoYingLong May 26, 2026
d07b69b
fix: document HBase latest dep test override
YaoYingLong May 27, 2026
e66dbf4
Merge branch 'main' into feature/hbase-2.0.0
laurit Jun 2, 2026
09ace1f
review
laurit Jun 2, 2026
4500547
Move shaded client tests into a suite
laurit Jun 3, 2026
9ca8321
feat: Optimize test cases
YaoYingLong Jun 5, 2026
9f4b364
fix: Resolve Spotless task execution failure
YaoYingLong Jun 5, 2026
e5948f7
review
laurit Jun 5, 2026
4412291
flatten directory hierarchy
laurit Jun 5, 2026
1d920c9
update fossa configuration
laurit Jun 5, 2026
df69aa0
Merge branch 'open-telemetry:main' into feature/hbase-2.0.0
YaoYingLong Jun 9, 2026
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions .fossa.yml
Original file line number Diff line number Diff line change
Expand Up @@ -502,6 +502,12 @@ targets:
- type: gradle
path: ./
target: ':instrumentation:graphql-java:graphql-java-common-12.0:library'
- type: gradle
path: ./
target: ':instrumentation:hbase:hbase-client-2.0.0:javaagent'
- type: gradle
path: ./
target: ':instrumentation:hbase:hbase-common:javaagent'
- type: gradle
path: ./
target: ':instrumentation:hibernate:hibernate-3.3:javaagent'
Expand Down
4 changes: 4 additions & 0 deletions .github/config/latest-dep-versions.json
Original file line number Diff line number Diff line change
Expand Up @@ -283,6 +283,10 @@
"org.apache.dubbo:dubbo#+": "3.3.6",
"org.apache.dubbo:dubbo-config-api#+": "3.3.6",
"org.apache.geode:geode-core#+": "2.0.1",
"org.apache.hbase:hbase-client#+": "2.6.5",
"org.apache.hbase:hbase-client#2.4.+": "2.4.18",
"org.apache.hbase:hbase-shaded-client#+": "2.4.18",
"org.apache.hbase:hbase-shaded-client#2.4.+": "2.4.18",
"org.apache.httpcomponents.client5:httpclient5#+": "5.6.1",
"org.apache.httpcomponents:httpasyncclient#+": "4.1.5",
"org.apache.httpcomponents:httpclient#+": "4.5.14",
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,62 @@
plugins {
id("otel.javaagent-instrumentation")
}

otelJava {
// HBase 2.0.x test stack is not reliable on JDK 25+.
maxJavaVersionForTests.set(JavaVersion.VERSION_24)
}

muzzle {
pass {
group.set("org.apache.hbase")
module.set("hbase-client")
versions.set("[2.0.0, 2.5.0)")
assertInverse.set(true)
}
}

dependencies {
implementation(project(":instrumentation:hbase:hbase-common:javaagent"))

library("org.apache.hbase:hbase-client:2.0.0")
testLibrary("org.apache.hbase:hbase-client:2.3.7")
Comment thread
laurit marked this conversation as resolved.
Outdated
latestDepTestLibrary("org.apache.hbase:hbase-client:2.4.+") // documented limitation
testImplementation("com.google.code.findbugs:annotations:3.0.1")
testImplementation(project(":instrumentation:hbase:hbase-common:testing"))
}

tasks {
withType<Test>().configureEach {
usesService(gradle.sharedServices.registrations["testcontainersBuildService"].service)
systemProperty("collectMetadata", otelProps.collectMetadata)
jvmArgs(
"-Dotel.javaagent.exclude-classes=com.google.protobuf.*,com.fasterxml.jackson.*,com.google.common.*,ch.qos.logback.*,javax.xml.*",
)
}

val testStableSemconv by registering(Test::class) {
// HBase test container binds fixed host ports, so do not run it alongside the default test task.
mustRunAfter(named("test"))

testClassesDirs = sourceSets.test.get().output.classesDirs
classpath = sourceSets.test.get().runtimeClasspath

jvmArgs(
"-Dotel.semconv-stability.opt-in=database",
"-Dotel.javaagent.exclude-classes=com.google.protobuf.*,com.fasterxml.jackson.*,com.google.common.*,ch.qos.logback.*,javax.xml.*",
)
systemProperty("metadataConfig", "otel.semconv-stability.opt-in=database")
systemProperty("collectMetadata", otelProps.collectMetadata)
}

check {
dependsOn(testStableSemconv)
}

if (otelProps.denyUnsafe) {
withType<Test>().configureEach {
enabled = false
}
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,134 @@
/*
* Copyright The OpenTelemetry Authors
* SPDX-License-Identifier: Apache-2.0
*/

package io.opentelemetry.javaagent.instrumentation.hbase.client.v2_0_0;
Comment thread
laurit marked this conversation as resolved.
Outdated

import static io.opentelemetry.javaagent.instrumentation.hbase.client.v2_0_0.HbaseSingletons.RC_THREAD_LOCAL;
import static io.opentelemetry.javaagent.instrumentation.hbase.client.v2_0_0.HbaseSingletons.TABLE_THREAD_LOCAL;
import static io.opentelemetry.javaagent.instrumentation.hbase.client.v2_0_0.HbaseSingletons.instrumenter;
import static net.bytebuddy.matcher.ElementMatchers.named;
import static net.bytebuddy.matcher.ElementMatchers.takesArgument;

import io.opentelemetry.context.Context;
import io.opentelemetry.context.Scope;
import io.opentelemetry.javaagent.bootstrap.Java8BytecodeBridge;
import io.opentelemetry.javaagent.extension.instrumentation.TypeInstrumentation;
import io.opentelemetry.javaagent.extension.instrumentation.TypeTransformer;
import io.opentelemetry.javaagent.instrumentation.hbase.common.CallMethodHelper;
import io.opentelemetry.javaagent.instrumentation.hbase.common.HbaseRequest;
import io.opentelemetry.javaagent.instrumentation.hbase.common.RequestAndContext;
import java.net.InetSocketAddress;
import javax.annotation.Nullable;
import net.bytebuddy.asm.Advice;
import net.bytebuddy.description.type.TypeDescription;
import net.bytebuddy.matcher.ElementMatcher;
import org.apache.hadoop.hbase.net.Address;
import org.apache.hadoop.hbase.security.User;
import org.apache.hbase.thirdparty.com.google.protobuf.Descriptors;

public final class AbstractRpcClientInstrumentation implements TypeInstrumentation {
Comment thread
laurit marked this conversation as resolved.
Outdated

@Override
public ElementMatcher<TypeDescription> typeMatcher() {
return named("org.apache.hadoop.hbase.ipc.AbstractRpcClient");
}

@Override
public void transform(TypeTransformer transformer) {
transformer.applyAdviceToMethod(
named("callMethod")
.and(
takesArgument(
0,
named(
"org.apache.hbase.thirdparty.com.google.protobuf.Descriptors$MethodDescriptor")))
.and(takesArgument(4, named("org.apache.hadoop.hbase.security.User")))
.and(takesArgument(5, named("java.net.InetSocketAddress"))),
AbstractRpcClientInstrumentation.class.getName() + "$CallMethodAdvice");
Comment thread
laurit marked this conversation as resolved.
Outdated

// 2.4.18 version
transformer.applyAdviceToMethod(
named("callMethod")
.and(
takesArgument(
0,
named(
"org.apache.hbase.thirdparty.com.google.protobuf.Descriptors$MethodDescriptor")))
.and(takesArgument(4, named("org.apache.hadoop.hbase.security.User")))
.and(takesArgument(5, named("org.apache.hadoop.hbase.net.Address"))),
Comment thread
laurit marked this conversation as resolved.
Outdated
AbstractRpcClientInstrumentation.class.getName() + "$CallMethodLastAdvice");
}

@SuppressWarnings("unused")
public static class CallMethodAdvice {
@Advice.OnMethodEnter(suppress = Throwable.class)
public static RequestAndContext onEnter(
@Advice.Argument(0) Descriptors.MethodDescriptor md,
@Advice.Argument(4) User ticket,
@Advice.Argument(5) InetSocketAddress addr) {
HbaseRequest request =
CallMethodHelper.buildRequest(
md.getName(), TABLE_THREAD_LOCAL.get(), ticket.getName(), addr);
Context parentContext = Java8BytecodeBridge.currentContext();
if (!instrumenter().shouldStart(parentContext, request)) {
return null;
}
Context context = instrumenter().start(parentContext, request);
Scope scope = context.makeCurrent();
RequestAndContext requestAndContext = RequestAndContext.create(request, scope, context);
RC_THREAD_LOCAL.set(requestAndContext);
return requestAndContext;
}

@Advice.OnMethodExit(onThrowable = Throwable.class, suppress = Throwable.class)
public static void onExit(
@Advice.Thrown Throwable throwable,
@Advice.Enter @Nullable RequestAndContext requestAndContext) {
if (requestAndContext == null) {
return;
}
RC_THREAD_LOCAL.remove();
CallMethodHelper.handleOnExit(throwable, requestAndContext, instrumenter(), false);
}
}

@SuppressWarnings("unused")
public static class CallMethodLastAdvice {
@Advice.OnMethodEnter(suppress = Throwable.class)
public static RequestAndContext onEnter(
@Advice.Argument(0) Descriptors.MethodDescriptor md,
@Advice.Argument(4) User ticket,
@Advice.Argument(5) Address addr) {
HbaseRequest request =
CallMethodHelper.buildRequest(
md.getName(),
TABLE_THREAD_LOCAL.get(),
ticket.getName(),
addr.getHostname(),
addr.getPort());
Context parentContext = Java8BytecodeBridge.currentContext();
if (!instrumenter().shouldStart(parentContext, request)) {
return null;
}
Context context = instrumenter().start(parentContext, request);
Scope scope = context.makeCurrent();

RequestAndContext requestAndContext = RequestAndContext.create(request, scope, context);
RC_THREAD_LOCAL.set(requestAndContext);
return requestAndContext;
}

@Advice.OnMethodExit(onThrowable = Throwable.class, suppress = Throwable.class)
public static void onExit(
@Advice.Thrown Throwable throwable,
@Advice.Enter @Nullable RequestAndContext requestAndContext) {
if (requestAndContext == null) {
return;
}
RC_THREAD_LOCAL.remove();
CallMethodHelper.handleOnExit(throwable, requestAndContext, instrumenter(), false);
}
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,60 @@
/*
* Copyright The OpenTelemetry Authors
* SPDX-License-Identifier: Apache-2.0
*/

package io.opentelemetry.javaagent.instrumentation.hbase.client.v2_0_0;

import static io.opentelemetry.javaagent.extension.matcher.AgentElementMatchers.hasClassesNamed;
import static java.util.Arrays.asList;
import static java.util.Collections.singletonList;
import static net.bytebuddy.matcher.ElementMatchers.not;

import com.google.auto.service.AutoService;
import io.opentelemetry.javaagent.extension.instrumentation.InstrumentationModule;
import io.opentelemetry.javaagent.extension.instrumentation.TypeInstrumentation;
import io.opentelemetry.javaagent.extension.instrumentation.internal.ExperimentalInstrumentationModule;
import java.util.List;
import net.bytebuddy.matcher.ElementMatcher;

@AutoService(InstrumentationModule.class)
public final class HbaseInstrumentationModule extends InstrumentationModule
implements ExperimentalInstrumentationModule {

private static final String CALL_UTIL = "org.apache.hadoop.hbase.ipc.OpenTelemetryCallUtil";

public HbaseInstrumentationModule() {
super("hbase-client", "hbase-client-2.0.0");
Comment thread
laurit marked this conversation as resolved.
Outdated
}

@Override
public ElementMatcher.Junction<ClassLoader> classLoaderMatcher() {
return hasClassesNamed("org.apache.hadoop.hbase.ipc.RpcConnection")
.and(hasClassesNamed("org.apache.hadoop.hbase.client.AsyncAdmin"))
Comment thread
laurit marked this conversation as resolved.
Outdated
.and(not(hasClassesNamed("org.apache.hadoop.hbase.client.trace.IpcClientSpanBuilder")));
}

@Override
public boolean isHelperClass(String className) {
return CALL_UTIL.equals(className);
}

@Override
public List<String> injectedClassNames() {
return singletonList(CALL_UTIL);
}

@Override
public List<String> getAdditionalHelperClassNames() {
return singletonList(CALL_UTIL);
}
Comment thread
laurit marked this conversation as resolved.
Outdated

@Override
public List<TypeInstrumentation> typeInstrumentations() {
return asList(
new RegionServerCallableInstrumentation(),
new AbstractRpcClientInstrumentation(),
new RpcConnectionInstrumentation(),
new IpcCallInstrumentation());
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
/*
* Copyright The OpenTelemetry Authors
* SPDX-License-Identifier: Apache-2.0
*/

package io.opentelemetry.javaagent.instrumentation.hbase.client.v2_0_0;

import io.opentelemetry.instrumentation.api.instrumenter.Instrumenter;
import io.opentelemetry.javaagent.instrumentation.hbase.common.HbaseInstrumenterFactory;
import io.opentelemetry.javaagent.instrumentation.hbase.common.HbaseRequest;
import io.opentelemetry.javaagent.instrumentation.hbase.common.RequestAndContext;

public class HbaseSingletons {

public static final ThreadLocal<String> TABLE_THREAD_LOCAL = new ThreadLocal<>();
public static final ThreadLocal<RequestAndContext> RC_THREAD_LOCAL = new ThreadLocal<>();

private static final String INSTRUMENTATION_NAME = "io.opentelemetry.hbase-client-2.0.0";
private static final Instrumenter<HbaseRequest, Void> INSTRUMENTER =
HbaseInstrumenterFactory.instrumenter(INSTRUMENTATION_NAME);
Comment thread
laurit marked this conversation as resolved.
Outdated

public static Instrumenter<HbaseRequest, Void> instrumenter() {
return INSTRUMENTER;
}

private HbaseSingletons() {}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
/*
* Copyright The OpenTelemetry Authors
* SPDX-License-Identifier: Apache-2.0
*/

package io.opentelemetry.javaagent.instrumentation.hbase.client.v2_0_0;

import static io.opentelemetry.javaagent.instrumentation.hbase.client.v2_0_0.HbaseSingletons.instrumenter;
import static net.bytebuddy.matcher.ElementMatchers.isMethod;
import static net.bytebuddy.matcher.ElementMatchers.named;

import io.opentelemetry.context.Context;
import io.opentelemetry.javaagent.extension.instrumentation.TypeInstrumentation;
import io.opentelemetry.javaagent.extension.instrumentation.TypeTransformer;
import io.opentelemetry.javaagent.instrumentation.hbase.common.HbaseRequest;
import io.opentelemetry.javaagent.instrumentation.hbase.common.RequestAndContext;
import java.io.IOException;
import net.bytebuddy.asm.Advice;
import net.bytebuddy.description.type.TypeDescription;
import net.bytebuddy.matcher.ElementMatcher;
import org.apache.hadoop.hbase.ipc.OpenTelemetryCallUtil;

public final class IpcCallInstrumentation implements TypeInstrumentation {

@Override
public ElementMatcher<TypeDescription> typeMatcher() {
return named("org.apache.hadoop.hbase.ipc.Call");
}

@Override
public void transform(TypeTransformer transformer) {
transformer.applyAdviceToMethod(
isMethod().and(named("callComplete").or(named("setTimeout"))),
Comment thread
laurit marked this conversation as resolved.
Outdated
IpcCallInstrumentation.class.getName() + "$CallAdvice");
}

public static class CallAdvice {
@Advice.OnMethodEnter(suppress = Throwable.class)
public static void onEnter(
@Advice.This Object call, @Advice.FieldValue(value = "error") IOException error) {
RequestAndContext requestAndContext =
OpenTelemetryCallUtil.getAndClearRequestAndContext(call);
if (requestAndContext == null) {
return;
}

Context context = requestAndContext.getContext();
HbaseRequest request = requestAndContext.getRequest();
if (context == null || request == null) {
return;
}
instrumenter().end(context, request, null, error);
}
}
}
Loading
Loading