Skip to content

Commit d566f43

Browse files
lavaroubduranleau-nr
authored andcommitted
refactor(agent): improve guzzle detection (#714)
Use files that more uniquely identify Guzzle 5, and Guzzle 6. Because the file used to identify Guzzle 5 is unique to Guzzle 5, Guzzle 4-5 supportability metrics are no longer generated when predis is detected. Guzzle 4-5 supportability metrics is also not generated when Guzzle 6 or Guzzle 7 are detected.
1 parent 79ffb94 commit d566f43

19 files changed

+2
-24
lines changed

agent/php_execute.c

+2-6
Original file line numberDiff line numberDiff line change
@@ -476,12 +476,8 @@ typedef struct _nr_library_table_t {
476476
static nr_library_table_t libraries[] = {
477477
{"Doctrine 2", "doctrine/orm/query.php", nr_doctrine2_enable},
478478
{"Guzzle 3", "guzzle/http/client.php", nr_guzzle3_enable},
479-
/*
480-
* NOTE: This file ClientInterface.php also exists in Guzzle 3 and 6.
481-
* This file also exists in Predis.
482-
*/
483-
{"Guzzle 4-5", "clientinterface.php", nr_guzzle4_enable},
484-
{"Guzzle 6", "handlerstack.php", nr_guzzle6_enable},
479+
{"Guzzle 4-5", "hasemitterinterface.php", nr_guzzle4_enable},
480+
{"Guzzle 6", "guzzle/src/functions_include.php", nr_guzzle6_enable},
485481

486482
{"MongoDB", "mongodb/src/client.php", nr_mongodb_enable},
487483

tests/integration/external/guzzle6/test_cat.php

-1
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,6 @@
5151
[{"name":"OtherTransaction/php__FILE__"}, [1, "??", "??", "??", "??", "??"]],
5252
[{"name":"OtherTransactionTotalTime"}, [1, "??", "??", "??", "??", "??"]],
5353
[{"name":"OtherTransactionTotalTime/php__FILE__"}, [1, "??", "??", "??", "??", "??"]],
54-
[{"name":"Supportability/library/Guzzle 4-5/detected"}, [1, 0, 0, 0, 0, 0]],
5554
[{"name":"Supportability/library/Guzzle 6/detected"}, [1, 0, 0, 0, 0, 0]],
5655
[{"name":"Supportability/Unsupported/curl_setopt/CURLOPT_HEADERFUNCTION/closure"}, [3, 0, 0, 0, 0, 0]],
5756
[{"name":"Supportability/Logging/Forwarding/PHP/enabled"}, [1, "??", "??", "??", "??", "??"]],

tests/integration/external/guzzle6/test_dt.php

-1
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,6 @@
4242
[{"name":"OtherTransaction/php__FILE__"}, [1, "??", "??", "??", "??", "??"]],
4343
[{"name":"OtherTransactionTotalTime"}, [1, "??", "??", "??", "??", "??"]],
4444
[{"name":"OtherTransactionTotalTime/php__FILE__"}, [1, "??", "??", "??", "??", "??"]],
45-
[{"name":"Supportability/library/Guzzle 4-5/detected"}, [1, 0, 0, 0, 0, 0]],
4645
[{"name":"Supportability/library/Guzzle 6/detected"}, [1, 0, 0, 0, 0, 0]],
4746
[{"name":"Supportability/Unsupported/curl_setopt/CURLOPT_HEADERFUNCTION/closure"}, [3, 0, 0, 0, 0, 0]],
4847
[{"name":"DurationByCaller/Unknown/Unknown/Unknown/Unknown/all"}, [1, "??", "??", "??", "??", "??"]],

tests/integration/external/guzzle6/test_dt_newrelic_header_disabled.php

-1
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,6 @@
4343
[{"name":"OtherTransaction/php__FILE__"}, [1, "??", "??", "??", "??", "??"]],
4444
[{"name":"OtherTransactionTotalTime"}, [1, "??", "??", "??", "??", "??"]],
4545
[{"name":"OtherTransactionTotalTime/php__FILE__"}, [1, "??", "??", "??", "??", "??"]],
46-
[{"name":"Supportability/library/Guzzle 4-5/detected"}, [1, 0, 0, 0, 0, 0]],
4746
[{"name":"Supportability/library/Guzzle 6/detected"}, [1, 0, 0, 0, 0, 0]],
4847
[{"name":"Supportability/Unsupported/curl_setopt/CURLOPT_HEADERFUNCTION/closure"}, [3, 0, 0, 0, 0, 0]],
4948
[{"name":"DurationByCaller/Unknown/Unknown/Unknown/Unknown/all"}, [1, "??", "??", "??", "??", "??"]],

tests/integration/external/guzzle6/test_dt_synthetics.php

-1
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,6 @@
6565
[{"name":"WebTransactionTotalTime"}, [1, "??", "??", "??", "??", "??"]],
6666
[{"name":"WebTransactionTotalTime/Uri__FILE__"}, [1, "??", "??", "??", "??", "??"]],
6767
[{"name":"HttpDispatcher"}, [1, "??", "??", "??", "??", "??"]],
68-
[{"name":"Supportability/library/Guzzle 4-5/detected"}, [1, 0, 0, 0, 0, 0]],
6968
[{"name":"Supportability/library/Guzzle 6/detected"}, [1, 0, 0, 0, 0, 0]],
7069
[{"name":"Supportability/Unsupported/curl_setopt/CURLOPT_HEADERFUNCTION/closure"}, [3, 0, 0, 0, 0, 0]],
7170
[{"name":"DurationByCaller/Unknown/Unknown/Unknown/Unknown/all"}, [1, "??", "??", "??", "??", "??"]],

tests/integration/external/guzzle6/test_dt_synthetics_logging_off.php

-1
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,6 @@
6868
[{"name":"WebTransactionTotalTime"}, [1, "??", "??", "??", "??", "??"]],
6969
[{"name":"WebTransactionTotalTime/Uri__FILE__"}, [1, "??", "??", "??", "??", "??"]],
7070
[{"name":"HttpDispatcher"}, [1, "??", "??", "??", "??", "??"]],
71-
[{"name":"Supportability/library/Guzzle 4-5/detected"}, [1, 0, 0, 0, 0, 0]],
7271
[{"name":"Supportability/library/Guzzle 6/detected"}, [1, 0, 0, 0, 0, 0]],
7372
[{"name":"Supportability/Unsupported/curl_setopt/CURLOPT_HEADERFUNCTION/closure"}, [3, 0, 0, 0, 0, 0]],
7473
[{"name":"DurationByCaller/Unknown/Unknown/Unknown/Unknown/all"}, [1, "??", "??", "??", "??", "??"]],

tests/integration/external/guzzle6/test_no_cat_no_dt.php

-1
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,6 @@
4242
[{"name":"OtherTransaction/php__FILE__"}, [1, "??", "??", "??", "??", "??"]],
4343
[{"name":"OtherTransactionTotalTime"}, [1, "??", "??", "??", "??", "??"]],
4444
[{"name":"OtherTransactionTotalTime/php__FILE__"}, [1, "??", "??", "??", "??", "??"]],
45-
[{"name":"Supportability/library/Guzzle 4-5/detected"}, [1, 0, 0, 0, 0, 0]],
4645
[{"name":"Supportability/library/Guzzle 6/detected"}, [1, 0, 0, 0, 0, 0]],
4746
[{"name":"Supportability/Logging/Forwarding/PHP/enabled"}, [1, "??", "??", "??", "??", "??"]],
4847
[{"name":"Supportability/Logging/Metrics/PHP/enabled"}, [1, "??", "??", "??", "??", "??"]]

tests/integration/external/guzzle7/test_cat.php

-1
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,6 @@
5353
[{"name":"OtherTransaction/php__FILE__"}, [1, "??", "??", "??", "??", "??"]],
5454
[{"name":"OtherTransactionTotalTime"}, [1, "??", "??", "??", "??", "??"]],
5555
[{"name":"OtherTransactionTotalTime/php__FILE__"}, [1, "??", "??", "??", "??", "??"]],
56-
[{"name":"Supportability/library/Guzzle 4-5/detected"}, [2, 0, 0, 0, 0, 0]],
5756
[{"name":"Supportability/library/Guzzle 6/detected"}, [1, 0, 0, 0, 0, 0]],
5857
[{"name":"Supportability/Unsupported/curl_setopt/CURLOPT_HEADERFUNCTION/closure"},
5958
[3, 0, 0, 0, 0, 0]],

tests/integration/external/guzzle7/test_dt.php

-1
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,6 @@
4242
[{"name":"OtherTransaction/php__FILE__"}, [1, "??", "??", "??", "??", "??"]],
4343
[{"name":"OtherTransactionTotalTime"}, [1, "??", "??", "??", "??", "??"]],
4444
[{"name":"OtherTransactionTotalTime/php__FILE__"}, [1, "??", "??", "??", "??", "??"]],
45-
[{"name":"Supportability/library/Guzzle 4-5/detected"}, [2, 0, 0, 0, 0, 0]],
4645
[{"name":"Supportability/library/Guzzle 6/detected"}, [1, 0, 0, 0, 0, 0]],
4746
[{"name":"Supportability/Unsupported/curl_setopt/CURLOPT_HEADERFUNCTION/closure"}, [3, 0, 0, 0, 0, 0]],
4847
[{"name":"DurationByCaller/Unknown/Unknown/Unknown/Unknown/all"}, [1, "??", "??", "??", "??", "??"]],

tests/integration/external/guzzle7/test_dt_newrelic_header_disabled.php

-1
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,6 @@
4343
[{"name":"OtherTransaction/php__FILE__"}, [1, "??", "??", "??", "??", "??"]],
4444
[{"name":"OtherTransactionTotalTime"}, [1, "??", "??", "??", "??", "??"]],
4545
[{"name":"OtherTransactionTotalTime/php__FILE__"}, [1, "??", "??", "??", "??", "??"]],
46-
[{"name":"Supportability/library/Guzzle 4-5/detected"}, [2, 0, 0, 0, 0, 0]],
4746
[{"name":"Supportability/library/Guzzle 6/detected"}, [1, 0, 0, 0, 0, 0]],
4847
[{"name":"Supportability/Unsupported/curl_setopt/CURLOPT_HEADERFUNCTION/closure"},
4948
[3, 0, 0, 0, 0, 0]],

tests/integration/external/guzzle7/test_dt_synthetics.php

-1
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,6 @@
6565
[{"name":"WebTransactionTotalTime"}, [1, "??", "??", "??", "??", "??"]],
6666
[{"name":"WebTransactionTotalTime/Uri__FILE__"}, [1, "??", "??", "??", "??", "??"]],
6767
[{"name":"HttpDispatcher"}, [1, "??", "??", "??", "??", "??"]],
68-
[{"name":"Supportability/library/Guzzle 4-5/detected"}, [2, 0, 0, 0, 0, 0]],
6968
[{"name":"Supportability/library/Guzzle 6/detected"}, [1, 0, 0, 0, 0, 0]],
7069
[{"name":"Supportability/Unsupported/curl_setopt/CURLOPT_HEADERFUNCTION/closure"},
7170
[3, 0, 0, 0, 0, 0]],

tests/integration/external/guzzle7/test_no_cat_no_dt.php

-1
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,6 @@
4242
[{"name":"OtherTransaction/php__FILE__"}, [1, "??", "??", "??", "??", "??"]],
4343
[{"name":"OtherTransactionTotalTime"}, [1, "??", "??", "??", "??", "??"]],
4444
[{"name":"OtherTransactionTotalTime/php__FILE__"}, [1, "??", "??", "??", "??", "??"]],
45-
[{"name":"Supportability/library/Guzzle 4-5/detected"}, [2, 0, 0, 0, 0, 0]],
4645
[{"name":"Supportability/library/Guzzle 6/detected"}, [1, 0, 0, 0, 0, 0]],
4746
[{"name":"Supportability/Logging/Forwarding/PHP/enabled"}, [1, "??", "??", "??", "??", "??"]],
4847
[{"name":"Supportability/Logging/Metrics/PHP/enabled"}, [1, "??", "??", "??", "??", "??"]]

tests/integration/predis/test_basic.php

-1
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,6 @@
5555
[{"name":"OtherTransactionTotalTime"}, [1, "??", "??", "??", "??", "??"]],
5656
[{"name":"OtherTransactionTotalTime/php__FILE__"}, [1, "??", "??", "??", "??", "??"]],
5757
[{"name":"Supportability/library/Predis/detected"}, [1, "??", "??", "??", "??", "??"]],
58-
[{"name":"Supportability/library/Guzzle 4-5/detected"}, [1, "??", "??", "??", "??", "??"]],
5958
[{"name":"Supportability/Logging/Forwarding/PHP/enabled"}, [1, "??", "??", "??", "??", "??"]],
6059
[{"name":"Supportability/Logging/Metrics/PHP/enabled"}, [1, "??", "??", "??", "??", "??"]]
6160
]

tests/integration/predis/test_basic_logging_off.php

-1
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,6 @@
5858
[{"name":"OtherTransactionTotalTime"}, [1, "??", "??", "??", "??", "??"]],
5959
[{"name":"OtherTransactionTotalTime/php__FILE__"}, [1, "??", "??", "??", "??", "??"]],
6060
[{"name":"Supportability/library/Predis/detected"}, [1, "??", "??", "??", "??", "??"]],
61-
[{"name":"Supportability/library/Guzzle 4-5/detected"}, [1, "??", "??", "??", "??", "??"]],
6261
[{"name":"Supportability/Logging/Forwarding/PHP/disabled"}, [1, "??", "??", "??", "??", "??"]],
6362
[{"name":"Supportability/Logging/Metrics/PHP/disabled"}, [1, "??", "??", "??", "??", "??"]]
6463
]

tests/integration/predis/test_basic_reporting_disabled.php

-1
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,6 @@
5555
[{"name":"OtherTransactionTotalTime"}, [1, "??", "??", "??", "??", "??"]],
5656
[{"name":"OtherTransactionTotalTime/php__FILE__"}, [1, "??", "??", "??", "??", "??"]],
5757
[{"name":"Supportability/library/Predis/detected"}, [1, "??", "??", "??", "??", "??"]],
58-
[{"name":"Supportability/library/Guzzle 4-5/detected"}, [1, "??", "??", "??", "??", "??"]],
5958
[{"name":"Supportability/Logging/Forwarding/PHP/enabled"}, [1, "??", "??", "??", "??", "??"]],
6059
[{"name":"Supportability/Logging/Metrics/PHP/enabled"}, [1, "??", "??", "??", "??", "??"]]
6160
]

