Skip to content

Commit 10858da

Browse files
committed
fix(agent): Update comments regarding DT vs w3c header behavior
1 parent 23a8a34 commit 10858da

File tree

1 file changed

+39
-12
lines changed

1 file changed

+39
-12
lines changed

agent/lib_php_amqplib.c

Lines changed: 39 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -196,9 +196,14 @@ static inline void nr_php_amqplib_get_host_and_port(
196196
}
197197

198198
/*
199-
* Purpose : Applies DT headers to an inbound AMQPMessage if
200-
* newrelic.distributed_tracing_exclude_newrelic_header INI setting is false and
201-
* if the headers don't already exist on the AMQPMessage.
199+
* Purpose : Applies DT headers to an inbound AMQPMessage.
200+
* Note:
201+
* The DT header 'newrelic' will only be added if both
202+
* newrelic.distributed_tracing_enabled is enabled and
203+
* newrelic.distributed_tracing_exclude_newrelic_header is set to false in the
204+
* INI settings. The W3C headers 'traceparent' and 'tracestate' will will only
205+
* be added if newrelic.distributed_tracing_enabled is enabled in the
206+
* newrelic.ini settings.
202207
*
203208
* Params : PhpAmqpLib\Message\AMQPMessage
204209
*
@@ -227,8 +232,13 @@ static inline void nr_php_amqplib_insert_dt_headers(zval* amqp_msg) {
227232
int retval = FAILURE;
228233

229234
/*
230-
* Note, this functionality can be disabled by toggling the
231-
* newrelic.distributed_tracing_exclude_newrelic_header INI setting.
235+
* Note:
236+
* The DT header 'newrelic' will only be added if both
237+
* newrelic.distributed_tracing_enabled is enabled and
238+
* newrelic.distributed_tracing_exclude_newrelic_header is set to false in the
239+
* INI settings. The W3C headers 'traceparent' and 'tracestate' will will only
240+
* be added if newrelic.distributed_tracing_enabled is enabled in the
241+
* newrelic.ini settings.
232242
*/
233243

234244
/*
@@ -253,8 +263,13 @@ static inline void nr_php_amqplib_insert_dt_headers(zval* amqp_msg) {
253263
}
254264

255265
/*
256-
* newrelic_get_request_metadata is an internal API that will only return DT
257-
* headers if newrelic.distributed_tracing_exclude_newrelic_header is false.
266+
* newrelic_get_request_metadata is an internal API that will only return the
267+
* DT header 'newrelic' will only be added if both
268+
* newrelic.distributed_tracing_enabled is enabled and
269+
* newrelic.distributed_tracing_exclude_newrelic_header is set to false in the
270+
* INI settings. The W3C headers 'traceparent' and 'tracestate' will will only
271+
* be returned if newrelic.distributed_tracing_enabled is enabled in the
272+
* newrelic.ini settings.
258273
*/
259274
dt_headers_zvf = nr_php_call(NULL, "newrelic_get_request_metadata");
260275
if (!nr_php_is_zval_valid_array(dt_headers_zvf)) {
@@ -490,9 +505,15 @@ static inline void nr_php_amqplib_retrieve_dt_headers(zval* amqp_msg) {
490505

491506
/*
492507
* Purpose : A wrapper to instrument the php-amqplib basic_publish. This
493-
* retrieves values to populate a message segment. If
494-
* newrelic.distributed_tracing_exclude_newrelic_header is false, it will also
495-
* insert the DT headers.
508+
* retrieves values to populate a message segment and insert the DT headers, if
509+
* applicable.
510+
*
511+
* Note: The DT header 'newrelic' will only be added if both
512+
* newrelic.distributed_tracing_enabled is enabled and
513+
* newrelic.distributed_tracing_exclude_newrelic_header is set to false in the
514+
* INI settings. The W3C headers 'traceparent' and 'tracestate' will will only
515+
* be added if newrelic.distributed_tracing_enabled is enabled in the
516+
* newrelic.ini settings.
496517
*
497518
* PhpAmqpLib\Channel\AMQPChannel::basic_publish
498519
* Publishes a message
@@ -610,8 +631,14 @@ NR_PHP_WRAPPER_END
610631

611632
/*
612633
* Purpose : A wrapper to instrument the php-amqplib basic_get. This
613-
* retrieves values to populate a message segment. If
614-
* newrelic.distributed_tracing_exclude_newrelic_header is false, it will also
634+
* retrieves values to populate a message segment.
635+
* Note:
636+
* The DT header 'newrelic' will only be considered if both
637+
* newrelic.distributed_tracing_enabled is enabled and
638+
* newrelic.distributed_tracing_exclude_newrelic_header is set to false in the
639+
* INI settings. The W3C headers 'traceparent' and 'tracestate' will will only
640+
* be considered if newrelic.distributed_tracing_enabled is enabled in the
641+
* newrelic.ini settings. If settings are correct, it will
615642
* retrieve the DT headers and, if applicable, apply to the txn.
616643
*
617644
* PhpAmqpLib\Channel\AMQPChannel::basic_get

0 commit comments

Comments
 (0)