Skip to content
Merged
Changes from 1 commit
Commits
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
42 changes: 19 additions & 23 deletions hbase-shell/src/main/ruby/shell/commands/trace.rb
Original file line number Diff line number Diff line change
Expand Up @@ -17,17 +17,12 @@
# 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 Commands
class Trace < Command
# @@conf = org.apache.htrace.core.HTraceConfiguration.fromKeyValuePairs(
# 'sampler.classes', 'org.apache.htrace.core.AlwaysSampler'
# )
# @@tracer = org.apache.htrace.core.Tracer::Builder.new('HBaseShell').conf(@@conf).build()
# @@tracescope = nil
@@tracer = org.apache.hadoop.hbase.trace.TraceUtil.getGlobalTracer()
@@tracespan = nil
@@tracescope = nil

def help
<<-EOF
Expand Down Expand Up @@ -58,23 +53,24 @@ def command(startstop = 'status', spanname = 'HBaseShell')
end

def trace(startstop, spanname)
# @@receiver ||= SpanReceiverHost.getInstance(@shell.hbase.configuration)
# if startstop == 'start'
# unless tracing?
# @@tracescope = @@tracer.newScope(spanname)
# end
# elsif startstop == 'stop'
# if tracing?
# @@tracescope.close
# @@tracescope = nil
# end
# end
# tracing?
if startstop == 'start'
unless tracing?
@@tracespan = @@tracer.spanBuilder(spanname).startSpan()
@@tracescope = @@tracespan.makeCurrent()
end
elsif startstop == 'stop'
if tracing?
@@tracescope.close()
@@tracespan.end()
@@tracescope = nil
end
end
tracing?
end

# def tracing?
# @@tracescope != nil
# end
def tracing?
@@tracescope != nil
end
end
end
end