From 1fda499737a49b4ec8af1e0615b2954f0e1eed26 Mon Sep 17 00:00:00 2001 From: Michael Fulbright <89205663+mfulb@users.noreply.github.com> Date: Thu, 26 Sep 2024 15:24:24 -0400 Subject: [PATCH] feat(agent): improve package major version metric creation (#965) Change how the package major number metrics are created. This now occurs in R_SHUTDOWN. This allows the use of package versions from ALL sources including the Composer API. Whenever instrumentation for a package detects a package, it can create a package suggestion. Initially if a version is not known it is fine to use PHP_PACKAGE_VERSION_UNKNOWN. If later the instrumentation determines a version from a class constant, etc, then the suggestion can be updated with the version. At the end of the transaction the suggestions are iterated over and the actual package data (which could include Composer API data) is referenced and a major number supportability metric is created with the best version available. --------- Co-authored-by: Michal Nowacki --- agent/Makefile.frag | 1 + agent/fw_drupal.c | 7 +- agent/fw_drupal8.c | 8 +- agent/fw_laminas3.c | 7 +- agent/fw_laravel.c | 8 +- agent/fw_lumen.c | 6 +- agent/fw_slim.c | 7 +- agent/fw_symfony4.c | 6 +- agent/fw_wordpress.c | 11 +- agent/fw_yii.c | 8 +- agent/lib_aws_sdk_php.c | 9 +- agent/lib_doctrine2.c | 7 +- agent/lib_guzzle4.c | 6 +- agent/lib_guzzle6.c | 25 +- agent/lib_mongodb.c | 6 +- agent/lib_monolog.c | 9 +- agent/lib_phpunit.c | 7 +- agent/lib_predis.c | 9 +- agent/php_txn.c | 49 ++++ agent/php_txn_private.h | 21 ++ agent/tests/test_lib_aws_sdk_php.c | 107 +++---- agent/tests/test_php_txn.c | 268 ++++++++++++++++++ axiom/nr_php_packages.c | 19 +- axiom/nr_php_packages.h | 32 ++- axiom/nr_txn.c | 24 ++ axiom/nr_txn.h | 27 +- axiom/tests/.gitignore | 1 + axiom/tests/test_php_packages.c | 69 +++++ axiom/tests/test_txn.c | 119 ++++++++ .../logging/monolog2/test_monolog_basic.php | 4 +- .../logging/monolog2/test_monolog_cat.php | 4 +- .../monolog2/test_monolog_context_simple.php | 2 +- ...test_monolog_decoration_and_forwarding.php | 4 +- .../monolog2/test_monolog_disable_metrics.php | 4 +- .../monolog2/test_monolog_drop_empty.php | 4 +- .../test_monolog_large_message_limit.php | 4 +- ...test_monolog_large_message_limit_drops.php | 4 +- .../test_monolog_limit_log_events.php | 4 +- .../test_monolog_limit_zero_events.php | 4 +- ...log_events_max_samples_stored_invalid1.php | 4 +- ...log_events_max_samples_stored_invalid2.php | 4 +- ...log_events_max_samples_stored_invalid3.php | 4 +- ...log_events_max_samples_stored_invalid4.php | 4 +- .../test_monolog_log_level_filter.php | 4 +- .../test_monolog_log_level_filter_invalid.php | 4 +- .../logging/monolog3/test_monolog_basic.php | 4 +- .../logging/monolog3/test_monolog_cat.php | 4 +- .../monolog3/test_monolog_context_simple.php | 2 +- ...test_monolog_decoration_and_forwarding.php | 4 +- .../monolog3/test_monolog_disable_metrics.php | 4 +- .../monolog3/test_monolog_drop_empty.php | 4 +- .../test_monolog_large_message_limit.php | 4 +- ...test_monolog_large_message_limit_drops.php | 4 +- .../test_monolog_limit_log_events.php | 4 +- .../test_monolog_limit_zero_events.php | 4 +- ...log_events_max_samples_stored_invalid1.php | 4 +- ...log_events_max_samples_stored_invalid2.php | 4 +- ...log_events_max_samples_stored_invalid3.php | 4 +- ...log_events_max_samples_stored_invalid4.php | 4 +- .../test_monolog_log_level_filter.php | 4 +- .../test_monolog_log_level_filter_invalid.php | 4 +- 61 files changed, 800 insertions(+), 207 deletions(-) create mode 100644 agent/tests/test_php_txn.c diff --git a/agent/Makefile.frag b/agent/Makefile.frag index 1cfe1606c..648fc84b3 100644 --- a/agent/Makefile.frag +++ b/agent/Makefile.frag @@ -107,6 +107,7 @@ TEST_BINARIES = \ tests/test_php_minit \ tests/test_php_stack \ tests/test_php_stacked_segment \ + tests/test_php_txn \ tests/test_php_wrapper \ tests/test_predis \ tests/test_redis \ diff --git a/agent/fw_drupal.c b/agent/fw_drupal.c index 0957968e7..3537f8b42 100644 --- a/agent/fw_drupal.c +++ b/agent/fw_drupal.c @@ -886,10 +886,7 @@ void nr_drupal_enable(TSRMLS_D) { nr_txn_add_php_package(NRPRG(txn), PHP_PACKAGE_NAME, PHP_PACKAGE_VERSION_UNKNOWN); } - - nr_fw_support_add_package_supportability_metric( - NRPRG(txn), PHP_PACKAGE_NAME, NULL, - nr_php_packages_get_package(NRPRG(txn)->php_packages, - PHP_PACKAGE_NAME)); + nr_txn_suggest_package_supportability_metric(NRPRG(txn), PHP_PACKAGE_NAME, + PHP_PACKAGE_VERSION_UNKNOWN); } diff --git a/agent/fw_drupal8.c b/agent/fw_drupal8.c index 5244e545c..541cb8b87 100644 --- a/agent/fw_drupal8.c +++ b/agent/fw_drupal8.c @@ -669,7 +669,6 @@ NR_PHP_WRAPPER_END void nr_drupal_version() { zval* zval_version = NULL; zend_class_entry* class_entry = NULL; - nr_php_package_t* p = NULL; class_entry = nr_php_find_class("drupal"); if (NULL == class_entry) { @@ -688,10 +687,8 @@ void nr_drupal_version() { if (nr_php_is_zval_valid_string(zval_version)) { char* version = Z_STRVAL_P(zval_version); if (NRINI(vulnerability_management_package_detection_enabled)) { - p = nr_txn_add_php_package(NRPRG(txn), PHP_PACKAGE_NAME, version); + nr_txn_add_php_package(NRPRG(txn), PHP_PACKAGE_NAME, version); } - nr_fw_support_add_package_supportability_metric( - NRPRG(txn), PHP_PACKAGE_NAME, version, p); } nr_php_zval_free(&zval_version); @@ -763,4 +760,7 @@ void nr_drupal8_enable(TSRMLS_D) { nr_txn_add_php_package(NRPRG(txn), PHP_PACKAGE_NAME, PHP_PACKAGE_VERSION_UNKNOWN); } + + nr_txn_suggest_package_supportability_metric(NRPRG(txn), PHP_PACKAGE_NAME, + PHP_PACKAGE_VERSION_UNKNOWN); } diff --git a/agent/fw_laminas3.c b/agent/fw_laminas3.c index 734b0230e..a5d27de94 100644 --- a/agent/fw_laminas3.c +++ b/agent/fw_laminas3.c @@ -168,8 +168,7 @@ void nr_laminas3_enable(TSRMLS_D) { nr_txn_add_php_package(NRPRG(txn), PHP_PACKAGE_NAME, PHP_PACKAGE_VERSION_UNKNOWN); } - nr_fw_support_add_package_supportability_metric( - NRPRG(txn), PHP_PACKAGE_NAME, NULL, - nr_php_packages_get_package(NRPRG(txn)->php_packages, - PHP_PACKAGE_NAME)); + + nr_txn_suggest_package_supportability_metric(NRPRG(txn), PHP_PACKAGE_NAME, + PHP_PACKAGE_VERSION_UNKNOWN); } diff --git a/agent/fw_laravel.c b/agent/fw_laravel.c index 80f93b1cb..bbac65b20 100644 --- a/agent/fw_laravel.c +++ b/agent/fw_laravel.c @@ -949,7 +949,6 @@ NR_PHP_WRAPPER(nr_laravel_application_construct) { zval* this_var = nr_php_scope_get(NR_EXECUTE_ORIG_ARGS TSRMLS_CC); ; char* version = NULL; - nr_php_package_t* p = NULL; NR_UNUSED_SPECIALFN; (void)wraprec; @@ -962,10 +961,11 @@ NR_PHP_WRAPPER(nr_laravel_application_construct) { if (NRINI(vulnerability_management_package_detection_enabled)) { // Add php package to transaction - p = nr_txn_add_php_package(NRPRG(txn), PHP_PACKAGE_NAME, version); + nr_txn_add_php_package(NRPRG(txn), PHP_PACKAGE_NAME, version); } - nr_fw_support_add_package_supportability_metric(NRPRG(txn), PHP_PACKAGE_NAME, - version, p); + + nr_txn_suggest_package_supportability_metric(NRPRG(txn), PHP_PACKAGE_NAME, + version); if (version) { nrl_debug(NRL_FRAMEWORK, "Laravel version is " NRP_FMT, NRP_PHP(version)); diff --git a/agent/fw_lumen.c b/agent/fw_lumen.c index bdac89347..2d34551f0 100644 --- a/agent/fw_lumen.c +++ b/agent/fw_lumen.c @@ -239,8 +239,6 @@ void nr_lumen_enable(TSRMLS_D) { PHP_PACKAGE_VERSION_UNKNOWN); } - nr_fw_support_add_package_supportability_metric( - NRPRG(txn), PHP_PACKAGE_NAME, NULL, - nr_php_packages_get_package(NRPRG(txn)->php_packages, - PHP_PACKAGE_NAME)); + nr_txn_suggest_package_supportability_metric(NRPRG(txn), PHP_PACKAGE_NAME, + PHP_PACKAGE_VERSION_UNKNOWN); } diff --git a/agent/fw_slim.c b/agent/fw_slim.c index 8a3166817..facaeecc1 100644 --- a/agent/fw_slim.c +++ b/agent/fw_slim.c @@ -152,7 +152,6 @@ NR_PHP_WRAPPER_END NR_PHP_WRAPPER(nr_slim_application_construct) { zval* this_var = nr_php_scope_get(NR_EXECUTE_ORIG_ARGS); char* version = NULL; - nr_php_package_t* p = NULL; NR_UNUSED_SPECIALFN; (void)wraprec; @@ -161,11 +160,11 @@ NR_PHP_WRAPPER(nr_slim_application_construct) { if (NRINI(vulnerability_management_package_detection_enabled)) { // Add php package to transaction - p = nr_txn_add_php_package(NRPRG(txn), PHP_PACKAGE_NAME, version); + nr_txn_add_php_package(NRPRG(txn), PHP_PACKAGE_NAME, version); } - nr_fw_support_add_package_supportability_metric(NRPRG(txn), PHP_PACKAGE_NAME, - version, p); + nr_txn_suggest_package_supportability_metric(NRPRG(txn), PHP_PACKAGE_NAME, + version); nr_free(version); nr_php_scope_release(&this_var); diff --git a/agent/fw_symfony4.c b/agent/fw_symfony4.c index 44c872134..8592186ac 100644 --- a/agent/fw_symfony4.c +++ b/agent/fw_symfony4.c @@ -283,8 +283,6 @@ void nr_symfony4_enable(TSRMLS_D) { PHP_PACKAGE_VERSION_UNKNOWN); } - nr_fw_support_add_package_supportability_metric( - NRPRG(txn), PHP_PACKAGE_NAME, NULL, - nr_php_packages_get_package(NRPRG(txn)->php_packages, - PHP_PACKAGE_NAME)); + nr_txn_suggest_package_supportability_metric(NRPRG(txn), PHP_PACKAGE_NAME, + PHP_PACKAGE_VERSION_UNKNOWN); } diff --git a/agent/fw_wordpress.c b/agent/fw_wordpress.c index 794a547d1..050750f6a 100644 --- a/agent/fw_wordpress.c +++ b/agent/fw_wordpress.c @@ -804,18 +804,17 @@ void nr_wordpress_version() { "})();"; zval retval; - int result - = zend_eval_string(func_string, &retval, "Get Wordpress Version"); - nr_php_package_t* p = NULL; + int result = zend_eval_string(func_string, &retval, "Get Wordpress Version"); // Add php package to transaction if (SUCCESS == result) { if (nr_php_is_zval_valid_string(&retval)) { char* version = Z_STRVAL(retval); if (NRINI(vulnerability_management_package_detection_enabled)) { - p = nr_txn_add_php_package(NRPRG(txn), PHP_PACKAGE_NAME, version); + nr_txn_add_php_package(NRPRG(txn), PHP_PACKAGE_NAME, version); } - nr_fw_support_add_package_supportability_metric( - NRPRG(txn), PHP_PACKAGE_NAME, version, p); + + nr_txn_suggest_package_supportability_metric(NRPRG(txn), PHP_PACKAGE_NAME, + version); } zval_dtor(&retval); } diff --git a/agent/fw_yii.c b/agent/fw_yii.c index bd9d628c5..0b1af7c96 100644 --- a/agent/fw_yii.c +++ b/agent/fw_yii.c @@ -227,9 +227,7 @@ void nr_yii2_enable(TSRMLS_D) { nr_txn_add_php_package(NRPRG(txn), PHP_PACKAGE_NAME, PHP_PACKAGE_VERSION_UNKNOWN); } - - nr_fw_support_add_package_supportability_metric( - NRPRG(txn), PHP_PACKAGE_NAME, NULL, - nr_php_packages_get_package(NRPRG(txn)->php_packages, - PHP_PACKAGE_NAME)); + + nr_txn_suggest_package_supportability_metric(NRPRG(txn), PHP_PACKAGE_NAME, + PHP_PACKAGE_VERSION_UNKNOWN); } diff --git a/agent/lib_aws_sdk_php.c b/agent/lib_aws_sdk_php.c index c4d031a30..ad956ac1e 100644 --- a/agent/lib_aws_sdk_php.c +++ b/agent/lib_aws_sdk_php.c @@ -56,7 +56,6 @@ void nr_lib_aws_sdk_php_handle_version() { zval* zval_version = NULL; zend_class_entry* class_entry = NULL; char* version = NULL; - nr_php_package_t* p = NULL; class_entry = nr_php_find_class("aws\\sdk"); if (NULL != class_entry) { @@ -68,10 +67,12 @@ void nr_lib_aws_sdk_php_handle_version() { } if (NRINI(vulnerability_management_package_detection_enabled)) { /* Add php package to transaction */ - p = nr_txn_add_php_package(NRPRG(txn), PHP_PACKAGE_NAME, version); + nr_txn_add_php_package(NRPRG(txn), PHP_PACKAGE_NAME, version); } - nr_fw_support_add_package_supportability_metric(NRPRG(txn), PHP_PACKAGE_NAME, - version, p); + + nr_txn_suggest_package_supportability_metric(NRPRG(txn), PHP_PACKAGE_NAME, + version); + nr_php_zval_free(&zval_version); } diff --git a/agent/lib_doctrine2.c b/agent/lib_doctrine2.c index 8d8ee5c17..8f8b8dfe3 100644 --- a/agent/lib_doctrine2.c +++ b/agent/lib_doctrine2.c @@ -111,8 +111,7 @@ void nr_doctrine2_enable(TSRMLS_D) { nr_txn_add_php_package(NRPRG(txn), PHP_PACKAGE_NAME, PHP_PACKAGE_VERSION_UNKNOWN); } - nr_fw_support_add_package_supportability_metric( - NRPRG(txn), PHP_PACKAGE_NAME, NULL, - nr_php_packages_get_package(NRPRG(txn)->php_packages, - PHP_PACKAGE_NAME)); + + nr_txn_suggest_package_supportability_metric(NRPRG(txn), PHP_PACKAGE_NAME, + PHP_PACKAGE_VERSION_UNKNOWN); } diff --git a/agent/lib_guzzle4.c b/agent/lib_guzzle4.c index 90a041e1a..c52ddffff 100644 --- a/agent/lib_guzzle4.c +++ b/agent/lib_guzzle4.c @@ -526,10 +526,8 @@ void nr_guzzle4_enable(TSRMLS_D) { PHP_PACKAGE_VERSION_UNKNOWN); } - nr_fw_support_add_package_supportability_metric( - NRPRG(txn), PHP_PACKAGE_NAME, NULL, - nr_php_packages_get_package(NRPRG(txn)->php_packages, - PHP_PACKAGE_NAME)); + nr_txn_suggest_package_supportability_metric(NRPRG(txn), PHP_PACKAGE_NAME, + PHP_PACKAGE_VERSION_UNKNOWN); } void nr_guzzle4_minit(TSRMLS_D) { diff --git a/agent/lib_guzzle6.c b/agent/lib_guzzle6.c index 87f27171d..e65a684b7 100644 --- a/agent/lib_guzzle6.c +++ b/agent/lib_guzzle6.c @@ -352,23 +352,32 @@ NR_PHP_WRAPPER_START(nr_guzzle6_client_construct) { zval* this_var = nr_php_scope_get(NR_EXECUTE_ORIG_ARGS); char* version = nr_php_get_object_constant(this_var, "VERSION"); - nr_php_package_t* p = NULL; if (NRINI(vulnerability_management_package_detection_enabled)) { // Add php package to transaction - p = nr_txn_add_php_package(NRPRG(txn), PHP_PACKAGE_NAME, version); + nr_txn_add_php_package(NRPRG(txn), PHP_PACKAGE_NAME, version); } /* - * If we were unable to get the full version before, at least we can extract - * the major version to send to the supportability metric. - * This is relevant to guzzle7+ which no longer supplies full version. - */ + * If we were unable to get the full version before, at least we can extract + * the major version to send to the supportability metric now, as + * this incomplete version will not be stored in a php package record + * and so the supportability metric cannot be created later like for + * most packages. + * + * This is relevant to guzzle7+ which no longer supplies full version. + */ if (NULL == version) { version = nr_php_get_object_constant(this_var, "MAJOR_VERSION"); } - nr_fw_support_add_package_supportability_metric(NRPRG(txn), PHP_PACKAGE_NAME, - version, p); + + /* if version is still NULL that is OK this next call will accept + * that value and when supportability metrics are made for + * packages if another method has determined the package version + * (composer api for example) then it will be filled in at that time + */ + nr_txn_suggest_package_supportability_metric(NRPRG(txn), PHP_PACKAGE_NAME, + version); nr_free(version); (void)wraprec; diff --git a/agent/lib_mongodb.c b/agent/lib_mongodb.c index 2fe43539f..8d129ae9d 100644 --- a/agent/lib_mongodb.c +++ b/agent/lib_mongodb.c @@ -451,8 +451,6 @@ void nr_mongodb_enable() { PHP_PACKAGE_VERSION_UNKNOWN); } - nr_fw_support_add_package_supportability_metric( - NRPRG(txn), PHP_PACKAGE_NAME, NULL, - nr_php_packages_get_package(NRPRG(txn)->php_packages, - PHP_PACKAGE_NAME)); + nr_txn_suggest_package_supportability_metric(NRPRG(txn), PHP_PACKAGE_NAME, + PHP_PACKAGE_VERSION_UNKNOWN); } diff --git a/agent/lib_monolog.c b/agent/lib_monolog.c index 7fd061daf..fcdb1ac06 100644 --- a/agent/lib_monolog.c +++ b/agent/lib_monolog.c @@ -378,10 +378,8 @@ NR_PHP_WRAPPER(nr_monolog_logger_addrecord) { = nr_monolog_get_timestamp(api, argc, NR_EXECUTE_ORIG_ARGS TSRMLS_CC); char version[MAJOR_VERSION_LENGTH]; snprintf(version, sizeof(version), "%d", api); - nr_fw_support_add_package_supportability_metric( - NRPRG(txn), PHP_PACKAGE_NAME, version, - nr_php_packages_get_package(NRPRG(txn)->php_packages, - PHP_PACKAGE_NAME)); + nr_txn_suggest_package_supportability_metric(NRPRG(txn), PHP_PACKAGE_NAME, + version); } /* Record the log event */ @@ -525,4 +523,7 @@ void nr_monolog_enable(TSRMLS_D) { nr_txn_add_php_package(NRPRG(txn), PHP_PACKAGE_NAME, PHP_PACKAGE_VERSION_UNKNOWN); } + + nr_txn_suggest_package_supportability_metric(NRPRG(txn), PHP_PACKAGE_NAME, + PHP_PACKAGE_VERSION_UNKNOWN); } diff --git a/agent/lib_phpunit.c b/agent/lib_phpunit.c index e41c55b29..4050bf969 100644 --- a/agent/lib_phpunit.c +++ b/agent/lib_phpunit.c @@ -14,6 +14,8 @@ #include "util_logging.h" #include "util_strings.h" +#define PHP_PACKAGE_NAME "phpunit/phpunit" + /* * PHPUnit instrumentation * ======================= @@ -697,7 +699,10 @@ void nr_phpunit_enable(TSRMLS_D) { nr_phpunit_instrument_testresult_adderror TSRMLS_CC); if (NRINI(vulnerability_management_package_detection_enabled)) { - nr_txn_add_php_package(NRPRG(txn), "phpunit/phpunit", + nr_txn_add_php_package(NRPRG(txn), PHP_PACKAGE_NAME, PHP_PACKAGE_VERSION_UNKNOWN); } + + nr_txn_suggest_package_supportability_metric(NRPRG(txn), PHP_PACKAGE_NAME, + PHP_PACKAGE_VERSION_UNKNOWN); } diff --git a/agent/lib_predis.c b/agent/lib_predis.c index c1af1822d..607e11ed2 100644 --- a/agent/lib_predis.c +++ b/agent/lib_predis.c @@ -644,7 +644,6 @@ NR_PHP_WRAPPER(nr_predis_client_construct) { zval* conn = NULL; zval* params = nr_php_arg_get(1, NR_EXECUTE_ORIG_ARGS TSRMLS_CC); zval* scope = nr_php_scope_get(NR_EXECUTE_ORIG_ARGS TSRMLS_CC); - nr_php_package_t* p = NULL; (void)wraprec; @@ -653,10 +652,12 @@ NR_PHP_WRAPPER(nr_predis_client_construct) { char* version = nr_php_get_object_constant(scope, "VERSION"); if (NRINI(vulnerability_management_package_detection_enabled)) { // Add php package to transaction - p = nr_txn_add_php_package(NRPRG(txn), PHP_PACKAGE_NAME, version); + nr_txn_add_php_package(NRPRG(txn), PHP_PACKAGE_NAME, version); } - nr_fw_support_add_package_supportability_metric(NRPRG(txn), PHP_PACKAGE_NAME, - version, p); + + nr_txn_suggest_package_supportability_metric(NRPRG(txn), PHP_PACKAGE_NAME, + version); + nr_free(version); /* diff --git a/agent/php_txn.c b/agent/php_txn.c index 785007b41..b5b57975c 100644 --- a/agent/php_txn.c +++ b/agent/php_txn.c @@ -19,10 +19,12 @@ #include "nr_agent.h" #include "nr_commands.h" #include "nr_header.h" +#include "nr_php_packages.h" #include "nr_rum.h" #include "nr_segment_children.h" #include "nr_txn.h" #include "nr_version.h" +#include "fw_support.h" #include "util_labels.h" #include "util_logging.h" #include "util_memory.h" @@ -711,6 +713,50 @@ void nr_php_txn_create_agent_php_version_metrics(nrtxn_t* txn) { nr_php_txn_create_php_version_metric(txn, version); } +void nr_php_txn_php_package_create_major_metric(void* value, + const char* key, + size_t key_len, + void* user_data) { + nrtxn_t* txn = (nrtxn_t*)user_data; + nr_php_package_t* suggested = value; + nr_php_package_t* actual = NULL; + + (void)key; + (void)key_len; + + if (NULL == txn) { + return; + } + + if (NULL == suggested) { + return; + } + + /* see if the actual packages has a version we can use over the + * one provided with the suggested package + */ + actual + = nr_php_packages_get_package(txn->php_packages, suggested->package_name); + + nrl_verbosedebug( + NRL_INSTRUMENT, + "Creating PHP Package Supportability Metric for package " + "'%s', suggested version '%s', actual version '%s'", + NRSAFESTR(suggested->package_name), NRSAFESTR(suggested->package_version), + NRSAFESTR(NULL != actual ? actual->package_version : "NULL")); + nr_fw_support_add_package_supportability_metric( + txn, suggested->package_name, suggested->package_version, actual); +} + +void nr_php_txn_create_packages_major_metrics(nrtxn_t* txn) { + if (NULL == txn) { + return; + } + + nr_php_packages_iterate(txn->php_package_major_version_metrics_suggestions, + nr_php_txn_php_package_create_major_metric, txn); +} + nr_status_t nr_php_txn_begin(const char* appnames, const char* license TSRMLS_DC) { nrtxnopt_t opts; @@ -1165,6 +1211,9 @@ nr_status_t nr_php_txn_end(int ignoretxn, int in_post_deactivate TSRMLS_DC) { /* Agent and PHP version metrics*/ nr_php_txn_create_agent_php_version_metrics(txn); + /* PHP packages major version metrics */ + nr_php_txn_create_packages_major_metrics(txn); + /* Add CPU and memory metrics */ nr_php_resource_usage_sampler_end(TSRMLS_C); diff --git a/agent/php_txn_private.h b/agent/php_txn_private.h index bf49eb107..6788877ad 100644 --- a/agent/php_txn_private.h +++ b/agent/php_txn_private.h @@ -65,3 +65,24 @@ extern void nr_php_txn_create_agent_version_metric(nrtxn_t* txn); */ extern void nr_php_txn_create_php_version_metric(nrtxn_t* txn, const char* version); + +/* + * Purpose : Callback for nr_php_packages_iterate to create major + * version metrics. + * + * Params : 1. PHP suggestion package version + * 2. PHP suggestion package name + * 3. PHP suggestion package name length + * 4. The current transaction (via userdata) + */ +extern void nr_php_txn_php_package_create_major_metric(void* value, + const char* key, + size_t key_len, + void* user_data); + +/* + * Purpose : Create and record metric for a package major versions. + * + * Params : 1. The current transaction. + */ +extern void nr_php_txn_create_packages_major_metrics(nrtxn_t* txn); diff --git a/agent/tests/test_lib_aws_sdk_php.c b/agent/tests/test_lib_aws_sdk_php.c index 8ddffce9d..91fa88b26 100644 --- a/agent/tests/test_lib_aws_sdk_php.c +++ b/agent/tests/test_lib_aws_sdk_php.c @@ -80,14 +80,14 @@ static void test_nr_lib_aws_sdk_php_add_supportability_service_metric(void) { static void test_nr_lib_aws_sdk_php_handle_version(void) { #define LIBRARY_NAME "aws/aws-sdk-php" -#define LIBRARY_MAJOR_VERSION "7" -#define LIBRARY_MAJOR_VERSION_2 "10" -#define LIBRARY_MAJOR_VERSION_3 "100" -#define LIBRARY_MAJOR_VERSION_4 "4.23" -#define LIBRARY_MAJOR_VERSION_55 "55.34" -#define LIBRARY_MAJOR_VERSION_6123 "6123.45" -#define LIBRARY_MAJOR_VERSION_0 "0.4.5" -#define PACKAGE_METRIC "Supportability/PHP/package/" LIBRARY_NAME + const char* library_versions[] + = {"7", "10", "100", "4.23", "55.34", "6123.45", "0.4.5"}; + nr_php_package_t* p = NULL; +#define TEST_DESCRIPTION_FMT \ + "nr_lib_aws_sdk_php_handle_version with library_versions[%ld]=%s: package " \ + "major version metric - %s" + char* test_description = NULL; + size_t i = 0; /* * If lib_aws_sdk_php_handle_version function is ever called, we have already @@ -95,73 +95,54 @@ static void test_nr_lib_aws_sdk_php_handle_version(void) { */ /* - * Aws/Sdk exists. Should return aws package metric with + * Aws/Sdk class exists. Should create aws package metric suggestion with * version */ - tlib_php_request_start(); - declare_aws_sdk_class("Aws", "Sdk", LIBRARY_MAJOR_VERSION); - nr_lib_aws_sdk_php_handle_version(); - tlib_pass_if_not_null("version test 1: package metric created", - nrm_find(NRPRG(txn)->unscoped_metrics, PACKAGE_METRIC - "/" LIBRARY_MAJOR_VERSION "/detected")); - tlib_php_request_end(); + for (i = 0; i < sizeof(library_versions) / sizeof(library_versions[0]); i++) { + tlib_php_request_start(); - tlib_php_request_start(); - declare_aws_sdk_class("Aws", "Sdk", LIBRARY_MAJOR_VERSION_2); - nr_lib_aws_sdk_php_handle_version(); - tlib_pass_if_not_null("version test 2: package metric created", - nrm_find(NRPRG(txn)->unscoped_metrics, PACKAGE_METRIC - "/" LIBRARY_MAJOR_VERSION_2 "/detected")); - tlib_php_request_end(); + declare_aws_sdk_class("Aws", "Sdk", library_versions[i]); + nr_lib_aws_sdk_php_handle_version(); - tlib_php_request_start(); - declare_aws_sdk_class("Aws", "Sdk", LIBRARY_MAJOR_VERSION_3); - nr_lib_aws_sdk_php_handle_version(); - tlib_pass_if_not_null("version test 3: package metric created", - nrm_find(NRPRG(txn)->unscoped_metrics, PACKAGE_METRIC - "/" LIBRARY_MAJOR_VERSION_3 "/detected")); - tlib_php_request_end(); + p = nr_php_packages_get_package( + NRPRG(txn)->php_package_major_version_metrics_suggestions, + LIBRARY_NAME); - tlib_php_request_start(); - declare_aws_sdk_class("Aws", "Sdk", LIBRARY_MAJOR_VERSION_4); - nr_lib_aws_sdk_php_handle_version(); - tlib_pass_if_not_null( - "version test 4: package metric created", - nrm_find(NRPRG(txn)->unscoped_metrics, PACKAGE_METRIC "/4/detected")); - tlib_php_request_end(); + test_description = nr_formatf(TEST_DESCRIPTION_FMT, i, library_versions[i], + "suggestion created"); + tlib_pass_if_not_null(test_description, p); + nr_free(test_description); - tlib_php_request_start(); - declare_aws_sdk_class("Aws", "Sdk", LIBRARY_MAJOR_VERSION_55); - nr_lib_aws_sdk_php_handle_version(); - tlib_pass_if_not_null( - "version test 5: package metric created", - nrm_find(NRPRG(txn)->unscoped_metrics, PACKAGE_METRIC "/55/detected")); - tlib_php_request_end(); + test_description = nr_formatf(TEST_DESCRIPTION_FMT, i, library_versions[i], + "suggested version set"); + tlib_pass_if_str_equal(test_description, library_versions[i], + p->package_version); + nr_free(test_description); - tlib_php_request_start(); - declare_aws_sdk_class("Aws", "Sdk", LIBRARY_MAJOR_VERSION_6123); - nr_lib_aws_sdk_php_handle_version(); - tlib_pass_if_not_null( - "version test 6: package metric created", - nrm_find(NRPRG(txn)->unscoped_metrics, PACKAGE_METRIC "/6123/detected")); - tlib_php_request_end(); - - tlib_php_request_start(); - declare_aws_sdk_class("Aws", "Sdk", LIBRARY_MAJOR_VERSION_0); - nr_lib_aws_sdk_php_handle_version(); - tlib_pass_if_not_null( - "version test 7: package metric created", - nrm_find(NRPRG(txn)->unscoped_metrics, PACKAGE_METRIC "/0/detected")); - tlib_php_request_end(); + tlib_php_request_end(); + } /* - * Aws/Sdk does not exist, should not return package metric if no version - * This case should never happen in real situations. + * Aws/Sdk class does not exist, should create package metric suggestion + * with PHP_PACKAGE_VERSION_UNKNOWN version. This case should never happen + * in real situations. */ tlib_php_request_start(); + nr_lib_aws_sdk_php_handle_version(); - tlib_pass_if_null("aws library metric created", - nrm_find(NRPRG(txn)->unscoped_metrics, PACKAGE_METRIC)); + + p = nr_php_packages_get_package( + NRPRG(txn)->php_package_major_version_metrics_suggestions, LIBRARY_NAME); + + tlib_pass_if_not_null( + "nr_lib_aws_sdk_php_handle_version when Aws\\Sdk class is not defined - " + "suggestion created", + p); + tlib_pass_if_str_equal( + "nr_lib_aws_sdk_php_handle_version when Aws\\Sdk class is not defined - " + "suggested version set to PHP_PACKAGE_VERSION_UNKNOWN", + PHP_PACKAGE_VERSION_UNKNOWN, p->package_version); + tlib_php_request_end(); } diff --git a/agent/tests/test_php_txn.c b/agent/tests/test_php_txn.c new file mode 100644 index 000000000..d0665bb26 --- /dev/null +++ b/agent/tests/test_php_txn.c @@ -0,0 +1,268 @@ +/* + * Copyright 2020 New Relic Corporation. All rights reserved. + * SPDX-License-Identifier: Apache-2.0 + */ + +#include "tlib_php.h" + +#include "php_agent.h" +#include "php_txn_private.h" + +#define LIBRARY_NAME "vendor_name/package_name" +#define LIBRARY_VERSION "1.2.3" +#define DEVEL_LIBRARY_VERSION "1.2.x-dev" +#define LIBRARY_MAJOR_VERSION "1" +#define COMPOSER_PACKAGE_VERSION "2.1.3" +#define COMPOSER_MAJOR_VERSION "2" +#define PACKAGE_METRIC_PREFIX "Supportability/PHP/package/" +#define PACKAGE_METRIC PACKAGE_METRIC_PREFIX LIBRARY_NAME + +tlib_parallel_info_t parallel_info = {.suggested_nthreads = 1, .state_size = 0}; + +nr_php_package_t php_package + = {.package_name = LIBRARY_NAME, + .package_version = LIBRARY_VERSION, + .source_priority = NR_PHP_PACKAGE_SOURCE_COMPOSER}; + +static void test_nr_php_txn_php_package_create_major_metric() { + nrtxn_t t; + nrtxn_t* txn = &t; + + txn->unscoped_metrics = nrm_table_create(10); + txn->php_packages = nr_php_packages_create(); + txn->php_package_major_version_metrics_suggestions = nr_php_packages_create(); + + tlib_php_request_start(); + + /* need to call callback with invalid values to make sure it doesnt crash + * code depends on txn and txn->php_packages existing so these are created + * above with the package suggestions data structure included for good measure + */ + + /* this tests these params in callback: + * suggested = NULL + * actual = NULL + * key = NULL + * txn = NULL + */ + nr_php_txn_php_package_create_major_metric(NULL, NULL, 0, NULL); + tlib_pass_if_int_equal("NULL txn, metric not created", 0, + nrm_table_size(txn->unscoped_metrics)); + + /* this tests these params in callback: + * suggested = NULL + * actual = NULL + * key != NULL + * txn != NULL + */ + nr_php_txn_php_package_create_major_metric(NULL, LIBRARY_NAME, + strlen(LIBRARY_NAME), (void*)txn); + tlib_pass_if_int_equal("NULL value, metric not created", 0, + nrm_table_size(txn->unscoped_metrics)); + + /* the key is not actually used by the callback - just the package name + * in the suggested package so this casee will still create a metric + */ + /* this tests these params in callback: + * suggested != NULL + * actual = NULL + * key = NULL + * txn = != NULL + */ + nr_php_txn_php_package_create_major_metric(&php_package, NULL, 0, (void*)txn); + tlib_pass_if_int_equal("NULL key, metric created", 1, + nrm_table_size(txn->unscoped_metrics)); + + /* cleanup */ + nr_php_packages_destroy(&txn->php_packages); + nr_php_packages_destroy(&txn->php_package_major_version_metrics_suggestions); + nrm_table_destroy(&txn->unscoped_metrics); + + tlib_php_request_end(); +} + +static void test_nr_php_txn_create_packages_major_metrics() { + nrtxn_t t; + nrtxn_t* txn = &t; + + txn->unscoped_metrics = nrm_table_create(10); + txn->php_packages = nr_php_packages_create(); + txn->php_package_major_version_metrics_suggestions = nr_php_packages_create(); + + tlib_php_request_start(); + + /* invalid txn should not crash */ + nr_php_txn_create_packages_major_metrics(NULL); + tlib_pass_if_int_equal("NULL txn, metric not created", 0, + nrm_table_size(txn->unscoped_metrics)); + + /* test with valid txn no package suggestions */ + nr_php_txn_create_packages_major_metrics(txn); + tlib_pass_if_int_equal("valid txn with no suggestions, metric not created", 0, + nrm_table_size(txn->unscoped_metrics)); + + /* + * Tests: + * 1. suggestion with NULL version, no packages + * 2. suggestion with PHP_PACKAGE_VERSION_UNKNOWN version, no packages + * 3. suggestion with known version, no packages + * 4. package with known version and suggestion with known version + * 5. package with known version and suggestion with unknown version + * 6. package with unknown version and suggestion with known version + * 7. package with unknown version and suggestion with unknown version + * 8. test that causes "actual" to be NULL in callback + * 9. package with known "dev" version with and suggestion with unknown version + */ + + /* 1. suggestion with NULL version, no packages */ + nr_txn_suggest_package_supportability_metric(txn, LIBRARY_NAME, NULL); + nr_php_txn_create_packages_major_metrics(txn); + tlib_pass_if_int_equal("suggestion with NULL version, metric not created", 0, + nrm_table_size(txn->unscoped_metrics)); + + /* 2. suggestion with PHP_PACKAGE_VERSION_UNKNOWN version, no packages + * also + * 8. test that causes "actual" to be NULL in callback + */ + nr_txn_suggest_package_supportability_metric(txn, LIBRARY_NAME, + PHP_PACKAGE_VERSION_UNKNOWN); + nr_php_txn_create_packages_major_metrics(txn); + tlib_pass_if_int_equal( + "suggestion with PHP_PACKAGE_VERSION_UNKNOWN version, metric not created", + 0, nrm_table_size(txn->unscoped_metrics)); + + /* 3. suggestion with known version, no packages + * also + * 8. test that causes "actual" to be NULL in callback + */ + nr_txn_suggest_package_supportability_metric(txn, LIBRARY_NAME, + LIBRARY_VERSION); + nr_php_txn_create_packages_major_metrics(txn); + tlib_pass_if_int_equal("suggestion with valid version, metric created", 1, + nrm_table_size(txn->unscoped_metrics)); + tlib_pass_if_not_null( + "php package major version is used for 'detected' metric", + nrm_find(txn->unscoped_metrics, + PACKAGE_METRIC "/" LIBRARY_MAJOR_VERSION "/detected")); + + /* reset metrics */ + nrm_table_destroy(&txn->unscoped_metrics); + txn->unscoped_metrics = nrm_table_create(10); + + /* 4. package with known version and suggestion with known version + * + * add a package with a "better" version determined from composer api + * and use existing suggestion which has a different version + */ + nr_txn_add_php_package_from_source(txn, LIBRARY_NAME, + COMPOSER_PACKAGE_VERSION, + NR_PHP_PACKAGE_SOURCE_COMPOSER); + nr_php_txn_create_packages_major_metrics(txn); + tlib_pass_if_int_equal("suggestion with valid version, metric created", 1, + nrm_table_size(txn->unscoped_metrics)); + tlib_pass_if_not_null( + "php package major version is used for 'detected' metric", + nrm_find(txn->unscoped_metrics, + PACKAGE_METRIC "/" COMPOSER_MAJOR_VERSION "/detected")); + + /* reset suggestions, leave package with known version in place */ + nr_php_packages_destroy(&txn->php_package_major_version_metrics_suggestions); + txn->php_package_major_version_metrics_suggestions = nr_php_packages_create(); + + /* reset metrics */ + nrm_table_destroy(&txn->unscoped_metrics); + txn->unscoped_metrics = nrm_table_create(10); + + /* 5. package with known version and suggestion with unknown version + * + * add a suggestion with no version and test metric uses package version + */ + nr_txn_suggest_package_supportability_metric(txn, LIBRARY_NAME, + PHP_PACKAGE_VERSION_UNKNOWN); + nr_php_txn_create_packages_major_metrics(txn); + tlib_pass_if_int_equal("suggestion with valid version, metric created", 1, + nrm_table_size(txn->unscoped_metrics)); + tlib_pass_if_not_null( + "php package major version is used for 'detected' metric", + nrm_find(txn->unscoped_metrics, + PACKAGE_METRIC "/" COMPOSER_MAJOR_VERSION "/detected")); + + /* reset everything */ + nrm_table_destroy(&txn->unscoped_metrics); + txn->unscoped_metrics = nrm_table_create(10); + nr_php_packages_destroy(&txn->php_packages); + txn->php_packages = nr_php_packages_create(); + nr_php_packages_destroy(&txn->php_package_major_version_metrics_suggestions); + txn->php_package_major_version_metrics_suggestions = nr_php_packages_create(); + + /* 6. package with unknown version and suggestion with known version */ + nr_txn_suggest_package_supportability_metric(txn, LIBRARY_NAME, + LIBRARY_VERSION); + nr_txn_add_php_package_from_source(txn, LIBRARY_NAME, + PHP_PACKAGE_VERSION_UNKNOWN, + NR_PHP_PACKAGE_SOURCE_COMPOSER); + nr_php_txn_create_packages_major_metrics(txn); + tlib_pass_if_int_equal("suggestion with valid version, metric created", 1, + nrm_table_size(txn->unscoped_metrics)); + tlib_pass_if_not_null( + "php package suggestion major version is used for 'detected' metric", + nrm_find(txn->unscoped_metrics, + PACKAGE_METRIC "/" LIBRARY_MAJOR_VERSION "/detected")); + + /* reset everything */ + nrm_table_destroy(&txn->unscoped_metrics); + txn->unscoped_metrics = nrm_table_create(10); + nr_php_packages_destroy(&txn->php_packages); + txn->php_packages = nr_php_packages_create(); + nr_php_packages_destroy(&txn->php_package_major_version_metrics_suggestions); + txn->php_package_major_version_metrics_suggestions = nr_php_packages_create(); + + /* 7. package with unknown version and suggestion with unknown version */ + nr_txn_suggest_package_supportability_metric(txn, LIBRARY_NAME, + PHP_PACKAGE_VERSION_UNKNOWN); + nr_txn_add_php_package_from_source(txn, LIBRARY_NAME, + PHP_PACKAGE_VERSION_UNKNOWN, + NR_PHP_PACKAGE_SOURCE_COMPOSER); + nr_php_txn_create_packages_major_metrics(txn); + tlib_pass_if_int_equal( + "suggestion and package w/o version, metric not created", 0, + nrm_table_size(txn->unscoped_metrics)); + + /* reset everything */ + nrm_table_destroy(&txn->unscoped_metrics); + txn->unscoped_metrics = nrm_table_create(10); + nr_php_packages_destroy(&txn->php_packages); + txn->php_packages = nr_php_packages_create(); + nr_php_packages_destroy(&txn->php_package_major_version_metrics_suggestions); + txn->php_package_major_version_metrics_suggestions = nr_php_packages_create(); + + /* 9. package with known "dev" version with and suggestion with unknown version */ + nr_txn_suggest_package_supportability_metric(txn, LIBRARY_NAME, + PHP_PACKAGE_VERSION_UNKNOWN); + nr_txn_add_php_package_from_source(txn, LIBRARY_NAME, + DEVEL_LIBRARY_VERSION, + NR_PHP_PACKAGE_SOURCE_COMPOSER); + nr_php_txn_create_packages_major_metrics(txn); + tlib_pass_if_int_equal("suggestion with valid 'dev' version, metric created", 1, + nrm_table_size(txn->unscoped_metrics)); + tlib_pass_if_not_null( + "php package suggestion major version with 'dev' is used for 'detected' metric", + nrm_find(txn->unscoped_metrics, + PACKAGE_METRIC "/" LIBRARY_MAJOR_VERSION "/detected")); + + + /* cleanup */ + nr_php_packages_destroy(&txn->php_packages); + nr_php_packages_destroy(&txn->php_package_major_version_metrics_suggestions); + nrm_table_destroy(&txn->unscoped_metrics); + + tlib_php_request_end(); +} + + +void test_main(void* p NRUNUSED) { + tlib_php_engine_create(""); + test_nr_php_txn_php_package_create_major_metric(); + test_nr_php_txn_create_packages_major_metrics(); + tlib_php_engine_destroy(); +} diff --git a/axiom/nr_php_packages.c b/axiom/nr_php_packages.c index 159bf4f8d..b8a034086 100644 --- a/axiom/nr_php_packages.c +++ b/axiom/nr_php_packages.c @@ -25,6 +25,8 @@ typedef struct { static inline const char* nr_php_package_source_priority_to_string(const nr_php_package_source_priority_t source_priority) { switch (source_priority) { + case NR_PHP_PACKAGE_SOURCE_SUGGESTION: + return "suggestion"; case NR_PHP_PACKAGE_SOURCE_LEGACY: return "legacy"; case NR_PHP_PACKAGE_SOURCE_COMPOSER: @@ -34,7 +36,10 @@ static inline const char* nr_php_package_source_priority_to_string(const nr_php_ } } -nr_php_package_t* nr_php_package_create_with_source(char* name, char* version, const nr_php_package_source_priority_t source_priority) { +nr_php_package_t* nr_php_package_create_with_source( + const char* name, + const char* version, + const nr_php_package_source_priority_t source_priority) { nr_php_package_t* p = NULL; if (NULL == name) { @@ -61,7 +66,7 @@ nr_php_package_t* nr_php_package_create_with_source(char* name, char* version, c return p; } -nr_php_package_t* nr_php_package_create(char* name, char* version) { +nr_php_package_t* nr_php_package_create(const char* name, const char* version) { return nr_php_package_create_with_source(name, version, NR_PHP_PACKAGE_SOURCE_LEGACY); } @@ -116,6 +121,16 @@ nr_php_package_t* nr_php_packages_add_package(nr_php_packages_t* h, return p; } +void nr_php_packages_iterate(nr_php_packages_t* packages, + nr_php_packages_iter_t callback, + void* userdata) { + if (NULL == packages || NULL == callback) { + return; + } + + nr_hashmap_apply(packages->data, (nr_hashmap_apply_func_t)callback, userdata); +} + char* nr_php_package_to_json(nr_php_package_t* package) { char* json; nrbuf_t* buf = NULL; diff --git a/axiom/nr_php_packages.h b/axiom/nr_php_packages.h index eae5a90cb..f4945c43e 100644 --- a/axiom/nr_php_packages.h +++ b/axiom/nr_php_packages.h @@ -15,6 +15,7 @@ #define PHP_PACKAGE_VERSION_UNKNOWN " " typedef enum { + NR_PHP_PACKAGE_SOURCE_SUGGESTION, NR_PHP_PACKAGE_SOURCE_LEGACY, NR_PHP_PACKAGE_SOURCE_COMPOSER } nr_php_package_source_priority_t; @@ -29,6 +30,11 @@ typedef struct _nr_php_packages_t { nr_hashmap_t* data; } nr_php_packages_t; +typedef void(nr_php_packages_iter_t)(void* value, + const char* name, + size_t name_len, + void* user_data); + /* * Purpose : Create a new php package with desired source priority. If the name is null, then no package will * be created. If the version is null (version = NULL), then @@ -43,7 +49,10 @@ typedef struct _nr_php_packages_t { * nr_php_packages_add_package() is not called, then it must be freed * by nr_php_package_destroy() */ -extern nr_php_package_t* nr_php_package_create_with_source(char* name, char* version, const nr_php_package_source_priority_t source_priority); +extern nr_php_package_t* nr_php_package_create_with_source( + const char* name, + const char* version, + const nr_php_package_source_priority_t source_priority); /* * Purpose : Create a new php package with legacy source priority. If the name is null, then no package will @@ -58,7 +67,8 @@ extern nr_php_package_t* nr_php_package_create_with_source(char* name, char* ver * nr_php_packages_add_package() is not called, then it must be freed * by nr_php_package_destroy() */ -extern nr_php_package_t* nr_php_package_create(char* name, char* version); +extern nr_php_package_t* nr_php_package_create(const char* name, + const char* version); /* * Purpose : Destroy/free php package @@ -149,8 +159,9 @@ static inline int nr_php_packages_has_package(nr_php_packages_t* h, * * Returns : Returns pointer to php package if the package exists or NULL */ -static inline nr_php_package_t* nr_php_packages_get_package(nr_php_packages_t* php_packages, - const char* package_name) { +static inline nr_php_package_t* nr_php_packages_get_package( + nr_php_packages_t* php_packages, + const char* package_name) { if (NULL == package_name) { return NULL; } @@ -161,6 +172,19 @@ static inline nr_php_package_t* nr_php_packages_get_package(nr_php_packages_t* p return NULL; } +/* + * Purpose : Iterate over packages calling callback function + * + * Params : 1. A pointer to nr_php_packages_t + * 2. Callback function (nr_php_packages_iter_t) + * 3. Pointer to user data (can be NULL) + * + * Returns : Nothing + */ +void nr_php_packages_iterate(nr_php_packages_t* packages, + nr_php_packages_iter_t callback, + void* userdata); + /* * Purpose : Converts a package to a json * diff --git a/axiom/nr_txn.c b/axiom/nr_txn.c index 2dad9c3fb..774c44671 100644 --- a/axiom/nr_txn.c +++ b/axiom/nr_txn.c @@ -542,6 +542,7 @@ nrtxn_t* nr_txn_begin(nrapp_t* app, nt->custom_events = nr_analytics_events_create(app->limits.custom_events); nt->log_events = nr_log_events_create(app->limits.log_events); nt->php_packages = nr_php_packages_create(); + nt->php_package_major_version_metrics_suggestions = nr_php_packages_create(); /* * reset flag for creation of one-time logging metrics @@ -1246,6 +1247,7 @@ void nr_txn_destroy_fields(nrtxn_t* txn) { nr_segment_destroy_tree(txn->segment_root); nr_hashmap_destroy(&txn->parent_stacks); nr_php_packages_destroy(&txn->php_packages); + nr_php_packages_destroy(&txn->php_package_major_version_metrics_suggestions); nr_stack_destroy_fields(&txn->default_parent_stack); nr_slab_destroy(&txn->segment_slab); nr_minmax_heap_set_destructor(txn->segment_heap, NULL, NULL); @@ -3519,3 +3521,25 @@ nr_php_package_t* nr_txn_add_php_package(nrtxn_t* txn, return nr_txn_add_php_package_from_source(txn, package_name, package_version, NR_PHP_PACKAGE_SOURCE_LEGACY); } + +void nr_txn_suggest_package_supportability_metric(nrtxn_t* txn, + const char* package_name, + const char* package_version) { + nr_php_package_t* p = NULL; + + if (nrunlikely(NULL == txn)) { + return; + } + + if (nr_strempty(package_name)) { + return; + } + + nrl_verbosedebug(NRL_TXN, "Suggesting package %s %s", NRSAFESTR(package_name), + NRSAFESTR(package_version)); + + p = nr_php_package_create_with_source(package_name, package_version, + NR_PHP_PACKAGE_SOURCE_SUGGESTION); + nr_php_packages_add_package( + txn->php_package_major_version_metrics_suggestions, p); +} diff --git a/axiom/nr_txn.h b/axiom/nr_txn.h index 7733b2453..8874260ec 100644 --- a/axiom/nr_txn.h +++ b/axiom/nr_txn.h @@ -286,6 +286,9 @@ typedef struct _nrtxn_t { custom_events; /* Custom events created through the API. */ nr_log_events_t* log_events; /* Log events pool */ nr_php_packages_t* php_packages; /* Detected php packages */ + nr_php_packages_t* + php_package_major_version_metrics_suggestions; /* Suggested packages for + major metric creation */ nrtime_t user_cpu[NR_CPU_USAGE_COUNT]; /* User CPU usage */ nrtime_t sys_cpu[NR_CPU_USAGE_COUNT]; /* System CPU usage */ @@ -1196,8 +1199,26 @@ nr_php_package_t* nr_txn_add_php_package_from_source( * * Returns : pointer to added package on success or NULL otherwise. */ -nr_php_package_t* nr_txn_add_php_package(nrtxn_t* txn, - char* package_name, - char* package_version); +extern nr_php_package_t* nr_txn_add_php_package(nrtxn_t* txn, + char* package_name, + char* package_version); +/* + * Purpose : Add php package suggestion to transaction. This function + * can be used when Vulnerability Management is not enabled. It will + * add the package to the transaction's + * php_package_major_version_metrics_suggestions list. At the end of the + * transaction this list is traversed and any suggestions with a known version + * will have a package major version metric created. + * + * Params : 1. The transaction + * 2. Package name + * 3. Package version (can be NULL or PHP_PACKAGE_VERSION_UNKNOWN) + * + * Returns : Nothing. + */ +extern void nr_txn_suggest_package_supportability_metric( + nrtxn_t* txn, + const char* package_name, + const char* package_version); #endif /* NR_TXN_HDR */ diff --git a/axiom/tests/.gitignore b/axiom/tests/.gitignore index e2e2db564..22ee3b042 100644 --- a/axiom/tests/.gitignore +++ b/axiom/tests/.gitignore @@ -82,6 +82,7 @@ test_number_converter test_obfuscate test_object test_offsets +test_php_packages test_postgres test_quarantine test_random diff --git a/axiom/tests/test_php_packages.c b/axiom/tests/test_php_packages.c index c167f9abf..bd2323b2f 100644 --- a/axiom/tests/test_php_packages.c +++ b/axiom/tests/test_php_packages.c @@ -301,6 +301,74 @@ static void test_php_package_priority(void) { nr_php_packages_destroy(&hm); } +static void nr_php_packages_itereate_callback(void* value, + const char* key, + size_t key_len, + void* user_data) { + nr_php_package_t* package = value; + const char* name = key; + nrbuf_t* buf = (nrbuf_t*)user_data; + + if (NULL == buf) { + return; + } + + /* append name, len, version to string */ + nr_buffer_add(buf, name, key_len); + nr_buffer_add(buf, NR_PSTR(",")); + nr_buffer_add(buf, package->package_version, + nr_strlen(package->package_version)); + nr_buffer_add(buf, NR_PSTR("\n")); +} + +static void test_php_package_iterate(void) { + nr_php_package_t* package1; + nr_php_package_t* package2; + nr_php_package_t* package3; + nr_php_packages_t* hm = nr_php_packages_create(); + nrbuf_t* buf; + int count; + + // Test: create multiple new packages and add to hashmap + package1 = nr_php_package_create("name1", "name1_version"); + package2 = nr_php_package_create("name2", "name2_version"); + package3 = nr_php_package_create("name3", "name3_version"); + + nr_php_packages_add_package(hm, package1); + nr_php_packages_add_package(hm, package2); + nr_php_packages_add_package(hm, package3); + + count = nr_php_packages_count(hm); + + tlib_pass_if_int_equal("package count", 3, count); + + /* tests with invalid values + * NOTE: nr_buffer_cptr(buf) will return NULL if no data is in the buffer + */ + buf = nr_buffer_create(0, 0); + nr_php_packages_iterate(NULL, nr_php_packages_itereate_callback, (void*)buf); + tlib_pass_if_null("iterate with NULL hashmap", nr_buffer_cptr(buf)); + nr_php_packages_iterate(hm, nr_php_packages_itereate_callback, NULL); + tlib_pass_if_null("iterate with NULL userdata", nr_buffer_cptr(buf)); + nr_php_packages_iterate(hm, NULL, (void*)buf); + tlib_pass_if_null("iterate with NULL callback", nr_buffer_cptr(buf)); + nr_php_packages_iterate(NULL, NULL, NULL); + tlib_pass_if_null("iterate with all NULL", nr_buffer_cptr(buf)); + nr_buffer_destroy(&buf); + + /* test with valid values */ + buf = nr_buffer_create(0, 0); + nr_php_packages_iterate(hm, nr_php_packages_itereate_callback, (void*)buf); + nr_buffer_add(buf, NR_PSTR("\0")); + tlib_pass_if_str_equal("iterate created proper string", + "name1,name1_version\nname2,name2_version\nname3,name3_version\n", nr_buffer_cptr(buf)); + nr_buffer_destroy(&buf); + + nr_php_packages_destroy(&hm); +} + + + tlib_parallel_info_t parallel_info = {.suggested_nthreads = -1, .state_size = 0}; @@ -313,4 +381,5 @@ void test_main(void* p NRUNUSED) { test_php_package_exists_in_hashmap(); test_php_package_without_version(); test_php_package_priority(); + test_php_package_iterate(); } diff --git a/axiom/tests/test_txn.c b/axiom/tests/test_txn.c index 0ef69a1d6..9230a416a 100644 --- a/axiom/tests/test_txn.c +++ b/axiom/tests/test_txn.c @@ -8632,6 +8632,123 @@ static void test_nr_txn_add_php_package(void) { nr_txn_destroy(&txn); } +static void test_nr_txn_add_php_package_from_source(void) { + char* json; + char* package_name1 = "Laravel"; + char* package_version1 = "8.83.27"; + char* package_name2 = "Slim"; + char* package_version2 = "4.12.0"; + char* package_name3 = "Drupal"; + char* package_version3 = NULL; + char* package_name4 = "Wordpress"; + char* package_version4 = PHP_PACKAGE_VERSION_UNKNOWN; + nrtxn_t* txn = new_txn(0); + nr_php_package_t* p1 = NULL; + nr_php_package_t* p2 = NULL; + + /* + * NULL parameters: ensure it does not crash + */ + nr_txn_add_php_package_from_source(NULL, NULL, NULL, 0); + nr_txn_add_php_package_from_source(NULL, package_name1, package_version1, 0); + nr_txn_add_php_package_from_source(txn, NULL, package_version1, 0); + nr_txn_add_php_package_from_source(txn, package_name1, NULL, 0); + + // Test: add php packages to transaction + nr_txn_add_php_package_from_source(txn, package_name1, package_version1, + NR_PHP_PACKAGE_SOURCE_COMPOSER); + nr_txn_add_php_package_from_source(txn, package_name2, package_version2, + NR_PHP_PACKAGE_SOURCE_LEGACY); + nr_txn_add_php_package_from_source(txn, package_name3, package_version3, + NR_PHP_PACKAGE_SOURCE_COMPOSER); + nr_txn_add_php_package_from_source(txn, package_name4, package_version4, + NR_PHP_PACKAGE_SOURCE_LEGACY); + json = nr_php_packages_to_json(txn->php_packages); + + tlib_pass_if_str_equal("correct json", + "[[\"Laravel\",\"8.83.27\",{}]," + "[\"Drupal\",\" \",{}],[\"Wordpress\",\" \",{}]," + "[\"Slim\",\"4.12.0\",{}]]", + json); + + nr_free(json); + nr_txn_destroy(&txn); + + txn = new_txn(0); + p1 = nr_txn_add_php_package_from_source(txn, package_name1, package_version1, + NR_PHP_PACKAGE_SOURCE_COMPOSER); + p2 = nr_txn_add_php_package_from_source(txn, package_name1, package_version2, + NR_PHP_PACKAGE_SOURCE_COMPOSER); + tlib_pass_if_ptr_equal( + "same package name, different version, add returns same pointer", p1, p2); + nr_txn_destroy(&txn); + + txn = new_txn(0); + p1 = nr_txn_add_php_package_from_source(txn, package_name1, package_version1, + NR_PHP_PACKAGE_SOURCE_LEGACY); + p2 = nr_txn_add_php_package_from_source(txn, package_name1, package_version2, + NR_PHP_PACKAGE_SOURCE_COMPOSER); + tlib_pass_if_ptr_equal( + "same package name, different version, add returns different pointer", p1, + p2); + tlib_pass_if_str_equal("composer version used", package_version2, + p2->package_version); + + nr_txn_destroy(&txn); +} + +static void test_nr_txn_suggest_package_supportability_metric(void) { + char* json; + char* package_name1 = "Laravel"; + char* package_version1 = "8.83.27"; + char* package_name2 = "Slim"; + char* package_version2 = "4.12.0"; + char* package_name3 = "Drupal"; + char* package_version3 = NULL; + char* package_name4 = "Wordpress"; + char* package_version4 = PHP_PACKAGE_VERSION_UNKNOWN; + nrtxn_t* txn = new_txn(0); + nr_php_package_t* p1 = NULL; + nr_php_package_t* p2 = NULL; + + /* + * NULL parameters: ensure it does not crash + */ + nr_txn_suggest_package_supportability_metric(NULL, NULL, NULL); + nr_txn_suggest_package_supportability_metric(NULL, package_name1, + package_version1); + nr_txn_suggest_package_supportability_metric(txn, NULL, package_version1); + nr_txn_suggest_package_supportability_metric(txn, package_name1, NULL); + + // Test: add php packages to transaction + nr_txn_suggest_package_supportability_metric(txn, package_name1, + package_version1); + nr_txn_suggest_package_supportability_metric(txn, package_name2, + package_version2); + nr_txn_suggest_package_supportability_metric(txn, package_name3, + package_version3); + nr_txn_suggest_package_supportability_metric(txn, package_name4, + package_version4); + json = nr_php_packages_to_json( + txn->php_package_major_version_metrics_suggestions); + + tlib_pass_if_str_equal("correct json", + "[[\"Laravel\",\"8.83.27\",{}]," + "[\"Drupal\",\" \",{}],[\"Wordpress\",\" \",{}]," + "[\"Slim\",\"4.12.0\",{}]]", + json); + + nr_free(json); + nr_txn_destroy(&txn); + + txn = new_txn(0); + p1 = nr_txn_add_php_package(txn, package_name1, package_version1); + p2 = nr_txn_add_php_package(txn, package_name1, package_version2); + tlib_pass_if_ptr_equal( + "same package name, different version, add returns same pointer", p1, p2); + nr_txn_destroy(&txn); +} + tlib_parallel_info_t parallel_info = {.suggested_nthreads = 2, .state_size = sizeof(test_txn_state_t)}; @@ -8734,4 +8851,6 @@ void test_main(void* p NRUNUSED) { test_record_log_event(); test_txn_log_configuration(); test_nr_txn_add_php_package(); + test_nr_txn_add_php_package_from_source(); + test_nr_txn_suggest_package_supportability_metric(); } diff --git a/tests/integration/logging/monolog2/test_monolog_basic.php b/tests/integration/logging/monolog2/test_monolog_basic.php index b562bf15e..8c04625eb 100644 --- a/tests/integration/logging/monolog2/test_monolog_basic.php +++ b/tests/integration/logging/monolog2/test_monolog_basic.php @@ -58,7 +58,7 @@ [{"name": "OtherTransactionTotalTime/php__FILE__"}, [1, "??", "??", "??", "??", "??"]], [{"name": "Supportability/Logging/LocalDecorating/PHP/disabled"}, [1, "??", "??", "??", "??", "??"]], [{"name": "Supportability/Logging/PHP/Monolog/enabled"}, [1, "??", "??", "??", "??", "??"]], - [{"name": "Supportability/PHP/package/monolog/monolog/2/detected"}, [8, "??", "??", "??", "??", "??"]], + [{"name": "Supportability/PHP/package/monolog/monolog/2/detected"}, [1, "??", "??", "??", "??", "??"]], [{"name": "Supportability/library/Monolog/detected"}, [1, "??", "??", "??", "??", "??"]], [{"name": "Supportability/Logging/Forwarding/PHP/enabled"}, [1, "??", "??", "??", "??", "??"]], [{"name": "Supportability/Logging/Metrics/PHP/enabled"}, [1, "??", "??", "??", "??", "??"]] @@ -201,4 +201,4 @@ function test_logging() { $logger->emergency("emergency"); } -test_logging(); \ No newline at end of file +test_logging(); diff --git a/tests/integration/logging/monolog2/test_monolog_cat.php b/tests/integration/logging/monolog2/test_monolog_cat.php index d96e38aec..b192b9ce9 100644 --- a/tests/integration/logging/monolog2/test_monolog_cat.php +++ b/tests/integration/logging/monolog2/test_monolog_cat.php @@ -56,7 +56,7 @@ [{"name": "OtherTransactionTotalTime"}, [1, "??", "??", "??", "??", "??"]], [{"name": "OtherTransactionTotalTime/php__FILE__"}, [1, "??", "??", "??", "??", "??"]], [{"name": "Supportability/Logging/PHP/Monolog/enabled"}, [1, "??", "??", "??", "??", "??"]], - [{"name": "Supportability/PHP/package/monolog/monolog/2/detected"}, [8, "??", "??", "??", "??", "??"]], + [{"name": "Supportability/PHP/package/monolog/monolog/2/detected"}, [1, "??", "??", "??", "??", "??"]], [{"name": "Supportability/library/Monolog/detected"}, [1, "??", "??", "??", "??", "??"]], [{"name": "Supportability/Logging/LocalDecorating/PHP/disabled"}, [1, "??", "??", "??", "??", "??"]], [{"name": "Supportability/Logging/Forwarding/PHP/enabled"}, [1, "??", "??", "??", "??", "??"]], @@ -183,4 +183,4 @@ function test_logging() { $logger->emergency("emergency"); } -test_logging(); \ No newline at end of file +test_logging(); diff --git a/tests/integration/logging/monolog2/test_monolog_context_simple.php b/tests/integration/logging/monolog2/test_monolog_context_simple.php index 769694845..a0f0b7260 100644 --- a/tests/integration/logging/monolog2/test_monolog_context_simple.php +++ b/tests/integration/logging/monolog2/test_monolog_context_simple.php @@ -59,7 +59,7 @@ [{"name": "OtherTransactionTotalTime"}, [1, "??", "??", "??", "??", "??"]], [{"name": "OtherTransactionTotalTime/php__FILE__"}, [1, "??", "??", "??", "??", "??"]], [{"name": "Supportability/Logging/PHP/Monolog/enabled"}, [1, "??", "??", "??", "??", "??"]], - [{"name": "Supportability/PHP/package/monolog/monolog/2/detected"}, [8, "??", "??", "??", "??", "??"]], + [{"name": "Supportability/PHP/package/monolog/monolog/2/detected"}, [1, "??", "??", "??", "??", "??"]], [{"name": "Supportability/library/Monolog/detected"}, [1, "??", "??", "??", "??", "??"]], [{"name": "Supportability/Logging/LocalDecorating/PHP/disabled"}, [1, "??", "??", "??", "??", "??"]], [{"name": "Supportability/Logging/Forwarding/PHP/enabled"}, [1, "??", "??", "??", "??", "??"]], diff --git a/tests/integration/logging/monolog2/test_monolog_decoration_and_forwarding.php b/tests/integration/logging/monolog2/test_monolog_decoration_and_forwarding.php index 1737a919c..82ad4be61 100644 --- a/tests/integration/logging/monolog2/test_monolog_decoration_and_forwarding.php +++ b/tests/integration/logging/monolog2/test_monolog_decoration_and_forwarding.php @@ -113,7 +113,7 @@ [{"name": "OtherTransactionTotalTime/php__FILE__"}, [1, "??", "??", "??", "??", "??"]], [{"name": "Supportability/api/get_linking_metadata"}, [16, "??", "??", "??", "??", "??"]], [{"name": "Supportability/Logging/PHP/Monolog/enabled"}, [1, "??", "??", "??", "??", "??"]], - [{"name": "Supportability/PHP/package/monolog/monolog/2/detected"}, [8, "??", "??", "??", "??", "??"]], + [{"name": "Supportability/PHP/package/monolog/monolog/2/detected"}, [1, "??", "??", "??", "??", "??"]], [{"name": "Supportability/library/Monolog/detected"}, [1, "??", "??", "??", "??", "??"]], [{"name": "Supportability/Logging/LocalDecorating/PHP/enabled"}, [1, "??", "??", "??", "??", "??"]], [{"name": "Supportability/Logging/Forwarding/PHP/enabled"}, [1, "??", "??", "??", "??", "??"]], @@ -257,4 +257,4 @@ function test_logging() { $logger->emergency("emergency"); } -test_logging(); \ No newline at end of file +test_logging(); diff --git a/tests/integration/logging/monolog2/test_monolog_disable_metrics.php b/tests/integration/logging/monolog2/test_monolog_disable_metrics.php index 95b84d636..eaed5d5d4 100644 --- a/tests/integration/logging/monolog2/test_monolog_disable_metrics.php +++ b/tests/integration/logging/monolog2/test_monolog_disable_metrics.php @@ -51,7 +51,7 @@ [{"name": "OtherTransactionTotalTime"}, [1, "??", "??", "??", "??", "??"]], [{"name": "OtherTransactionTotalTime/php__FILE__"}, [1, "??", "??", "??", "??", "??"]], [{"name": "Supportability/Logging/PHP/Monolog/enabled"}, [1, "??", "??", "??", "??", "??"]], - [{"name": "Supportability/PHP/package/monolog/monolog/2/detected"}, [8, "??", "??", "??", "??", "??"]], + [{"name": "Supportability/PHP/package/monolog/monolog/2/detected"}, [1, "??", "??", "??", "??", "??"]], [{"name": "Supportability/library/Monolog/detected"}, [1, "??", "??", "??", "??", "??"]], [{"name": "Supportability/Logging/LocalDecorating/PHP/disabled"}, [1, "??", "??", "??", "??", "??"]], [{"name": "Supportability/Logging/Forwarding/PHP/enabled"}, [1, "??", "??", "??", "??", "??"]], @@ -153,4 +153,4 @@ function test_logging() { $logger->emergency("emergency"); } -test_logging(); \ No newline at end of file +test_logging(); diff --git a/tests/integration/logging/monolog2/test_monolog_drop_empty.php b/tests/integration/logging/monolog2/test_monolog_drop_empty.php index 8139e3606..5d48030ca 100644 --- a/tests/integration/logging/monolog2/test_monolog_drop_empty.php +++ b/tests/integration/logging/monolog2/test_monolog_drop_empty.php @@ -57,7 +57,7 @@ [{"name": "OtherTransactionTotalTime"}, [1, "??", "??", "??", "??", "??"]], [{"name": "OtherTransactionTotalTime/php__FILE__"}, [1, "??", "??", "??", "??", "??"]], [{"name": "Supportability/Logging/PHP/Monolog/enabled"}, [1, "??", "??", "??", "??", "??"]], - [{"name": "Supportability/PHP/package/monolog/monolog/2/detected"}, [8, "??", "??", "??", "??", "??"]], + [{"name": "Supportability/PHP/package/monolog/monolog/2/detected"}, [1, "??", "??", "??", "??", "??"]], [{"name": "Supportability/library/Monolog/detected"}, [1, "??", "??", "??", "??", "??"]], [{"name": "Supportability/Logging/LocalDecorating/PHP/disabled"}, [1, "??", "??", "??", "??", "??"]], [{"name": "Supportability/Logging/Forwarding/PHP/enabled"}, [1, "??", "??", "??", "??", "??"]], @@ -171,4 +171,4 @@ function test_logging() { $logger->emergency("emergency"); } -test_logging(); \ No newline at end of file +test_logging(); diff --git a/tests/integration/logging/monolog2/test_monolog_large_message_limit.php b/tests/integration/logging/monolog2/test_monolog_large_message_limit.php index d7c9b677a..7a0e1eacd 100644 --- a/tests/integration/logging/monolog2/test_monolog_large_message_limit.php +++ b/tests/integration/logging/monolog2/test_monolog_large_message_limit.php @@ -40,7 +40,7 @@ [{"name": "OtherTransactionTotalTime"}, [1, "??", "??", "??", "??", "??"]], [{"name": "OtherTransactionTotalTime/php__FILE__"}, [1, "??", "??", "??", "??", "??"]], [{"name": "Supportability/Logging/PHP/Monolog/enabled"}, [1, "??", "??", "??", "??", "??"]], - [{"name": "Supportability/PHP/package/monolog/monolog/2/detected"}, [833, "??", "??", "??", "??", "??"]], + [{"name": "Supportability/PHP/package/monolog/monolog/2/detected"}, [1, "??", "??", "??", "??", "??"]], [{"name": "Supportability/library/Monolog/detected"}, [1, "??", "??", "??", "??", "??"]], [{"name": "Supportability/Logging/LocalDecorating/PHP/disabled"}, [1, "??", "??", "??", "??", "??"]], [{"name": "Supportability/Logging/Forwarding/PHP/enabled"}, [1, "??", "??", "??", "??", "??"]], @@ -78,4 +78,4 @@ function test_logging() { } } -test_logging(); \ No newline at end of file +test_logging(); diff --git a/tests/integration/logging/monolog2/test_monolog_large_message_limit_drops.php b/tests/integration/logging/monolog2/test_monolog_large_message_limit_drops.php index 0dfe1dc2d..313e73edd 100644 --- a/tests/integration/logging/monolog2/test_monolog_large_message_limit_drops.php +++ b/tests/integration/logging/monolog2/test_monolog_large_message_limit_drops.php @@ -40,7 +40,7 @@ [{"name": "OtherTransactionTotalTime"}, [1, "??", "??", "??", "??", "??"]], [{"name": "OtherTransactionTotalTime/php__FILE__"}, [1, "??", "??", "??", "??", "??"]], [{"name": "Supportability/Logging/PHP/Monolog/enabled"}, [1, "??", "??", "??", "??", "??"]], - [{"name": "Supportability/PHP/package/monolog/monolog/2/detected"}, [1666, "??", "??", "??", "??", "??"]], + [{"name": "Supportability/PHP/package/monolog/monolog/2/detected"}, [1, "??", "??", "??", "??", "??"]], [{"name": "Supportability/library/Monolog/detected"}, [1, "??", "??", "??", "??", "??"]], [{"name": "Supportability/Logging/LocalDecorating/PHP/disabled"}, [1, "??", "??", "??", "??", "??"]], [{"name": "Supportability/Logging/Forwarding/PHP/enabled"}, [1, "??", "??", "??", "??", "??"]], @@ -78,4 +78,4 @@ function test_logging() { } } -test_logging(); \ No newline at end of file +test_logging(); diff --git a/tests/integration/logging/monolog2/test_monolog_limit_log_events.php b/tests/integration/logging/monolog2/test_monolog_limit_log_events.php index c9106b2ea..ccc75de41 100644 --- a/tests/integration/logging/monolog2/test_monolog_limit_log_events.php +++ b/tests/integration/logging/monolog2/test_monolog_limit_log_events.php @@ -58,7 +58,7 @@ [{"name": "OtherTransactionTotalTime"}, [1, "??", "??", "??", "??", "??"]], [{"name": "OtherTransactionTotalTime/php__FILE__"}, [1, "??", "??", "??", "??", "??"]], [{"name": "Supportability/Logging/PHP/Monolog/enabled"}, [1, "??", "??", "??", "??", "??"]], - [{"name": "Supportability/PHP/package/monolog/monolog/2/detected"}, [8, "??", "??", "??", "??", "??"]], + [{"name": "Supportability/PHP/package/monolog/monolog/2/detected"}, [1, "??", "??", "??", "??", "??"]], [{"name": "Supportability/library/Monolog/detected"}, [1, "??", "??", "??", "??", "??"]], [{"name": "Supportability/Logging/LocalDecorating/PHP/disabled"}, [1, "??", "??", "??", "??", "??"]], [{"name": "Supportability/Logging/Forwarding/PHP/enabled"}, [1, "??", "??", "??", "??", "??"]], @@ -161,4 +161,4 @@ function test_logging() { $logger->emergency("emergency"); } -test_logging(); \ No newline at end of file +test_logging(); diff --git a/tests/integration/logging/monolog2/test_monolog_limit_zero_events.php b/tests/integration/logging/monolog2/test_monolog_limit_zero_events.php index 6ff0fa7d1..573850d3a 100644 --- a/tests/integration/logging/monolog2/test_monolog_limit_zero_events.php +++ b/tests/integration/logging/monolog2/test_monolog_limit_zero_events.php @@ -58,7 +58,7 @@ [{"name": "OtherTransactionTotalTime"}, [1, "??", "??", "??", "??", "??"]], [{"name": "OtherTransactionTotalTime/php__FILE__"}, [1, "??", "??", "??", "??", "??"]], [{"name": "Supportability/Logging/PHP/Monolog/enabled"}, [1, "??", "??", "??", "??", "??"]], - [{"name": "Supportability/PHP/package/monolog/monolog/2/detected"}, [8, "??", "??", "??", "??", "??"]], + [{"name": "Supportability/PHP/package/monolog/monolog/2/detected"}, [1, "??", "??", "??", "??", "??"]], [{"name": "Supportability/library/Monolog/detected"}, [1, "??", "??", "??", "??", "??"]], [{"name": "Supportability/Logging/LocalDecorating/PHP/disabled"}, [1, "??", "??", "??", "??", "??"]], [{"name": "Supportability/Logging/Forwarding/PHP/enabled"}, [1, "??", "??", "??", "??", "??"]], @@ -101,4 +101,4 @@ function test_logging() { $logger->emergency("emergency"); } -test_logging(); \ No newline at end of file +test_logging(); diff --git a/tests/integration/logging/monolog2/test_monolog_log_events_max_samples_stored_invalid1.php b/tests/integration/logging/monolog2/test_monolog_log_events_max_samples_stored_invalid1.php index f760b19ac..c346aa55e 100644 --- a/tests/integration/logging/monolog2/test_monolog_log_events_max_samples_stored_invalid1.php +++ b/tests/integration/logging/monolog2/test_monolog_log_events_max_samples_stored_invalid1.php @@ -45,7 +45,7 @@ [{"name": "Supportability/Logging/Forwarding/PHP/enabled"}, [1, "??", "??", "??", "??", "??"]], [{"name": "Supportability/Logging/Metrics/PHP/enabled"}, [1, "??", "??", "??", "??", "??"]], [{"name": "Supportability/Logging/PHP/Monolog/enabled"}, [1, "??", "??", "??", "??", "??"]], - [{"name": "Supportability/PHP/package/monolog/monolog/2/detected"}, [833, "??", "??", "??", "??", "??"]], + [{"name": "Supportability/PHP/package/monolog/monolog/2/detected"}, [1, "??", "??", "??", "??", "??"]], [{"name": "Supportability/library/Monolog/detected"}, [1, "??", "??", "??", "??", "??"]] ] ] @@ -81,4 +81,4 @@ function test_logging() { } -test_logging(); \ No newline at end of file +test_logging(); diff --git a/tests/integration/logging/monolog2/test_monolog_log_events_max_samples_stored_invalid2.php b/tests/integration/logging/monolog2/test_monolog_log_events_max_samples_stored_invalid2.php index ada730ed7..ab55e0359 100644 --- a/tests/integration/logging/monolog2/test_monolog_log_events_max_samples_stored_invalid2.php +++ b/tests/integration/logging/monolog2/test_monolog_log_events_max_samples_stored_invalid2.php @@ -45,7 +45,7 @@ [{"name": "Supportability/Logging/Forwarding/PHP/enabled"}, [1, "??", "??", "??", "??", "??"]], [{"name": "Supportability/Logging/Metrics/PHP/enabled"}, [1, "??", "??", "??", "??", "??"]], [{"name": "Supportability/Logging/PHP/Monolog/enabled"}, [1, "??", "??", "??", "??", "??"]], - [{"name": "Supportability/PHP/package/monolog/monolog/2/detected"}, [833, "??", "??", "??", "??", "??"]], + [{"name": "Supportability/PHP/package/monolog/monolog/2/detected"}, [1, "??", "??", "??", "??", "??"]], [{"name": "Supportability/library/Monolog/detected"}, [1, "??", "??", "??", "??", "??"]] ] ] @@ -81,4 +81,4 @@ function test_logging() { } -test_logging(); \ No newline at end of file +test_logging(); diff --git a/tests/integration/logging/monolog2/test_monolog_log_events_max_samples_stored_invalid3.php b/tests/integration/logging/monolog2/test_monolog_log_events_max_samples_stored_invalid3.php index cdd99bc5f..616eb81f8 100644 --- a/tests/integration/logging/monolog2/test_monolog_log_events_max_samples_stored_invalid3.php +++ b/tests/integration/logging/monolog2/test_monolog_log_events_max_samples_stored_invalid3.php @@ -45,7 +45,7 @@ [{"name": "Supportability/Logging/Forwarding/PHP/enabled"}, [1, "??", "??", "??", "??", "??"]], [{"name": "Supportability/Logging/Metrics/PHP/enabled"}, [1, "??", "??", "??", "??", "??"]], [{"name": "Supportability/Logging/PHP/Monolog/enabled"}, [1, "??", "??", "??", "??", "??"]], - [{"name": "Supportability/PHP/package/monolog/monolog/2/detected"}, [833, "??", "??", "??", "??", "??"]], + [{"name": "Supportability/PHP/package/monolog/monolog/2/detected"}, [1, "??", "??", "??", "??", "??"]], [{"name": "Supportability/library/Monolog/detected"}, [1, "??", "??", "??", "??", "??"]] ] ] @@ -81,4 +81,4 @@ function test_logging() { } -test_logging(); \ No newline at end of file +test_logging(); diff --git a/tests/integration/logging/monolog2/test_monolog_log_events_max_samples_stored_invalid4.php b/tests/integration/logging/monolog2/test_monolog_log_events_max_samples_stored_invalid4.php index 354108a09..0f13144eb 100644 --- a/tests/integration/logging/monolog2/test_monolog_log_events_max_samples_stored_invalid4.php +++ b/tests/integration/logging/monolog2/test_monolog_log_events_max_samples_stored_invalid4.php @@ -45,7 +45,7 @@ [{"name": "Supportability/Logging/Forwarding/PHP/enabled"}, [1, "??", "??", "??", "??", "??"]], [{"name": "Supportability/Logging/Metrics/PHP/enabled"}, [1, "??", "??", "??", "??", "??"]], [{"name": "Supportability/Logging/PHP/Monolog/enabled"}, [1, "??", "??", "??", "??", "??"]], - [{"name": "Supportability/PHP/package/monolog/monolog/2/detected"}, [833, "??", "??", "??", "??", "??"]], + [{"name": "Supportability/PHP/package/monolog/monolog/2/detected"}, [1, "??", "??", "??", "??", "??"]], [{"name": "Supportability/library/Monolog/detected"}, [1, "??", "??", "??", "??", "??"]] ] ] @@ -81,4 +81,4 @@ function test_logging() { } -test_logging(); \ No newline at end of file +test_logging(); diff --git a/tests/integration/logging/monolog2/test_monolog_log_level_filter.php b/tests/integration/logging/monolog2/test_monolog_log_level_filter.php index 939dd9cf5..fa7902395 100644 --- a/tests/integration/logging/monolog2/test_monolog_log_level_filter.php +++ b/tests/integration/logging/monolog2/test_monolog_log_level_filter.php @@ -60,7 +60,7 @@ [{"name": "Supportability/Logging/Forwarding/PHP/enabled"}, [1, "??", "??", "??", "??", "??"]], [{"name": "Supportability/Logging/Metrics/PHP/enabled"}, [1, "??", "??", "??", "??", "??"]], [{"name": "Supportability/Logging/PHP/Monolog/enabled"}, [1, "??", "??", "??", "??", "??"]], - [{"name": "Supportability/PHP/package/monolog/monolog/2/detected"}, [8, "??", "??", "??", "??", "??"]], + [{"name": "Supportability/PHP/package/monolog/monolog/2/detected"}, [1, "??", "??", "??", "??", "??"]], [{"name": "Supportability/library/Monolog/detected"}, [1, "??", "??", "??", "??", "??"]] ] ] @@ -171,4 +171,4 @@ function test_logging() { $logger->emergency("emergency"); } -test_logging(); \ No newline at end of file +test_logging(); diff --git a/tests/integration/logging/monolog2/test_monolog_log_level_filter_invalid.php b/tests/integration/logging/monolog2/test_monolog_log_level_filter_invalid.php index d2eac9410..22107fd98 100644 --- a/tests/integration/logging/monolog2/test_monolog_log_level_filter_invalid.php +++ b/tests/integration/logging/monolog2/test_monolog_log_level_filter_invalid.php @@ -61,7 +61,7 @@ [{"name": "Supportability/Logging/Forwarding/PHP/enabled"}, [1, "??", "??", "??", "??", "??"]], [{"name": "Supportability/Logging/Metrics/PHP/enabled"}, [1, "??", "??", "??", "??", "??"]], [{"name": "Supportability/Logging/PHP/Monolog/enabled"}, [1, "??", "??", "??", "??", "??"]], - [{"name": "Supportability/PHP/package/monolog/monolog/2/detected"}, [8, "??", "??", "??", "??", "??"]], + [{"name": "Supportability/PHP/package/monolog/monolog/2/detected"}, [1, "??", "??", "??", "??", "??"]], [{"name": "Supportability/library/Monolog/detected"}, [1, "??", "??", "??", "??", "??"]] ] ] @@ -172,4 +172,4 @@ function test_logging() { $logger->emergency("emergency"); } -test_logging(); \ No newline at end of file +test_logging(); diff --git a/tests/integration/logging/monolog3/test_monolog_basic.php b/tests/integration/logging/monolog3/test_monolog_basic.php index 5cbc3a1da..0e494b078 100644 --- a/tests/integration/logging/monolog3/test_monolog_basic.php +++ b/tests/integration/logging/monolog3/test_monolog_basic.php @@ -56,7 +56,7 @@ [{"name": "OtherTransactionTotalTime"}, [1, "??", "??", "??", "??", "??"]], [{"name": "OtherTransactionTotalTime/php__FILE__"}, [1, "??", "??", "??", "??", "??"]], [{"name": "Supportability/Logging/PHP/Monolog/enabled"}, [1, "??", "??", "??", "??", "??"]], - [{"name": "Supportability/PHP/package/monolog/monolog/3/detected"}, [8, "??", "??", "??", "??", "??"]], + [{"name": "Supportability/PHP/package/monolog/monolog/3/detected"}, [1, "??", "??", "??", "??", "??"]], [{"name": "Supportability/library/Monolog/detected"}, [1, "??", "??", "??", "??", "??"]], [{"name": "Supportability/Logging/LocalDecorating/PHP/disabled"}, [1, "??", "??", "??", "??", "??"]], [{"name": "Supportability/Logging/Forwarding/PHP/enabled"}, [1, "??", "??", "??", "??", "??"]], @@ -200,4 +200,4 @@ function test_logging() { $logger->emergency("emergency"); } -test_logging(); \ No newline at end of file +test_logging(); diff --git a/tests/integration/logging/monolog3/test_monolog_cat.php b/tests/integration/logging/monolog3/test_monolog_cat.php index dcf557213..12b0c76ae 100644 --- a/tests/integration/logging/monolog3/test_monolog_cat.php +++ b/tests/integration/logging/monolog3/test_monolog_cat.php @@ -56,7 +56,7 @@ [{"name": "OtherTransactionTotalTime"}, [1, "??", "??", "??", "??", "??"]], [{"name": "OtherTransactionTotalTime/php__FILE__"}, [1, "??", "??", "??", "??", "??"]], [{"name": "Supportability/Logging/PHP/Monolog/enabled"}, [1, "??", "??", "??", "??", "??"]], - [{"name": "Supportability/PHP/package/monolog/monolog/3/detected"}, [8, "??", "??", "??", "??", "??"]], + [{"name": "Supportability/PHP/package/monolog/monolog/3/detected"}, [1, "??", "??", "??", "??", "??"]], [{"name": "Supportability/library/Monolog/detected"}, [1, "??", "??", "??", "??", "??"]], [{"name": "Supportability/Logging/LocalDecorating/PHP/disabled"}, [1, "??", "??", "??", "??", "??"]], [{"name": "Supportability/Logging/Forwarding/PHP/enabled"}, [1, "??", "??", "??", "??", "??"]], @@ -184,4 +184,4 @@ function test_logging() { $logger->emergency("emergency"); } -test_logging(); \ No newline at end of file +test_logging(); diff --git a/tests/integration/logging/monolog3/test_monolog_context_simple.php b/tests/integration/logging/monolog3/test_monolog_context_simple.php index 1e77e6d25..ddcfd65f9 100644 --- a/tests/integration/logging/monolog3/test_monolog_context_simple.php +++ b/tests/integration/logging/monolog3/test_monolog_context_simple.php @@ -59,7 +59,7 @@ [{"name": "OtherTransactionTotalTime"}, [1, "??", "??", "??", "??", "??"]], [{"name": "OtherTransactionTotalTime/php__FILE__"}, [1, "??", "??", "??", "??", "??"]], [{"name": "Supportability/Logging/PHP/Monolog/enabled"}, [1, "??", "??", "??", "??", "??"]], - [{"name": "Supportability/PHP/package/monolog/monolog/3/detected"}, [8, "??", "??", "??", "??", "??"]], + [{"name": "Supportability/PHP/package/monolog/monolog/3/detected"}, [1, "??", "??", "??", "??", "??"]], [{"name": "Supportability/library/Monolog/detected"}, [1, "??", "??", "??", "??", "??"]], [{"name": "Supportability/Logging/LocalDecorating/PHP/disabled"}, [1, "??", "??", "??", "??", "??"]], [{"name": "Supportability/Logging/Forwarding/PHP/enabled"}, [1, "??", "??", "??", "??", "??"]], diff --git a/tests/integration/logging/monolog3/test_monolog_decoration_and_forwarding.php b/tests/integration/logging/monolog3/test_monolog_decoration_and_forwarding.php index fa0bbb6cb..3d8edcc7c 100644 --- a/tests/integration/logging/monolog3/test_monolog_decoration_and_forwarding.php +++ b/tests/integration/logging/monolog3/test_monolog_decoration_and_forwarding.php @@ -113,7 +113,7 @@ [{"name": "OtherTransactionTotalTime/php__FILE__"}, [1, "??", "??", "??", "??", "??"]], [{"name": "Supportability/api/get_linking_metadata"}, [16, "??", "??", "??", "??", "??"]], [{"name": "Supportability/Logging/PHP/Monolog/enabled"}, [1, "??", "??", "??", "??", "??"]], - [{"name": "Supportability/PHP/package/monolog/monolog/3/detected"}, [8, "??", "??", "??", "??", "??"]], + [{"name": "Supportability/PHP/package/monolog/monolog/3/detected"}, [1, "??", "??", "??", "??", "??"]], [{"name": "Supportability/library/Monolog/detected"}, [1, "??", "??", "??", "??", "??"]], [{"name": "Supportability/Logging/LocalDecorating/PHP/enabled"}, [1, "??", "??", "??", "??", "??"]], [{"name": "Supportability/Logging/Forwarding/PHP/enabled"}, [1, "??", "??", "??", "??", "??"]], @@ -257,4 +257,4 @@ function test_logging() { $logger->emergency("emergency"); } -test_logging(); \ No newline at end of file +test_logging(); diff --git a/tests/integration/logging/monolog3/test_monolog_disable_metrics.php b/tests/integration/logging/monolog3/test_monolog_disable_metrics.php index cb5beb8e1..11bad2177 100644 --- a/tests/integration/logging/monolog3/test_monolog_disable_metrics.php +++ b/tests/integration/logging/monolog3/test_monolog_disable_metrics.php @@ -51,7 +51,7 @@ [{"name": "OtherTransactionTotalTime"}, [1, "??", "??", "??", "??", "??"]], [{"name": "OtherTransactionTotalTime/php__FILE__"}, [1, "??", "??", "??", "??", "??"]], [{"name": "Supportability/Logging/PHP/Monolog/enabled"}, [1, "??", "??", "??", "??", "??"]], - [{"name": "Supportability/PHP/package/monolog/monolog/3/detected"}, [8, "??", "??", "??", "??", "??"]], + [{"name": "Supportability/PHP/package/monolog/monolog/3/detected"}, [1, "??", "??", "??", "??", "??"]], [{"name": "Supportability/library/Monolog/detected"}, [1, "??", "??", "??", "??", "??"]], [{"name": "Supportability/Logging/LocalDecorating/PHP/disabled"}, [1, "??", "??", "??", "??", "??"]], [{"name": "Supportability/Logging/Forwarding/PHP/enabled"}, [1, "??", "??", "??", "??", "??"]], @@ -153,4 +153,4 @@ function test_logging() { $logger->emergency("emergency"); } -test_logging(); \ No newline at end of file +test_logging(); diff --git a/tests/integration/logging/monolog3/test_monolog_drop_empty.php b/tests/integration/logging/monolog3/test_monolog_drop_empty.php index 61937fb9f..6a470653b 100644 --- a/tests/integration/logging/monolog3/test_monolog_drop_empty.php +++ b/tests/integration/logging/monolog3/test_monolog_drop_empty.php @@ -57,7 +57,7 @@ [{"name": "OtherTransactionTotalTime"}, [1, "??", "??", "??", "??", "??"]], [{"name": "OtherTransactionTotalTime/php__FILE__"}, [1, "??", "??", "??", "??", "??"]], [{"name": "Supportability/Logging/PHP/Monolog/enabled"}, [1, "??", "??", "??", "??", "??"]], - [{"name": "Supportability/PHP/package/monolog/monolog/3/detected"}, [8, "??", "??", "??", "??", "??"]], + [{"name": "Supportability/PHP/package/monolog/monolog/3/detected"}, [1, "??", "??", "??", "??", "??"]], [{"name": "Supportability/library/Monolog/detected"}, [1, "??", "??", "??", "??", "??"]], [{"name": "Supportability/Logging/LocalDecorating/PHP/disabled"}, [1, "??", "??", "??", "??", "??"]], [{"name": "Supportability/Logging/Forwarding/PHP/enabled"}, [1, "??", "??", "??", "??", "??"]], @@ -171,4 +171,4 @@ function test_logging() { $logger->emergency("emergency"); } -test_logging(); \ No newline at end of file +test_logging(); diff --git a/tests/integration/logging/monolog3/test_monolog_large_message_limit.php b/tests/integration/logging/monolog3/test_monolog_large_message_limit.php index 191800f49..50b2a26a5 100644 --- a/tests/integration/logging/monolog3/test_monolog_large_message_limit.php +++ b/tests/integration/logging/monolog3/test_monolog_large_message_limit.php @@ -40,7 +40,7 @@ [{"name": "OtherTransactionTotalTime"}, [1, "??", "??", "??", "??", "??"]], [{"name": "OtherTransactionTotalTime/php__FILE__"}, [1, "??", "??", "??", "??", "??"]], [{"name": "Supportability/Logging/PHP/Monolog/enabled"}, [1, "??", "??", "??", "??", "??"]], - [{"name": "Supportability/PHP/package/monolog/monolog/3/detected"}, [833, "??", "??", "??", "??", "??"]], + [{"name": "Supportability/PHP/package/monolog/monolog/3/detected"}, [1, "??", "??", "??", "??", "??"]], [{"name": "Supportability/library/Monolog/detected"}, [1, "??", "??", "??", "??", "??"]], [{"name": "Supportability/Logging/LocalDecorating/PHP/disabled"}, [1, "??", "??", "??", "??", "??"]], [{"name": "Supportability/Logging/Forwarding/PHP/enabled"}, [1, "??", "??", "??", "??", "??"]], @@ -78,4 +78,4 @@ function test_logging() { } } -test_logging(); \ No newline at end of file +test_logging(); diff --git a/tests/integration/logging/monolog3/test_monolog_large_message_limit_drops.php b/tests/integration/logging/monolog3/test_monolog_large_message_limit_drops.php index eed9a410a..c2913419d 100644 --- a/tests/integration/logging/monolog3/test_monolog_large_message_limit_drops.php +++ b/tests/integration/logging/monolog3/test_monolog_large_message_limit_drops.php @@ -40,7 +40,7 @@ [{"name": "OtherTransactionTotalTime"}, [1, "??", "??", "??", "??", "??"]], [{"name": "OtherTransactionTotalTime/php__FILE__"}, [1, "??", "??", "??", "??", "??"]], [{"name": "Supportability/Logging/PHP/Monolog/enabled"}, [1, "??", "??", "??", "??", "??"]], - [{"name": "Supportability/PHP/package/monolog/monolog/3/detected"}, [1666, "??", "??", "??", "??", "??"]], + [{"name": "Supportability/PHP/package/monolog/monolog/3/detected"}, [1, "??", "??", "??", "??", "??"]], [{"name": "Supportability/library/Monolog/detected"}, [1, "??", "??", "??", "??", "??"]], [{"name": "Supportability/Logging/LocalDecorating/PHP/disabled"}, [1, "??", "??", "??", "??", "??"]], [{"name": "Supportability/Logging/Forwarding/PHP/enabled"}, [1, "??", "??", "??", "??", "??"]], @@ -78,4 +78,4 @@ function test_logging() { } } -test_logging(); \ No newline at end of file +test_logging(); diff --git a/tests/integration/logging/monolog3/test_monolog_limit_log_events.php b/tests/integration/logging/monolog3/test_monolog_limit_log_events.php index b1f72e6b6..b5ffaf258 100644 --- a/tests/integration/logging/monolog3/test_monolog_limit_log_events.php +++ b/tests/integration/logging/monolog3/test_monolog_limit_log_events.php @@ -58,7 +58,7 @@ [{"name": "OtherTransactionTotalTime"}, [1, "??", "??", "??", "??", "??"]], [{"name": "OtherTransactionTotalTime/php__FILE__"}, [1, "??", "??", "??", "??", "??"]], [{"name": "Supportability/Logging/PHP/Monolog/enabled"}, [1, "??", "??", "??", "??", "??"]], - [{"name": "Supportability/PHP/package/monolog/monolog/3/detected"}, [8, "??", "??", "??", "??", "??"]], + [{"name": "Supportability/PHP/package/monolog/monolog/3/detected"}, [1, "??", "??", "??", "??", "??"]], [{"name": "Supportability/library/Monolog/detected"}, [1, "??", "??", "??", "??", "??"]], [{"name": "Supportability/Logging/LocalDecorating/PHP/disabled"}, [1, "??", "??", "??", "??", "??"]], [{"name": "Supportability/Logging/Forwarding/PHP/enabled"}, [1, "??", "??", "??", "??", "??"]], @@ -161,4 +161,4 @@ function test_logging() { $logger->emergency("emergency"); } -test_logging(); \ No newline at end of file +test_logging(); diff --git a/tests/integration/logging/monolog3/test_monolog_limit_zero_events.php b/tests/integration/logging/monolog3/test_monolog_limit_zero_events.php index 38abfe890..4b65d64f3 100644 --- a/tests/integration/logging/monolog3/test_monolog_limit_zero_events.php +++ b/tests/integration/logging/monolog3/test_monolog_limit_zero_events.php @@ -58,7 +58,7 @@ [{"name": "OtherTransactionTotalTime"}, [1, "??", "??", "??", "??", "??"]], [{"name": "OtherTransactionTotalTime/php__FILE__"}, [1, "??", "??", "??", "??", "??"]], [{"name": "Supportability/Logging/PHP/Monolog/enabled"}, [1, "??", "??", "??", "??", "??"]], - [{"name": "Supportability/PHP/package/monolog/monolog/3/detected"}, [8, "??", "??", "??", "??", "??"]], + [{"name": "Supportability/PHP/package/monolog/monolog/3/detected"}, [1, "??", "??", "??", "??", "??"]], [{"name": "Supportability/library/Monolog/detected"}, [1, "??", "??", "??", "??", "??"]], [{"name": "Supportability/Logging/LocalDecorating/PHP/disabled"}, [1, "??", "??", "??", "??", "??"]], [{"name": "Supportability/Logging/Forwarding/PHP/enabled"}, [1, "??", "??", "??", "??", "??"]], @@ -101,4 +101,4 @@ function test_logging() { $logger->emergency("emergency"); } -test_logging(); \ No newline at end of file +test_logging(); diff --git a/tests/integration/logging/monolog3/test_monolog_log_events_max_samples_stored_invalid1.php b/tests/integration/logging/monolog3/test_monolog_log_events_max_samples_stored_invalid1.php index f33d832af..f94ea94af 100644 --- a/tests/integration/logging/monolog3/test_monolog_log_events_max_samples_stored_invalid1.php +++ b/tests/integration/logging/monolog3/test_monolog_log_events_max_samples_stored_invalid1.php @@ -45,7 +45,7 @@ [{"name": "Supportability/Logging/Metrics/PHP/enabled"}, [1, "??", "??", "??", "??", "??"]], [{"name": "Supportability/Logging/LocalDecorating/PHP/disabled"}, [1, "??", "??", "??", "??", "??"]], [{"name": "Supportability/Logging/PHP/Monolog/enabled"}, [1, "??", "??", "??", "??", "??"]], - [{"name": "Supportability/PHP/package/monolog/monolog/3/detected"}, [833, "??", "??", "??", "??", "??"]], + [{"name": "Supportability/PHP/package/monolog/monolog/3/detected"}, [1, "??", "??", "??", "??", "??"]], [{"name": "Supportability/library/Monolog/detected"}, [1, "??", "??", "??", "??", "??"]] ] ] @@ -81,4 +81,4 @@ function test_logging() { } -test_logging(); \ No newline at end of file +test_logging(); diff --git a/tests/integration/logging/monolog3/test_monolog_log_events_max_samples_stored_invalid2.php b/tests/integration/logging/monolog3/test_monolog_log_events_max_samples_stored_invalid2.php index 73c70e58e..5d0363243 100644 --- a/tests/integration/logging/monolog3/test_monolog_log_events_max_samples_stored_invalid2.php +++ b/tests/integration/logging/monolog3/test_monolog_log_events_max_samples_stored_invalid2.php @@ -45,7 +45,7 @@ [{"name": "Supportability/Logging/Forwarding/PHP/enabled"}, [1, "??", "??", "??", "??", "??"]], [{"name": "Supportability/Logging/Metrics/PHP/enabled"}, [1, "??", "??", "??", "??", "??"]], [{"name": "Supportability/Logging/PHP/Monolog/enabled"}, [1, "??", "??", "??", "??", "??"]], - [{"name": "Supportability/PHP/package/monolog/monolog/3/detected"}, [833, "??", "??", "??", "??", "??"]], + [{"name": "Supportability/PHP/package/monolog/monolog/3/detected"}, [1, "??", "??", "??", "??", "??"]], [{"name": "Supportability/library/Monolog/detected"}, [1, "??", "??", "??", "??", "??"]] ] ] @@ -81,4 +81,4 @@ function test_logging() { } -test_logging(); \ No newline at end of file +test_logging(); diff --git a/tests/integration/logging/monolog3/test_monolog_log_events_max_samples_stored_invalid3.php b/tests/integration/logging/monolog3/test_monolog_log_events_max_samples_stored_invalid3.php index 72ca4b06b..8b451bdea 100644 --- a/tests/integration/logging/monolog3/test_monolog_log_events_max_samples_stored_invalid3.php +++ b/tests/integration/logging/monolog3/test_monolog_log_events_max_samples_stored_invalid3.php @@ -45,7 +45,7 @@ [{"name": "Supportability/Logging/Forwarding/PHP/enabled"}, [1, "??", "??", "??", "??", "??"]], [{"name": "Supportability/Logging/Metrics/PHP/enabled"}, [1, "??", "??", "??", "??", "??"]], [{"name": "Supportability/Logging/PHP/Monolog/enabled"}, [1, "??", "??", "??", "??", "??"]], - [{"name": "Supportability/PHP/package/monolog/monolog/3/detected"}, [833, "??", "??", "??", "??", "??"]], + [{"name": "Supportability/PHP/package/monolog/monolog/3/detected"}, [1, "??", "??", "??", "??", "??"]], [{"name": "Supportability/library/Monolog/detected"}, [1, "??", "??", "??", "??", "??"]] ] ] @@ -81,4 +81,4 @@ function test_logging() { } -test_logging(); \ No newline at end of file +test_logging(); diff --git a/tests/integration/logging/monolog3/test_monolog_log_events_max_samples_stored_invalid4.php b/tests/integration/logging/monolog3/test_monolog_log_events_max_samples_stored_invalid4.php index 2f60d6bc1..fe4185197 100644 --- a/tests/integration/logging/monolog3/test_monolog_log_events_max_samples_stored_invalid4.php +++ b/tests/integration/logging/monolog3/test_monolog_log_events_max_samples_stored_invalid4.php @@ -45,7 +45,7 @@ [{"name": "Supportability/Logging/Forwarding/PHP/enabled"}, [1, "??", "??", "??", "??", "??"]], [{"name": "Supportability/Logging/Metrics/PHP/enabled"}, [1, "??", "??", "??", "??", "??"]], [{"name": "Supportability/Logging/PHP/Monolog/enabled"}, [1, "??", "??", "??", "??", "??"]], - [{"name": "Supportability/PHP/package/monolog/monolog/3/detected"}, [833, "??", "??", "??", "??", "??"]], + [{"name": "Supportability/PHP/package/monolog/monolog/3/detected"}, [1, "??", "??", "??", "??", "??"]], [{"name": "Supportability/library/Monolog/detected"}, [1, "??", "??", "??", "??", "??"]] ] ] @@ -81,4 +81,4 @@ function test_logging() { } -test_logging(); \ No newline at end of file +test_logging(); diff --git a/tests/integration/logging/monolog3/test_monolog_log_level_filter.php b/tests/integration/logging/monolog3/test_monolog_log_level_filter.php index 529ef1459..69d482e9b 100644 --- a/tests/integration/logging/monolog3/test_monolog_log_level_filter.php +++ b/tests/integration/logging/monolog3/test_monolog_log_level_filter.php @@ -60,7 +60,7 @@ [{"name": "Supportability/Logging/Forwarding/PHP/enabled"}, [1, "??", "??", "??", "??", "??"]], [{"name": "Supportability/Logging/Metrics/PHP/enabled"}, [1, "??", "??", "??", "??", "??"]], [{"name": "Supportability/Logging/PHP/Monolog/enabled"}, [1, "??", "??", "??", "??", "??"]], - [{"name": "Supportability/PHP/package/monolog/monolog/3/detected"}, [8, "??", "??", "??", "??", "??"]], + [{"name": "Supportability/PHP/package/monolog/monolog/3/detected"}, [1, "??", "??", "??", "??", "??"]], [{"name": "Supportability/library/Monolog/detected"}, [1, "??", "??", "??", "??", "??"]] ] ] @@ -171,4 +171,4 @@ function test_logging() { $logger->emergency("emergency"); } -test_logging(); \ No newline at end of file +test_logging(); diff --git a/tests/integration/logging/monolog3/test_monolog_log_level_filter_invalid.php b/tests/integration/logging/monolog3/test_monolog_log_level_filter_invalid.php index e5387616f..649cd5acf 100644 --- a/tests/integration/logging/monolog3/test_monolog_log_level_filter_invalid.php +++ b/tests/integration/logging/monolog3/test_monolog_log_level_filter_invalid.php @@ -61,7 +61,7 @@ [{"name": "Supportability/Logging/Forwarding/PHP/enabled"}, [1, "??", "??", "??", "??", "??"]], [{"name": "Supportability/Logging/Metrics/PHP/enabled"}, [1, "??", "??", "??", "??", "??"]], [{"name": "Supportability/Logging/PHP/Monolog/enabled"}, [1, "??", "??", "??", "??", "??"]], - [{"name": "Supportability/PHP/package/monolog/monolog/3/detected"}, [8, "??", "??", "??", "??", "??"]], + [{"name": "Supportability/PHP/package/monolog/monolog/3/detected"}, [1, "??", "??", "??", "??", "??"]], [{"name": "Supportability/library/Monolog/detected"}, [1, "??", "??", "??", "??", "??"]] ] ] @@ -172,4 +172,4 @@ function test_logging() { $logger->emergency("emergency"); } -test_logging(); \ No newline at end of file +test_logging();