Skip to content

Commit

Permalink
refactor(agent): improve guzzle detection (#714)
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
lavarou authored Aug 18, 2023
1 parent 2663462 commit 7fd56ae
Show file tree
Hide file tree
Showing 19 changed files with 2 additions and 24 deletions.
8 changes: 2 additions & 6 deletions agent/php_execute.c
Original file line number Diff line number Diff line change
Expand Up @@ -476,12 +476,8 @@ typedef struct _nr_library_table_t {
static nr_library_table_t libraries[] = {
{"Doctrine 2", "doctrine/orm/query.php", nr_doctrine2_enable},
{"Guzzle 3", "guzzle/http/client.php", nr_guzzle3_enable},
/*
* NOTE: This file ClientInterface.php also exists in Guzzle 3 and 6.
* This file also exists in Predis.
*/
{"Guzzle 4-5", "clientinterface.php", nr_guzzle4_enable},
{"Guzzle 6", "handlerstack.php", nr_guzzle6_enable},
{"Guzzle 4-5", "hasemitterinterface.php", nr_guzzle4_enable},
{"Guzzle 6", "guzzle/src/functions_include.php", nr_guzzle6_enable},

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

Expand Down
1 change: 0 additions & 1 deletion tests/integration/external/guzzle6/test_cat.php
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,6 @@
[{"name":"OtherTransaction/php__FILE__"}, [1, "??", "??", "??", "??", "??"]],
[{"name":"OtherTransactionTotalTime"}, [1, "??", "??", "??", "??", "??"]],
[{"name":"OtherTransactionTotalTime/php__FILE__"}, [1, "??", "??", "??", "??", "??"]],
[{"name":"Supportability/library/Guzzle 4-5/detected"}, [1, 0, 0, 0, 0, 0]],
[{"name":"Supportability/library/Guzzle 6/detected"}, [1, 0, 0, 0, 0, 0]],
[{"name":"Supportability/Unsupported/curl_setopt/CURLOPT_HEADERFUNCTION/closure"}, [3, 0, 0, 0, 0, 0]],
[{"name":"Supportability/Logging/Forwarding/PHP/enabled"}, [1, "??", "??", "??", "??", "??"]],
Expand Down
1 change: 0 additions & 1 deletion tests/integration/external/guzzle6/test_dt.php
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,6 @@
[{"name":"OtherTransaction/php__FILE__"}, [1, "??", "??", "??", "??", "??"]],
[{"name":"OtherTransactionTotalTime"}, [1, "??", "??", "??", "??", "??"]],
[{"name":"OtherTransactionTotalTime/php__FILE__"}, [1, "??", "??", "??", "??", "??"]],
[{"name":"Supportability/library/Guzzle 4-5/detected"}, [1, 0, 0, 0, 0, 0]],
[{"name":"Supportability/library/Guzzle 6/detected"}, [1, 0, 0, 0, 0, 0]],
[{"name":"Supportability/Unsupported/curl_setopt/CURLOPT_HEADERFUNCTION/closure"}, [3, 0, 0, 0, 0, 0]],
[{"name":"DurationByCaller/Unknown/Unknown/Unknown/Unknown/all"}, [1, "??", "??", "??", "??", "??"]],
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,6 @@
[{"name":"OtherTransaction/php__FILE__"}, [1, "??", "??", "??", "??", "??"]],
[{"name":"OtherTransactionTotalTime"}, [1, "??", "??", "??", "??", "??"]],
[{"name":"OtherTransactionTotalTime/php__FILE__"}, [1, "??", "??", "??", "??", "??"]],
[{"name":"Supportability/library/Guzzle 4-5/detected"}, [1, 0, 0, 0, 0, 0]],
[{"name":"Supportability/library/Guzzle 6/detected"}, [1, 0, 0, 0, 0, 0]],
[{"name":"Supportability/Unsupported/curl_setopt/CURLOPT_HEADERFUNCTION/closure"}, [3, 0, 0, 0, 0, 0]],
[{"name":"DurationByCaller/Unknown/Unknown/Unknown/Unknown/all"}, [1, "??", "??", "??", "??", "??"]],
Expand Down
1 change: 0 additions & 1 deletion tests/integration/external/guzzle6/test_dt_synthetics.php
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,6 @@
[{"name":"WebTransactionTotalTime"}, [1, "??", "??", "??", "??", "??"]],
[{"name":"WebTransactionTotalTime/Uri__FILE__"}, [1, "??", "??", "??", "??", "??"]],
[{"name":"HttpDispatcher"}, [1, "??", "??", "??", "??", "??"]],
[{"name":"Supportability/library/Guzzle 4-5/detected"}, [1, 0, 0, 0, 0, 0]],
[{"name":"Supportability/library/Guzzle 6/detected"}, [1, 0, 0, 0, 0, 0]],
[{"name":"Supportability/Unsupported/curl_setopt/CURLOPT_HEADERFUNCTION/closure"}, [3, 0, 0, 0, 0, 0]],
[{"name":"DurationByCaller/Unknown/Unknown/Unknown/Unknown/all"}, [1, "??", "??", "??", "??", "??"]],
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,6 @@
[{"name":"WebTransactionTotalTime"}, [1, "??", "??", "??", "??", "??"]],
[{"name":"WebTransactionTotalTime/Uri__FILE__"}, [1, "??", "??", "??", "??", "??"]],
[{"name":"HttpDispatcher"}, [1, "??", "??", "??", "??", "??"]],
[{"name":"Supportability/library/Guzzle 4-5/detected"}, [1, 0, 0, 0, 0, 0]],
[{"name":"Supportability/library/Guzzle 6/detected"}, [1, 0, 0, 0, 0, 0]],
[{"name":"Supportability/Unsupported/curl_setopt/CURLOPT_HEADERFUNCTION/closure"}, [3, 0, 0, 0, 0, 0]],
[{"name":"DurationByCaller/Unknown/Unknown/Unknown/Unknown/all"}, [1, "??", "??", "??", "??", "??"]],
Expand Down
1 change: 0 additions & 1 deletion tests/integration/external/guzzle6/test_no_cat_no_dt.php
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,6 @@
[{"name":"OtherTransaction/php__FILE__"}, [1, "??", "??", "??", "??", "??"]],
[{"name":"OtherTransactionTotalTime"}, [1, "??", "??", "??", "??", "??"]],
[{"name":"OtherTransactionTotalTime/php__FILE__"}, [1, "??", "??", "??", "??", "??"]],
[{"name":"Supportability/library/Guzzle 4-5/detected"}, [1, 0, 0, 0, 0, 0]],
[{"name":"Supportability/library/Guzzle 6/detected"}, [1, 0, 0, 0, 0, 0]],
[{"name":"Supportability/Logging/Forwarding/PHP/enabled"}, [1, "??", "??", "??", "??", "??"]],
[{"name":"Supportability/Logging/Metrics/PHP/enabled"}, [1, "??", "??", "??", "??", "??"]]
Expand Down
1 change: 0 additions & 1 deletion tests/integration/external/guzzle7/test_cat.php
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,6 @@
[{"name":"OtherTransaction/php__FILE__"}, [1, "??", "??", "??", "??", "??"]],
[{"name":"OtherTransactionTotalTime"}, [1, "??", "??", "??", "??", "??"]],
[{"name":"OtherTransactionTotalTime/php__FILE__"}, [1, "??", "??", "??", "??", "??"]],
[{"name":"Supportability/library/Guzzle 4-5/detected"}, [2, 0, 0, 0, 0, 0]],
[{"name":"Supportability/library/Guzzle 6/detected"}, [1, 0, 0, 0, 0, 0]],
[{"name":"Supportability/Unsupported/curl_setopt/CURLOPT_HEADERFUNCTION/closure"},
[3, 0, 0, 0, 0, 0]],
Expand Down
1 change: 0 additions & 1 deletion tests/integration/external/guzzle7/test_dt.php
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,6 @@
[{"name":"OtherTransaction/php__FILE__"}, [1, "??", "??", "??", "??", "??"]],
[{"name":"OtherTransactionTotalTime"}, [1, "??", "??", "??", "??", "??"]],
[{"name":"OtherTransactionTotalTime/php__FILE__"}, [1, "??", "??", "??", "??", "??"]],
[{"name":"Supportability/library/Guzzle 4-5/detected"}, [2, 0, 0, 0, 0, 0]],
[{"name":"Supportability/library/Guzzle 6/detected"}, [1, 0, 0, 0, 0, 0]],
[{"name":"Supportability/Unsupported/curl_setopt/CURLOPT_HEADERFUNCTION/closure"}, [3, 0, 0, 0, 0, 0]],
[{"name":"DurationByCaller/Unknown/Unknown/Unknown/Unknown/all"}, [1, "??", "??", "??", "??", "??"]],
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,6 @@
[{"name":"OtherTransaction/php__FILE__"}, [1, "??", "??", "??", "??", "??"]],
[{"name":"OtherTransactionTotalTime"}, [1, "??", "??", "??", "??", "??"]],
[{"name":"OtherTransactionTotalTime/php__FILE__"}, [1, "??", "??", "??", "??", "??"]],
[{"name":"Supportability/library/Guzzle 4-5/detected"}, [2, 0, 0, 0, 0, 0]],
[{"name":"Supportability/library/Guzzle 6/detected"}, [1, 0, 0, 0, 0, 0]],
[{"name":"Supportability/Unsupported/curl_setopt/CURLOPT_HEADERFUNCTION/closure"},
[3, 0, 0, 0, 0, 0]],
Expand Down
1 change: 0 additions & 1 deletion tests/integration/external/guzzle7/test_dt_synthetics.php
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,6 @@
[{"name":"WebTransactionTotalTime"}, [1, "??", "??", "??", "??", "??"]],
[{"name":"WebTransactionTotalTime/Uri__FILE__"}, [1, "??", "??", "??", "??", "??"]],
[{"name":"HttpDispatcher"}, [1, "??", "??", "??", "??", "??"]],
[{"name":"Supportability/library/Guzzle 4-5/detected"}, [2, 0, 0, 0, 0, 0]],
[{"name":"Supportability/library/Guzzle 6/detected"}, [1, 0, 0, 0, 0, 0]],
[{"name":"Supportability/Unsupported/curl_setopt/CURLOPT_HEADERFUNCTION/closure"},
[3, 0, 0, 0, 0, 0]],
Expand Down
1 change: 0 additions & 1 deletion tests/integration/external/guzzle7/test_no_cat_no_dt.php
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,6 @@
[{"name":"OtherTransaction/php__FILE__"}, [1, "??", "??", "??", "??", "??"]],
[{"name":"OtherTransactionTotalTime"}, [1, "??", "??", "??", "??", "??"]],
[{"name":"OtherTransactionTotalTime/php__FILE__"}, [1, "??", "??", "??", "??", "??"]],
[{"name":"Supportability/library/Guzzle 4-5/detected"}, [2, 0, 0, 0, 0, 0]],
[{"name":"Supportability/library/Guzzle 6/detected"}, [1, 0, 0, 0, 0, 0]],
[{"name":"Supportability/Logging/Forwarding/PHP/enabled"}, [1, "??", "??", "??", "??", "??"]],
[{"name":"Supportability/Logging/Metrics/PHP/enabled"}, [1, "??", "??", "??", "??", "??"]]
Expand Down
1 change: 0 additions & 1 deletion tests/integration/predis/test_basic.php
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,6 @@
[{"name":"OtherTransactionTotalTime"}, [1, "??", "??", "??", "??", "??"]],
[{"name":"OtherTransactionTotalTime/php__FILE__"}, [1, "??", "??", "??", "??", "??"]],
[{"name":"Supportability/library/Predis/detected"}, [1, "??", "??", "??", "??", "??"]],
[{"name":"Supportability/library/Guzzle 4-5/detected"}, [1, "??", "??", "??", "??", "??"]],
[{"name":"Supportability/Logging/Forwarding/PHP/enabled"}, [1, "??", "??", "??", "??", "??"]],
[{"name":"Supportability/Logging/Metrics/PHP/enabled"}, [1, "??", "??", "??", "??", "??"]]
]
Expand Down
1 change: 0 additions & 1 deletion tests/integration/predis/test_basic_logging_off.php
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,6 @@
[{"name":"OtherTransactionTotalTime"}, [1, "??", "??", "??", "??", "??"]],
[{"name":"OtherTransactionTotalTime/php__FILE__"}, [1, "??", "??", "??", "??", "??"]],
[{"name":"Supportability/library/Predis/detected"}, [1, "??", "??", "??", "??", "??"]],
[{"name":"Supportability/library/Guzzle 4-5/detected"}, [1, "??", "??", "??", "??", "??"]],
[{"name":"Supportability/Logging/Forwarding/PHP/disabled"}, [1, "??", "??", "??", "??", "??"]],
[{"name":"Supportability/Logging/Metrics/PHP/disabled"}, [1, "??", "??", "??", "??", "??"]]
]
Expand Down
1 change: 0 additions & 1 deletion tests/integration/predis/test_basic_reporting_disabled.php
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,6 @@
[{"name":"OtherTransactionTotalTime"}, [1, "??", "??", "??", "??", "??"]],
[{"name":"OtherTransactionTotalTime/php__FILE__"}, [1, "??", "??", "??", "??", "??"]],
[{"name":"Supportability/library/Predis/detected"}, [1, "??", "??", "??", "??", "??"]],
[{"name":"Supportability/library/Guzzle 4-5/detected"}, [1, "??", "??", "??", "??", "??"]],
[{"name":"Supportability/Logging/Forwarding/PHP/enabled"}, [1, "??", "??", "??", "??", "??"]],
[{"name":"Supportability/Logging/Metrics/PHP/enabled"}, [1, "??", "??", "??", "??", "??"]]
]
Expand Down
1 change: 0 additions & 1 deletion tests/integration/predis/test_pipeline.php
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,6 @@
[{"name":"OtherTransactionTotalTime"}, [1, "??", "??", "??", "??", "??"]],
[{"name":"OtherTransactionTotalTime/php__FILE__"}, [1, "??", "??", "??", "??", "??"]],
[{"name":"Supportability/library/Predis/detected"}, [1, "??", "??", "??", "??", "??"]],
[{"name":"Supportability/library/Guzzle 4-5/detected"}, [1, "??", "??", "??", "??", "??"]],
[{"name":"Supportability/Logging/Forwarding/PHP/enabled"}, [1, "??", "??", "??", "??", "??"]],
[{"name":"Supportability/Logging/Metrics/PHP/enabled"}, [1, "??", "??", "??", "??", "??"]]
]
Expand Down
1 change: 0 additions & 1 deletion tests/integration/predis/test_pipeline_atomic.php
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,6 @@
[{"name":"OtherTransactionTotalTime"}, [1, "??", "??", "??", "??", "??"]],
[{"name":"OtherTransactionTotalTime/php__FILE__"}, [1, "??", "??", "??", "??", "??"]],
[{"name":"Supportability/library/Predis/detected"}, [1, "??", "??", "??", "??", "??"]],
[{"name":"Supportability/library/Guzzle 4-5/detected"}, [1, "??", "??", "??", "??", "??"]],
[{"name":"Supportability/Logging/Forwarding/PHP/enabled"}, [1, "??", "??", "??", "??", "??"]],
[{"name":"Supportability/Logging/Metrics/PHP/enabled"}, [1, "??", "??", "??", "??", "??"]]
]
Expand Down
1 change: 0 additions & 1 deletion tests/integration/predis/test_pipeline_fire_and_forget.php
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,6 @@
[{"name":"OtherTransactionTotalTime"}, [1, "??", "??", "??", "??", "??"]],
[{"name":"OtherTransactionTotalTime/php__FILE__"}, [1, "??", "??", "??", "??", "??"]],
[{"name":"Supportability/library/Predis/detected"}, [1, "??", "??", "??", "??", "??"]],
[{"name":"Supportability/library/Guzzle 4-5/detected"}, [1, "??", "??", "??", "??", "??"]],
[{"name":"Supportability/Logging/Forwarding/PHP/enabled"}, [1, "??", "??", "??", "??", "??"]],
[{"name":"Supportability/Logging/Metrics/PHP/enabled"}, [1, "??", "??", "??", "??", "??"]]
]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,6 @@
[{"name":"OtherTransactionTotalTime"}, [1, "??", "??", "??", "??", "??"]],
[{"name":"OtherTransactionTotalTime/php__FILE__"}, [1, "??", "??", "??", "??", "??"]],
[{"name":"Supportability/library/Predis/detected"}, [1, "??", "??", "??", "??", "??"]],
[{"name":"Supportability/library/Guzzle 4-5/detected"}, [1, "??", "??", "??", "??", "??"]],
[{"name":"Supportability/Logging/Forwarding/PHP/disabled"}, [1, "??", "??", "??", "??", "??"]],
[{"name":"Supportability/Logging/Metrics/PHP/disabled"}, [1, "??", "??", "??", "??", "??"]]
]
Expand Down

0 comments on commit 7fd56ae

Please sign in to comment.