tests/integration/predis/test_pipeline.php

-1
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,6 @@
4848
[{"name":"OtherTransactionTotalTime"}, [1, "??", "??", "??", "??", "??"]],
4949
[{"name":"OtherTransactionTotalTime/php__FILE__"}, [1, "??", "??", "??", "??", "??"]],
5050
[{"name":"Supportability/library/Predis/detected"}, [1, "??", "??", "??", "??", "??"]],
51-
[{"name":"Supportability/library/Guzzle 4-5/detected"}, [1, "??", "??", "??", "??", "??"]],
5251
[{"name":"Supportability/Logging/Forwarding/PHP/enabled"}, [1, "??", "??", "??", "??", "??"]],
5352
[{"name":"Supportability/Logging/Metrics/PHP/enabled"}, [1, "??", "??", "??", "??", "??"]]
5453
]

tests/integration/predis/test_pipeline_atomic.php

-1
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,6 @@
4848
[{"name":"OtherTransactionTotalTime"}, [1, "??", "??", "??", "??", "??"]],
4949
[{"name":"OtherTransactionTotalTime/php__FILE__"}, [1, "??", "??", "??", "??", "??"]],
5050
[{"name":"Supportability/library/Predis/detected"}, [1, "??", "??", "??", "??", "??"]],
51-
[{"name":"Supportability/library/Guzzle 4-5/detected"}, [1, "??", "??", "??", "??", "??"]],
5251
[{"name":"Supportability/Logging/Forwarding/PHP/enabled"}, [1, "??", "??", "??", "??", "??"]],
5352
[{"name":"Supportability/Logging/Metrics/PHP/enabled"}, [1, "??", "??", "??", "??", "??"]]
5453
]

