Skip to content

Commit f6c46cf

Browse files
authored
Merge pull request #1 from apache/master
merge apache/hbase
2 parents 39a20c5 + cda5a87 commit f6c46cf

File tree

170 files changed

+7422
-3615
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

170 files changed

+7422
-3615
lines changed

bin/hbase

Lines changed: 18 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -492,9 +492,19 @@ add_jdk11_deps_to_classpath() {
492492
done
493493
}
494494

495-
enable_trace() {
496-
agent_jar=$(find lib/trace -type f -name "opentelemetry-javaagent-*")
497-
HBASE_OPTS="$HBASE_OPTS -javaagent:$agent_jar $HBASE_TRACE_OPTS"
495+
add_opentelemetry_agent() {
496+
if [ -e "${OPENTELEMETRY_JAVAAGENT_PATH}" ] ; then
497+
agent_jar="${OPENTELEMETRY_JAVAAGENT_PATH}"
498+
elif ! agent_jar=$(find -L "${HBASE_HOME}/lib/trace" -type f -name "opentelemetry-javaagent-*" 2>/dev/null); then
499+
# must be dev environment
500+
f="${HBASE_HOME}/hbase-build-configuration/target/cached_classpath.txt"
501+
if [ ! -f "${f}" ]; then
502+
echo "As this is a development environment, we need ${f} to be generated from maven (command: mvn install -DskipTests)"
503+
exit 1
504+
fi
505+
agent_jar=$(tr ':' '\n' < "${f}" | grep opentelemetry-javaagent)
506+
fi
507+
HBASE_OPTS="$HBASE_OPTS -javaagent:$agent_jar"
498508
}
499509

500510
#Add the development env class path stuff
@@ -557,6 +567,7 @@ elif [ "$COMMAND" = 'jshell' ] ; then
557567
CLASS='jdk.internal.jshell.tool.JShellToolProvider'
558568
# set default values for HBASE_JSHELL_ARGS
559569
read -r -a JSHELL_ARGS <<< "${HBASE_JSHELL_ARGS:-"--startup DEFAULT --startup PRINTING --startup ${HBASE_HOME}/bin/hbase_startup.jsh"}"
570+
HBASE_OPTS="$HBASE_OPTS $HBASE_JSHELL_OPTS"
560571
elif [ "$COMMAND" = "hbck" ] ; then
561572
# Look for the -j /path/to/HBCK2.jar parameter. Else pass through to hbck.
562573
case "${1}" in
@@ -801,8 +812,10 @@ elif [ "${DEBUG}" = "true" ]; then
801812
fi
802813

803814
if [[ -n "${HBASE_TRACE_OPTS}" ]]; then
804-
echo "Attach opentelemetry agent to enable trace"
805-
enable_trace
815+
if [ "${DEBUG}" = "true" ]; then
816+
echo "Attaching opentelemetry agent"
817+
fi
818+
add_opentelemetry_agent
806819
fi
807820

808821
# Have JVM dump heap if we run out of memory. Files will be 'launch directory'

conf/hbase-env.sh

Lines changed: 25 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -143,10 +143,32 @@
143143
# export GREP="${GREP-grep}"
144144
# export SED="${SED-sed}"
145145

146-
# Uncomment to enable trace, you can change the options to use other exporters such as jaeger or
147-
# zipkin. See https://github.com/open-telemetry/opentelemetry-java-instrumentation on how to
146+
# Tracing
147+
# Uncomment some combination of these lines to enable tracing. You should change the options to use
148+
# the exporters appropriate to your environment. See
149+
# https://github.com/open-telemetry/opentelemetry-java-instrumentation for details on how to
148150
# configure exporters and other components through system properties.
149-
# export HBASE_TRACE_OPTS="-Dotel.resource.attributes=service.name=HBase -Dotel.traces.exporter=logging otel.metrics.exporter=none"
151+
#
152+
# The presence HBASE_TRACE_OPTS indicates that tracing should be enabled, and serves as site-wide
153+
# settings.
154+
# export HBASE_TRACE_OPTS="-Dotel.traces.exporter=none -Dotel.metrics.exporter=none"
155+
#
156+
# Per-process configuration variables allow for fine-grained configuration control.
157+
# export HBASE_SHELL_OPTS="${HBASE_SHELL_OPTS} ${HBASE_TRACE_OPTS} -Dotel.resource.attributes=service.name=hbase-shell"
158+
# export HBASE_JSHELL_OPTS="${HBASE_JSHELL_OPTS} ${HBASE_TRACE_OPTS} -Dotel.resource.attributes=service.name=hbase-jshell"
159+
# export HBASE_HBCK_OPTS="${HBASE_HBCK_OPTS} ${HBASE_TRACE_OPTS} -Dotel.resource.attributes=service.name=hbase-hbck"
160+
# export HBASE_MASTER_OPTS="${HBASE_MASTER_OPTS} ${HBASE_TRACE_OPTS} -Dotel.resource.attributes=service.name=hbase-master"
161+
# export HBASE_REGIONSERVER_OPTS="${HBASE_REGIONSERVER_OPTS} ${HBASE_TRACE_OPTS} -Dotel.resource.attributes=service.name=hbase-regionserver"
162+
# export HBASE_THRIFT_OPTS="${HBASE_THRIFT_OPTS} ${HBASE_TRACE_OPTS} -Dotel.resource.attributes=service.name=hbase-thrift"
163+
# export HBASE_REST_OPTS="${HBASE_REST_OPTS} ${HBASE_TRACE_OPTS} -Dotel.resource.attributes=service.name=hbase-rest"
164+
# export HBASE_ZOOKEEPER_OPTS="${HBASE_ZOOKEEPER_OPTS} ${HBASE_TRACE_OPTS} -Dotel.resource.attributes=service.name=hbase-zookeeper"
165+
# export HBASE_PE_OPTS="${HBASE_PE_OPTS} ${HBASE_TRACE_OPTS} -Dotel.resource.attributes=service.name=hbase-performanceevaluation"
166+
# export HBASE_LTT_OPTS="${HBASE_LTT_OPTS} ${HBASE_TRACE_OPTS} -Dotel.resource.attributes=service.name=hbase-loadtesttool"
167+
# export HBASE_CANARY_OPTS="${HBASE_CANARY_OPTS} ${HBASE_TRACE_OPTS} -Dotel.resource.attributes=service.name=hbase-canary"
168+
# export HBASE_HBTOP_OPTS="${HBASE_HBTOP_OPTS} ${HBASE_TRACE_OPTS} -Dotel.resource.attributes=service.name=hbase-hbtop"
169+
#
170+
# Manually specify a value for OPENTELEMETRY_JAVAAGENT_PATH to override the autodiscovery mechanism
171+
# export OPENTELEMETRY_JAVAAGENT_PATH=""
150172

151173
# Additional argments passed to jshell invocation
152174
# export HBASE_JSHELL_ARGS="--startup DEFAULT --startup PRINTING --startup hbase_startup.jsh"

0 commit comments

Comments
 (0)