@@ -3611,7 +3611,9 @@ void BrokerSession::processPushEvent(const bmqp::Event& event)
36113611 msgIterator,
36123612 " bmq.message.push" ,
36133613 baggage);
3614- d_consumerSpans[guid] = span;
3614+ if (span) {
3615+ d_consumerSpans[guid] = span;
3616+ }
36153617 }
36163618
36173619 // Update event stats
@@ -5623,7 +5625,7 @@ BrokerSession::BrokerSession(
56235625, d_usingSessionEventHandler(eventHandlerCb) // UnspecifiedBool operator ...
56245626, d_messageCorrelationIdContainer(
56255627 d_allocators.get(" messageCorrelationIdContainer" ))
5626- , d_consumerSpans(d_allocators.get( " consumerSpans " ) )
5628+ , d_consumerSpans(allocator )
56275629, d_fsmThread(bslmt::ThreadUtil::invalidHandle())
56285630, d_fsmThreadChecker()
56295631, d_fsmEventQueue(k_FSMQUEUE_INITIAL_CAPACITY,
@@ -7108,38 +7110,32 @@ bslma::ManagedPtr<void> BrokerSession::restoreDTPropertyAndActivateChildSpan(
71087110 return bslma::ManagedPtr<void >(); // RETURN
71097111 }
71107112
7111- bmqp::MessageProperties properties;
7112- int rc = iterator.loadMessageProperties (&properties);
7113- if (BSLS_PERFORMANCEHINT_PREDICT_UNLIKELY (rc != 0 )) {
7114- BSLS_PERFORMANCEHINT_UNLIKELY_HINT;
7115- BALL_LOG_ERROR << id ()
7116- << " Unable to load message properties, rc: " << rc
7117- << " " ;
7118- return bslma::ManagedPtr<void >(); // RETURN
7119- }
7120-
71217113 // If we fail at any step, create a span without parent
71227114 bsl::shared_ptr<bmqpi::DTSpan> childSpan;
71237115 bsl::vector<unsigned char > vecUnsignedChar;
71247116
7125- if (!properties.hasProperty (
7126- bmqp::MessageProperties::k_TRACE_PROPERTY_NAME)) {
7127- BALL_LOG_INFO
7128- << " Not restoring distributed trace from message properties. No "
7129- " distributed trace in message properties." ;
7117+ bmqp::MessageProperties properties;
7118+ const int rc = iterator.loadMessageProperties (&properties);
7119+ if (rc != 0 || !properties.hasProperty (
7120+ bmqp::MessageProperties::k_TRACE_PROPERTY_NAME)) {
7121+ // If we fail to load message properties or the property
7122+ // is not present, create a span without parent
7123+ childSpan = tracer->createChildSpan (bsl::shared_ptr<bmqpi::DTSpan>(),
7124+ operation,
7125+ baggage);
71307126 }
71317127 else {
71327128 const bsl::vector<char >& vecChar = properties.getPropertyAsBinary (
71337129 bmqp::MessageProperties::k_TRACE_PROPERTY_NAME);
71347130
71357131 vecUnsignedChar.resize (vecChar.size ());
71367132 bsl::copy (vecChar.begin (), vecChar.end (), vecUnsignedChar.begin ());
7137- }
71387133
7139- tracer->deserializeAndCreateChildSpan (&childSpan,
7140- vecUnsignedChar,
7141- operation,
7142- baggage);
7134+ tracer->deserializeAndCreateChildSpan (&childSpan,
7135+ vecUnsignedChar,
7136+ operation,
7137+ baggage);
7138+ }
71437139
71447140 // scope on the childSpan if we can successfully create one
71457141 return context->scope (childSpan);
0 commit comments