File tree Expand file tree Collapse file tree 1 file changed +12
-6
lines changed
Expand file tree Collapse file tree 1 file changed +12
-6
lines changed Original file line number Diff line number Diff line change @@ -84,12 +84,18 @@ private static function enrichLog()
8484 // 'profileID' => $user->getProfileID()
8585 // );
8686
87- // Add traces information to logs to be able correlate with APM
88- $ ddTraceSpan = \DDTrace \GlobalTracer::get ()->getActiveSpan ();
89- $ record ['context ' ]['dd ' ] = [
90- "trace_id " => $ ddTraceSpan ->getTraceId (),
91- "span_id " => $ ddTraceSpan ->getSpanId ()
92- ];
87+ try {
88+ // Add traces information to logs to be able correlate with APM
89+ $ ddTraceSpan = \DDTrace \GlobalTracer::get ()->getActiveSpan ();
90+ $ record ['context ' ]['dd ' ] = [
91+ "trace_id " => $ ddTraceSpan ->getTraceId (),
92+ "span_id " => $ ddTraceSpan ->getSpanId ()
93+ ];
94+
95+ } catch (Exception $ e ) {
96+ error_log ($ e ->getMessage () . " If you run a cli mode service (such as a worker), did you set the DD_TRACE_CLI_ENABLED env variable? " );
97+ }
98+
9399 return $ record ;
94100 });
95101 }
You can’t perform that action at this time.
0 commit comments