You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@hbase.apache.org by nd...@apache.org on 2021/10/18 22:21:28 UTC
[hbase] branch master updated: HBASE-26361 Enable OpenTelemetry to
be used from developer sandbox
This is an automated email from the ASF dual-hosted git repository.
ndimiduk pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/hbase.git
The following commit(s) were added to refs/heads/master by this push:
new cadac18 HBASE-26361 Enable OpenTelemetry to be used from developer sandbox
cadac18 is described below
commit cadac1889a69dbb9afad3cba9761cf7ee514713f
Author: Nick Dimiduk <nd...@apache.org>
AuthorDate: Thu Oct 14 11:57:51 2021 -0700
HBASE-26361 Enable OpenTelemetry to be used from developer sandbox
Signed-off-by: Tak Lon (Stephen) Wu <ta...@apache.org>
Signed-off-by: Duo Zhang <zh...@apache.org>
---
bin/hbase | 18 ++++++++++++++----
conf/hbase-env.sh | 2 +-
2 files changed, 15 insertions(+), 5 deletions(-)
diff --git a/bin/hbase b/bin/hbase
index 0206bbd..634b9d3 100755
--- a/bin/hbase
+++ b/bin/hbase
@@ -492,8 +492,16 @@ add_jdk11_deps_to_classpath() {
done
}
-enable_trace() {
- agent_jar=$(find lib/trace -type f -name "opentelemetry-javaagent-*")
+add_opentelemetry_agent() {
+ if ! agent_jar=$(find lib/trace -type f -name "opentelemetry-javaagent-*" 2>/dev/null); then
+ # must be dev environment
+ f="${HBASE_HOME}/hbase-build-configuration/target/cached_classpath.txt"
+ if [ ! -f "${f}" ]; then
+ echo "As this is a development environment, we need ${f} to be generated from maven (command: mvn install -DskipTests)"
+ exit 1
+ fi
+ agent_jar=$(tr ':' '\n' < "${f}" | grep opentelemetry-javaagent)
+ fi
HBASE_OPTS="$HBASE_OPTS -javaagent:$agent_jar $HBASE_TRACE_OPTS"
}
@@ -801,8 +809,10 @@ elif [ "${DEBUG}" = "true" ]; then
fi
if [[ -n "${HBASE_TRACE_OPTS}" ]]; then
- echo "Attach opentelemetry agent to enable trace"
- enable_trace
+ if [ "${DEBUG}" = "true" ]; then
+ echo "Attaching opentelemetry agent"
+ fi
+ add_opentelemetry_agent
fi
# Have JVM dump heap if we run out of memory. Files will be 'launch directory'
diff --git a/conf/hbase-env.sh b/conf/hbase-env.sh
index f660f16..eba5e4a 100644
--- a/conf/hbase-env.sh
+++ b/conf/hbase-env.sh
@@ -146,7 +146,7 @@
# Uncomment to enable trace, you can change the options to use other exporters such as jaeger or
# zipkin. See https://github.com/open-telemetry/opentelemetry-java-instrumentation on how to
# configure exporters and other components through system properties.
-# export HBASE_TRACE_OPTS="-Dotel.resource.attributes=service.name=HBase -Dotel.traces.exporter=logging otel.metrics.exporter=none"
+# export HBASE_TRACE_OPTS="-Dotel.resource.attributes=service.name=HBase -Dotel.traces.exporter=logging -Dotel.metrics.exporter=none"
# Additional argments passed to jshell invocation
# export HBASE_JSHELL_ARGS="--startup DEFAULT --startup PRINTING --startup hbase_startup.jsh"