Skip to content

Commit

Permalink
Merge pull request #18 from appoptics/NH-5044-profiling-processor-npe
Browse files Browse the repository at this point in the history
NH-5044: Print stacktrace for OboeException
  • Loading branch information
jiwen624 authored Nov 30, 2021
2 parents 2575be9 + 5bfeda8 commit d24537b
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,8 @@ public static Metadata buildMetadata(SpanContext context) {
try {
return new Metadata(W3CContextToHexString(context));
} catch (OboeException e) {
return null;
logger.info("Failed to get AO metadata from span context: " + W3CContextToHexString(context), e);
return new Metadata();
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,8 +35,10 @@ public void onStart(Context parentContext, ReadWriteSpan span) {
if (!parentSpanContext.isValid() || parentSpanContext.isRemote()) { //then a root span of this service
if (PROFILER_ENABLED) {
Metadata metadata = Util.buildMetadata(span.getSpanContext());
Profiler.addProfiledThread(Thread.currentThread(), metadata, metadata.getTraceId());
span.setAttribute(SW_KEY_PREFIX + "ProfileSpans", 1);
if (metadata.isValid()) {
Profiler.addProfiledThread(Thread.currentThread(), metadata, metadata.getTraceId());
span.setAttribute(SW_KEY_PREFIX + "ProfileSpans", 1);
}
} else {
span.setAttribute(SW_KEY_PREFIX + "ProfileSpans", -1); //profiler disabled
}
Expand Down

0 comments on commit d24537b

Please sign in to comment.