Skip to content

Commit

Permalink
Merge pull request #20 from appoptics/NH-5044-npe-unboxing-null
Browse files Browse the repository at this point in the history
NH-5044: Fix NPE issue unboxing null
  • Loading branch information
jiwen624 authored Dec 7, 2021
2 parents b78116a + 89f8954 commit 44457f5
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 4 deletions.
2 changes: 1 addition & 1 deletion build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ subprojects {
opentelemetryJavaagent: "1.7.2",
bytebuddy : "1.10.18",
guava : "30.1-jre",
appopticsCore : "7.0.1",
appopticsCore : "7.0.2",
appopticsMetrics : "7.0.0"
]
versions.opentelemetryAlpha = "${versions.opentelemetry}-alpha"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,9 +34,10 @@ public void onStart(Context parentContext, ReadWriteSpan span) {
SpanContext parentSpanContext = Span.fromContext(parentContext).getSpanContext();
if (!parentSpanContext.isValid() || parentSpanContext.isRemote()) { //then a root span of this service
if (PROFILER_ENABLED) {
Metadata metadata = Util.buildMetadata(span.getSpanContext());
SpanContext spanContext = span.getSpanContext();
Metadata metadata = Util.buildMetadata(spanContext);
if (metadata.isValid()) {
Profiler.addProfiledThread(Thread.currentThread(), metadata, metadata.getTraceId());
Profiler.addProfiledThread(Thread.currentThread(), metadata, Metadata.bytesToHex(metadata.getTaskID()));
span.setAttribute(SW_KEY_PREFIX + "ProfileSpans", 1);
}
} else {
Expand All @@ -56,7 +57,7 @@ public void onEnd(ReadableSpan span) {
if (span.getSpanContext().isSampled()) { //only profile on sampled spans
SpanContext parentSpanContext = span.toSpanData().getParentSpanContext();
if (!parentSpanContext.isValid() || parentSpanContext.isRemote()) { //then a root span of this service
Profiler.stopProfile(Util.toTraceId(span.getSpanContext().getTraceIdBytes()));
Profiler.stopProfile(span.getSpanContext().getTraceId());
}
}
}
Expand Down

0 comments on commit 44457f5

Please sign in to comment.