@@ -298,13 +298,12 @@ public void setAction(AgentSpan span, Connection connection) {
298298
299299 span .setTag ("_dd.dbm_trace_injected" , true );
300300 } catch (Throwable e ) {
301- log .debug (
302- "Failed to set extra DBM data in application_name for trace {}. "
303- + "To disable this behavior, set trace_prepared_statements to 'false'. "
304- + "See https://docs.datadoghq.com/database_monitoring/connect_dbm_and_apm/ for more info. {}" ,
305- span .getTraceId ().toHexString (),
306- e );
307301 DECORATE .onError (span , e );
302+ span .setErrorMessage (
303+ "Failed to set extra DBM data in application_name. "
304+ + "To disable this behavior, set trace_prepared_statements to 'false'. "
305+ + "See https://docs.datadoghq.com/database_monitoring/connect_dbm_and_apm/ for more info.\n "
306+ + e .getMessage ());
308307 }
309308 }
310309
@@ -358,13 +357,12 @@ public long setContextInfo(Connection connection, DBInfo dbInfo) {
358357 throw e ;
359358 }
360359 } catch (Exception e ) {
361- log .debug (
362- "Failed to set extra DBM data in context info for trace {}. "
363- + "To disable this behavior, set DBM_PROPAGATION_MODE to 'service' mode. "
364- + "See https://docs.datadoghq.com/database_monitoring/connect_dbm_and_apm/ for more info.{}" ,
365- instrumentationSpan .getTraceId ().toHexString (),
366- e );
367360 DECORATE .onError (instrumentationSpan , e );
361+ instrumentationSpan .setErrorMessage (
362+ "Failed to set extra DBM data in application_name. "
363+ + "To disable this behavior, set trace_prepared_statements to 'false'. "
364+ + "See https://docs.datadoghq.com/database_monitoring/connect_dbm_and_apm/ for more info.\n "
365+ + e .getMessage ());
368366 } finally {
369367 instrumentationSpan .finish ();
370368 }
@@ -393,15 +391,12 @@ public void setApplicationName(AgentSpan span, Connection connection) {
393391
394392 connection .setClientInfo ("ApplicationName" , traceContext );
395393 } catch (Throwable e ) {
396- if (log .isDebugEnabled ()) {
397- log .debug (
398- "Failed to set extra DBM data in application_name for trace {}. "
399- + "To disable this behavior, set trace_prepared_statements to 'false'. "
400- + "See https://docs.datadoghq.com/database_monitoring/connect_dbm_and_apm/ for more info.{}" ,
401- span .getTraceId ().toHexString (),
402- e );
403- }
404394 DECORATE .onError (span , e );
395+ span .setErrorMessage (
396+ "Failed to set extra DBM data in application_name. "
397+ + "To disable this behavior, set trace_prepared_statements to 'false'. "
398+ + "See https://docs.datadoghq.com/database_monitoring/connect_dbm_and_apm/ for more info.\n "
399+ + e .getMessage ());
405400 } finally {
406401 span .setTag (DBM_TRACE_INJECTED , true );
407402 final long elapsed = System .currentTimeMillis () - startTime ;
0 commit comments