Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix NPE when Open Telemetry + Statistics are enabled with inbound endpoints #2100

Merged
merged 1 commit into from
Sep 15, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading