Skip to content

Commit 5b84fc8

Browse files
authored
refactor(agent): improve logging when adding named tracers (#1061)
Make log messages easier to understand when adding a named custom tracer by logging only a single message. Instead of logging one message when the wraprec is added, and two messages when wraprec is re-used, log a single message that indicates if the wraprec was added or re-used.
1 parent 1099f17 commit 5b84fc8

File tree

2 files changed

+4
-3
lines changed

2 files changed

+4
-3
lines changed

agent/php_user_instrument.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -570,13 +570,13 @@ nruserfn_t* nr_php_add_custom_tracer_named(const char* namestr,
570570
return p; /* return the wraprec we are duplicating */
571571
}
572572
}
573-
#else
574-
wraprec = nr_php_user_instrument_wraprec_hashmap_add(namestr, namestrlen);
575-
#endif
576573
nrl_verbosedebug(
577574
NRL_INSTRUMENT, "adding custom for '" NRP_FMT_UQ "%.5s" NRP_FMT_UQ "'",
578575
NRP_PHP(wraprec->classname),
579576
(0 == wraprec->classname) ? "" : "::", NRP_PHP(wraprec->funcname));
577+
#else
578+
wraprec = nr_php_user_instrument_wraprec_hashmap_add(namestr, namestrlen);
579+
#endif
580580

581581
nr_php_wrap_user_function_internal(wraprec TSRMLS_CC);
582582
nr_php_add_custom_tracer_common(wraprec);

agent/php_user_instrument_wraprec_hashmap.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -437,6 +437,7 @@ nruserfn_t* nr_php_user_instrument_wraprec_hashmap_add(const char* namestr, size
437437

438438
wraprec->supportability_metric = nr_txn_create_fn_supportability_metric(
439439
wraprec->funcname, wraprec->classname);
440+
nrl_verbosedebug(NRL_INSTRUMENT, "adding custom wrapper for '%s'", namestr);
440441
} else {
441442
nrl_verbosedebug(NRL_INSTRUMENT, "reusing custom wrapper for '%s'", namestr);
442443
}

0 commit comments

Comments
 (0)