[
https://issues.apache.org/jira/browse/HADOOP-11498?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=14291551#comment-14291551
]
Tsuyoshi OZAWA commented on HADOOP-11498:
-----------------------------------------
[~iwasakims] This patch changes the semantics at error time in
TraceSamplerFactory.createSampler():
{code}
+ conf.set(HTRACE_CONF_PREFIX + SamplerBuilder.SAMPLER_CONF_KEY, samplerStr);
+ if (samplerStr.equals("ProbabilitySampler")) {
double percentage =
conf.getDouble("htrace.probability.sampler.percentage", 0.01d);
+ conf.setDouble(
+ HTRACE_CONF_PREFIX + ProbabilitySampler.SAMPLER_FRACTION_CONF_KEY,
+ percentage / 100.0d);
LOG.info("HTrace is ON for " + percentage + "% of top-level spans.");
- return new ProbabilitySampler(percentage / 100.0d);
- } else {
- throw new RuntimeException("Can't create sampler " + samplerStr +
- ". Available samplers are NeverSampler, AlwaysSampler, " +
- "and ProbabilitySampler.");
}
+ return new SamplerBuilder(wrapHadoopConf(conf)).build();
{code}
TraceSamplerFactory#createSampler don't throw RuntimeException with this patch.
As a result, traceSampler in DFSClient can be null:
{code}
traceSampler = TraceSamplerFactory.createSampler(conf);
{code
Then, I think startSpan() can raise NPE since s is null:
{code}
public static <T> TraceScope startSpan(String description, Sampler<T> s, T
info) {
Span span = null;
if (isTracing() || s.next(info)) {
span = Tracer.getInstance().createNew(description);
}
return continueSpan(span);
}
{code}
What do you think?
> Bump the version of HTrace to 3.1.0-incubating
> ----------------------------------------------
>
> Key: HADOOP-11498
> URL: https://issues.apache.org/jira/browse/HADOOP-11498
> Project: Hadoop Common
> Issue Type: Improvement
> Reporter: Masatake Iwasaki
> Assignee: Masatake Iwasaki
> Attachments: HADOOP-11498.001.patch
>
>
> The package is renamed from org.htrace to org.apache.htrace.
--
This message was sent by Atlassian JIRA
(v6.3.4#6332)