Skip to content

Commit

Permalink
Handle possible NPE
Browse files Browse the repository at this point in the history
  • Loading branch information
sajinieKavindya committed Aug 20, 2024
1 parent e9c67ab commit ca31ff3
Showing 1 changed file with 3 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -214,8 +214,10 @@ private void startSpan(StatisticDataUnit statisticDataUnit, MessageContext synCt
if (isOuterLevelSpan(statisticDataUnit, spanStore)) {
// Extract span context from headers
context = extract(headersMap);
} else {
} else if (parentSpan != null) {
context = Context.current().with(parentSpan);
} else {
context = Context.current();
}
span = tracer.spanBuilder(statisticDataUnit.getComponentName()).setParent(context).startSpan();

Expand Down

0 comments on commit ca31ff3

Please sign in to comment.