tests/integration/predis/test_pipeline_fire_and_forget.php

-1
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,6 @@
4848
[{"name":"OtherTransactionTotalTime"}, [1, "??", "??", "??", "??", "??"]],
4949
[{"name":"OtherTransactionTotalTime/php__FILE__"}, [1, "??", "??", "??", "??", "??"]],
5050
[{"name":"Supportability/library/Predis/detected"}, [1, "??", "??", "??", "??", "??"]],
51-
[{"name":"Supportability/library/Guzzle 4-5/detected"}, [1, "??", "??", "??", "??", "??"]],
5251
[{"name":"Supportability/Logging/Forwarding/PHP/enabled"}, [1, "??", "??", "??", "??", "??"]],
5352
[{"name":"Supportability/Logging/Metrics/PHP/enabled"}, [1, "??", "??", "??", "??", "??"]]
5453
]

tests/integration/predis/test_pipeline_fire_and_forget_logging_off.php

-1
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,6 @@
5151
[{"name":"OtherTransactionTotalTime"}, [1, "??", "??", "??", "??", "??"]],
5252
[{"name":"OtherTransactionTotalTime/php__FILE__"}, [1, "??", "??", "??", "??", "??"]],
5353
[{"name":"Supportability/library/Predis/detected"}, [1, "??", "??", "??", "??", "??"]],
54-
[{"name":"Supportability/library/Guzzle 4-5/detected"}, [1, "??", "??", "??", "??", "??"]],
5554
[{"name":"Supportability/Logging/Forwarding/PHP/disabled"}, [1, "??", "??", "??", "??", "??"]],
5655
[{"name":"Supportability/Logging/Metrics/PHP/disabled"}, [1, "??", "??", "??", "??", "??"]]
5756
]

0 commit comments

Comments
 (0)