HBASE-26432 enabled tracing from shell (#3824)
Signed-off-by: Duo Zhang <zhangduo@apache.org> Signed-off-by: Tak Lon (Stephen) Wu <taklwu@apache.org>
This commit is contained in:
parent
539e161e74
commit
e1ce414b1b
|
@ -17,21 +17,16 @@
|
||||||
# limitations under the License.
|
# limitations under the License.
|
||||||
#
|
#
|
||||||
|
|
||||||
# Disable tracing for now as HTrace does not work any more
|
|
||||||
#java_import org.apache.hadoop.hbase.trace.SpanReceiverHost
|
|
||||||
|
|
||||||
module Shell
|
module Shell
|
||||||
module Commands
|
module Commands
|
||||||
class Trace < Command
|
class Trace < Command
|
||||||
# @@conf = org.apache.htrace.core.HTraceConfiguration.fromKeyValuePairs(
|
@@tracer = org.apache.hadoop.hbase.trace.TraceUtil.getGlobalTracer()
|
||||||
# 'sampler.classes', 'org.apache.htrace.core.AlwaysSampler'
|
@@tracespan = nil
|
||||||
# )
|
@@tracescope = nil
|
||||||
# @@tracer = org.apache.htrace.core.Tracer::Builder.new('HBaseShell').conf(@@conf).build()
|
|
||||||
# @@tracescope = nil
|
|
||||||
|
|
||||||
def help
|
def help
|
||||||
<<-EOF
|
<<-EOF
|
||||||
Start or Stop tracing using HTrace.
|
Start or Stop tracing using OpenTelemetry.
|
||||||
Always returns true if tracing is running, otherwise false.
|
Always returns true if tracing is running, otherwise false.
|
||||||
If the first argument is 'start', new span is started.
|
If the first argument is 'start', new span is started.
|
||||||
If the first argument is 'stop', current running span is stopped.
|
If the first argument is 'stop', current running span is stopped.
|
||||||
|
@ -58,23 +53,24 @@ EOF
|
||||||
end
|
end
|
||||||
|
|
||||||
def trace(startstop, spanname)
|
def trace(startstop, spanname)
|
||||||
# @@receiver ||= SpanReceiverHost.getInstance(@shell.hbase.configuration)
|
if startstop == 'start'
|
||||||
# if startstop == 'start'
|
unless tracing?
|
||||||
# unless tracing?
|
@@tracespan = @@tracer.spanBuilder(spanname).startSpan()
|
||||||
# @@tracescope = @@tracer.newScope(spanname)
|
@@tracescope = @@tracespan.makeCurrent()
|
||||||
# end
|
end
|
||||||
# elsif startstop == 'stop'
|
elsif startstop == 'stop'
|
||||||
# if tracing?
|
if tracing?
|
||||||
# @@tracescope.close
|
@@tracescope.close()
|
||||||
# @@tracescope = nil
|
@@tracespan.end()
|
||||||
# end
|
@@tracescope = nil
|
||||||
# end
|
end
|
||||||
# tracing?
|
end
|
||||||
|
tracing?
|
||||||
end
|
end
|
||||||
|
|
||||||
# def tracing?
|
def tracing?
|
||||||
# @@tracescope != nil
|
@@tracescope != nil
|
||||||
# end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
Loading…
Reference in New Issue