HBASE-20245 HTrace commands do not work
This commit is contained in:
parent
e962e1ac2f
commit
72e6d7c073
|
@ -16,13 +16,18 @@
|
||||||
# See the License for the specific language governing permissions and
|
# See the License for the specific language governing permissions and
|
||||||
# limitations under the License.
|
# limitations under the License.
|
||||||
#
|
#
|
||||||
HTrace = org.apache.htrace.core.Tracer
|
|
||||||
java_import org.apache.htrace.core.Sampler
|
|
||||||
java_import org.apache.hadoop.hbase.trace.SpanReceiverHost
|
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(
|
||||||
|
'sampler.classes', 'org.apache.htrace.core.AlwaysSampler'
|
||||||
|
)
|
||||||
|
@@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 HTrace.
|
||||||
|
@ -55,16 +60,19 @@ EOF
|
||||||
@@receiver ||= SpanReceiverHost.getInstance(@shell.hbase.configuration)
|
@@receiver ||= SpanReceiverHost.getInstance(@shell.hbase.configuration)
|
||||||
if startstop == 'start'
|
if startstop == 'start'
|
||||||
unless tracing?
|
unless tracing?
|
||||||
@@tracescope = HTrace.startSpan(spanname, Sampler.ALWAYS)
|
@@tracescope = @@tracer.newScope(spanname)
|
||||||
end
|
end
|
||||||
elsif startstop == 'stop'
|
elsif startstop == 'stop'
|
||||||
@@tracescope.close if tracing?
|
if tracing?
|
||||||
|
@@tracescope.close
|
||||||
|
@@tracescope = nil
|
||||||
|
end
|
||||||
end
|
end
|
||||||
tracing?
|
tracing?
|
||||||
end
|
end
|
||||||
|
|
||||||
def tracing?
|
def tracing?
|
||||||
HTrace.isTracing
|
@@tracescope != nil
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
Loading…
Reference in New Issue