Skip to content

Commit

Permalink
Fix NPE when Opentelemetry+Statistics are enabled with inbound endpoints
Browse files Browse the repository at this point in the history
  • Loading branch information
sajinieKavindya committed Sep 14, 2023
1 parent c62fcca commit 4a9d68b
Showing 1 changed file with 8 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -208,7 +208,10 @@ private void startSpan(StatisticDataUnit statisticDataUnit, MessageContext synCt
Object statusCode = ((Axis2MessageContext) synCtx).getAxis2MessageContext().getProperty("HTTP_SC");
Object statusDescription = ((Axis2MessageContext) synCtx).getAxis2MessageContext().getProperty("HTTP_DESC");
// We only need to extract span context from headers when there are trp headers available
if (isOuterLevelSpan(statisticDataUnit, spanStore) && headersMap != null) {
if (headersMap == null) {
headersMap = new HashMap();
}
if (isOuterLevelSpan(statisticDataUnit, spanStore)) {
// Extract span context from headers
context = extract(headersMap);
} else {
Expand Down Expand Up @@ -274,9 +277,10 @@ private void bufferSequenceContinuationState(StatisticDataUnit statisticDataUnit
* @return Whether the given statistic data unit denotes an outer level span.
*/
private boolean isOuterLevelSpan(StatisticDataUnit statisticDataUnit, SpanStore spanStore) {
return spanStore.getOuterLevelSpanWrapper() == null &&
(statisticDataUnit.getComponentType() == ComponentType.PROXYSERVICE ||
statisticDataUnit.getComponentType() == ComponentType.API);
return spanStore.getOuterLevelSpanWrapper() == null
&& (statisticDataUnit.getComponentType() == ComponentType.PROXYSERVICE
|| statisticDataUnit.getComponentType() == ComponentType.API
|| statisticDataUnit.getComponentType() == ComponentType.INBOUNDENDPOINT);
}

@Override
Expand Down

0 comments on commit 4a9d68b

Please sign in to comment.