diff --git a/.gitignore b/.gitignore index 9a1580543..52967292b 100644 --- a/.gitignore +++ b/.gitignore @@ -2,7 +2,7 @@ agent/configure.ac agent/newrelic.map agent/*.dep -axiom/tests +axiom/tests/*.tmp bin/ pkg/ diff --git a/Makefile b/Makefile index 582cf7cbb..d97b94a42 100644 --- a/Makefile +++ b/Makefile @@ -187,32 +187,32 @@ DAEMON_TARGETS := $(addprefix bin/,client daemon integration_runner stressor) .PHONY: daemon daemon: go-minimum-version daemon-protobuf Makefile | bin/ @rm -rf $(DAEMON_TARGETS) - $(GO) install $(GOFLAGS) ./... + @$(GO) install $(GOFLAGS) ./... # The -race flag enables the inegrated Go race detector. Output to stderr .PHONY: daemon_race daemon_race: go-minimum-version daemon-protobuf Makefile | bin/ @rm -rf $(DAEMON_TARGETS) - $(GO) install -race $(GOFLAGS) ./... + @$(GO) install -race $(GOFLAGS) ./... .PHONY: daemon_test daemon_test: go-minimum-version daemon-protobuf - $(GO) test $(GOFLAGS) ./... + @$(GO) test $(GOFLAGS) ./... .PHONY: daemon_bench daemon_bench: go-minimum-version daemon-protobuf - $(GO) test $(GOFLAGS) -bench=. ./... + @$(GO) test $(GOFLAGS) -bench=. ./... .PHONY: daemon_integration daemon_integration: go-minimum-version daemon-protobuf $(MAKE) INTEGRATION_TAGS=1 go-minimum-version - $(GO) test $(GOFLAGS) ./... + @$(GO) test $(GOFLAGS) ./... DAEMON_COV_FILE = daemon_coverage.out .PHONY: daemon_cover daemon_cover: go-minimum-version daemon-protobuf @rm -f $(DAEMON_COV_FILE) - $(GO) test -coverprofile=$(DAEMON_COV_FILE) $(GOFLAGS) ./... + @$(GO) test -coverprofile=$(DAEMON_COV_FILE) $(GOFLAGS) ./... $(GO) tool cover -html=$(DAEMON_COV_FILE) @rm -f $(DAEMON_COV_FILE) diff --git a/VERSION b/VERSION index 139aee8bf..2b42764c6 100644 --- a/VERSION +++ b/VERSION @@ -1 +1 @@ -9.20.0 +9.21.0 diff --git a/agent/Makefile.frag b/agent/Makefile.frag index 81e909637..0980d7573 100644 --- a/agent/Makefile.frag +++ b/agent/Makefile.frag @@ -74,7 +74,8 @@ TEST_BINARIES = \ tests/test_api_datastore \ tests/test_api_distributed_trace \ tests/test_api_internal \ - tests/test_api_metadata \ + tests/test_api_metadata_dt_enabled \ + tests/test_api_metadata_dt_disabled \ tests/test_call \ tests/test_curl \ tests/test_curl_md \ diff --git a/agent/fw_laravel.c b/agent/fw_laravel.c index 210994646..925b72a55 100644 --- a/agent/fw_laravel.c +++ b/agent/fw_laravel.c @@ -348,34 +348,35 @@ static void nr_laravel_name_transaction(zval* router, zval* request TSRMLS_DC) { route_name_zv = nr_php_call(route, "getName"); if (nr_php_is_zval_valid_string(route_name_zv)) { const char generated_prefix[] = "generated::"; - nr_string_len_t generated_prefix_len - = sizeof(generated_prefix) - 1; + nr_string_len_t generated_prefix_len = sizeof(generated_prefix) - 1; - if (nr_strncmp(generated_prefix, Z_STRVAL_P(route_name_zv), generated_prefix_len) != 0) { - char* route_name - = nr_strndup(Z_STRVAL_P(route_name_zv), Z_STRLEN_P(route_name_zv)); + if (nr_strncmp(generated_prefix, Z_STRVAL_P(route_name_zv), + generated_prefix_len) + != 0) { + char* route_name = nr_strndup(Z_STRVAL_P(route_name_zv), + Z_STRLEN_P(route_name_zv)); nrl_debug(NRL_FRAMEWORK, "%s: using Route::getName() for transaction naming", __func__); - nr_txn_set_path("Laravel", NRPRG(txn), route_name, NR_PATH_TYPE_ACTION, - NR_OK_TO_OVERWRITE); + nr_txn_set_path("Laravel", NRPRG(txn), route_name, + NR_PATH_TYPE_ACTION, NR_OK_TO_OVERWRITE); nr_php_zval_free(&route_name_zv); nr_free(route_name); goto leave; } else { - nrl_verbosedebug( - NRL_FRAMEWORK, - "%s: Route::getName() returned a randomly generated route name, skipping. ", - __func__); - nr_php_zval_free(&route_name_zv); + nrl_verbosedebug(NRL_FRAMEWORK, + "%s: Route::getName() returned a randomly generated " + "route name, skipping. ", + __func__); + nr_php_zval_free(&route_name_zv); } } else { - nrl_verbosedebug( - NRL_FRAMEWORK, - "%s: Route::getName() returned an unexpected value/type, skipping. ", - __func__); + nrl_verbosedebug(NRL_FRAMEWORK, + "%s: Route::getName() returned an unexpected " + "value/type, skipping. ", + __func__); nr_php_zval_free(&route_name_zv); } } @@ -1201,7 +1202,6 @@ void nr_laravel_enable(TSRMLS_D) { nr_php_wrap_user_function( NR_PSTR("Illuminate\\Routing\\RouteCollection::getRouteForMethods"), nr_laravel_routes_get_route_for_methods TSRMLS_CC); - /* * Listen for Artisan commands so we can name those appropriately. */ diff --git a/agent/newrelic-install.sh b/agent/newrelic-install.sh index 890ff8e82..3af52b5e7 100755 --- a/agent/newrelic-install.sh +++ b/agent/newrelic-install.sh @@ -122,7 +122,7 @@ error() { ostype= if [ -f /etc/redhat-release -o -f /etc/redhat_version ]; then ostype=rhel -elif [ -d /etc/dpkg ]; then +elif [ -f /etc/os-release ] && grep -q -i 'Debian' /etc/os-release; then ostype=debian elif [ -f /etc/alpine-release ] || [ -d /etc/apk ]; then ostype=alpine @@ -135,10 +135,10 @@ fi if [ -z "${ostype}" ]; then tus=`uname -s 2> /dev/null` case "${tus}" in - [Dd][Aa][Rr][Ww][Ii][Nn]) ostype=darwin ;; + [Dd][Aa][Rr][Ww][Ii][Nn]) ostype=unsupported_os ;; [Ff][Rr][Ee][Ee][Bb][Ss][Dd]) ostype=freebsd ;; - [Ss][Uu][Nn][Oo][Ss]) ostype=solaris ;; - [Ss][Mm][Aa][Rr][Tt][Oo][Ss]) ostype=solaris ;; + [Ss][Uu][Nn][Oo][Ss]) ostype=unsupported_os ;; + [Ss][Mm][Aa][Rr][Tt][Oo][Ss]) ostype=unsupported_os ;; esac fi : ${ostype:=generic} @@ -221,6 +221,7 @@ arch=`(uname -m) 2> /dev/null` || arch="unknown" os=`(uname -s) 2> /dev/null` || os="unknown" case "${arch}" in + aarch64 | arm64) arch=aarch64 ;; i[3456789]86) arch=x86 ;; *64* | *amd*) arch=x64 ;; i86pc) @@ -237,13 +238,30 @@ case "${arch}" in unknown) arch=x86 ;; esac -case "${os}" in - [dD]arwin* ) os="darwin"; arch="x86_64" ;; - *) ;; -esac - +# allow override of detected arch [ "${NR_INSTALL_ARCH}" = "x86" -o "${NR_INSTALL_ARCH}" = "x64" -o "${NR_INSTALL_ARCH}" = "x86_64" ] && arch="${NR_INSTALL_ARCH}" +# exit if arch is unsupported +if [ "${arch}" != "x86" -a "${arch}" != "x64" ]; then + error "An unsupported architecture "${arch}" detected." + + if [ "${arch}" = "aarch64" ]; then + cat << EOF + +In order to use the New Relic PHP Agent on the "aarch64" (also known as "ARM64") +architecture it is necessary to build the agent extension from sources. + +Instructions on how to build the agent are available here: + +https://docs.newrelic.com/docs/apm/agents/php-agent/installation/php-agent-installation-arm64/ + +EOF + fi + + echo "The install will now exit." + exit 1 +fi + # # Do some sanity checking. ilibdir should contain the daemon, the agents and # the init scripts. Ensure that is the case. @@ -1093,6 +1111,14 @@ Ignoring this particular instance of PHP. pi_arch="${arch}" fi + # Check if this is a supported arch + # Should be caught on startup but add check here to be sure + if [ "${pi_arch}" != "x86" -a "${pi_arch}" != "x64" ]; then + error "An unsupported architecture "${pi_arch}" detected." + echo "The install will now exit." + exit 1 + fi + # This handles both 32-bit on 64-bit systems and 32-bit only systems if [ "${pi_arch}" = "x86" -a "${pi_php8}" = "yes" ]; then error "unsupported 32-bit version '${pi_ver}' of PHP found at: diff --git a/agent/php_execute.c b/agent/php_execute.c index 3c99640af..c68fcd3b0 100644 --- a/agent/php_execute.c +++ b/agent/php_execute.c @@ -373,8 +373,11 @@ static const nr_framework_table_t all_frameworks[] = { NR_FW_LARAVEL}, /* 5.0.15-5.0.x */ {"Laravel", "laravel", "bootstrap/cache/compiled.php", 0, nr_laravel_enable, NR_FW_LARAVEL}, /* 5.1.0-x */ + {"Laravel", "laravel", "bootstrap/app.php", 0, nr_laravel_enable, + NR_FW_LARAVEL}, /* 8+ */ - {"Lumen", "lumen", "lumen-framework/src/helpers.php", 0, nr_lumen_enable, NR_FW_LUMEN}, + {"Lumen", "lumen", "lumen-framework/src/helpers.php", 0, nr_lumen_enable, + NR_FW_LUMEN}, {"Magento", "magento", "app/mage.php", 0, nr_magento1_enable, NR_FW_MAGENTO1}, @@ -1072,8 +1075,7 @@ static inline void nr_php_execute_segment_end( duration = nr_time_duration(stacked->start_time, stacked->stop_time); if (create_metric || (duration >= NR_PHP_PROCESS_GLOBALS(expensive_min)) - || nr_vector_size(stacked->metrics) || stacked->id - || stacked->attributes + || nr_vector_size(stacked->metrics) || stacked->id || stacked->attributes || stacked->error) { nr_segment_t* s = nr_php_stacked_segment_move_to_heap(stacked TSRMLS_CC); nr_php_execute_segment_add_metric(s, metadata, create_metric); diff --git a/agent/php_globals.h b/agent/php_globals.h index 6b6113e99..a4ff24ceb 100644 --- a/agent/php_globals.h +++ b/agent/php_globals.h @@ -42,7 +42,14 @@ typedef struct _nrphpglobals_t { mode */ int daemon_special_integration; /* Cause daemon to dump special log entries to help integration testing. */ - int zend_offset; /* Zend extension offset */ +#if ZEND_MODULE_API_NO >= ZEND_8_1_X_API_NO /* PHP 8.1+ */ + zend_long zend_offset; /* Zend extension offset */ + zend_long + zend_op_array_offset; /* Zend extension op_array to modify reserved */ +#else + int zend_offset; /* Zend extension offset */ + int zend_op_array_offset; /* Zend extension op_array to modify reserved */ +#endif int done_instrumentation; /* Set to true if we have installed instrumentation handlers */ nrtime_t expensive_min; /* newrelic.special.expensive_node_min */ diff --git a/agent/php_newrelic.h b/agent/php_newrelic.h index f4a13e3e9..827fd21d0 100644 --- a/agent/php_newrelic.h +++ b/agent/php_newrelic.h @@ -336,7 +336,8 @@ nrinitime_t ep_threshold; /* newrelic.transaction_tracer.explain_threshold */ nrinitime_t ss_threshold; /* newrelic.transaction_tracer.stack_trace_threshold */ nrinibool_t - cross_process_enabled; /* newrelic.cross_application_tracer.enabled */ + cross_process_enabled; /* DEPRECATED + newrelic.cross_application_tracer.enabled */ nriniuint_t max_nesting_level; /* newrelic.special.max_nesting_level (named after like-used variable in xdebug) */ @@ -444,8 +445,9 @@ nrinibool_t nrinibool_t distributed_tracing_exclude_newrelic_header; /* newrelic.distributed_tracing_exclude_newrelic_header */ -nrinibool_t span_events_enabled; /* newrelic.span_events_enabled */ -nriniuint_t max_span_events; /* newrelic.special.max_span_events */ +nrinibool_t span_events_enabled; /* newrelic.span_events_enabled */ +nriniuint_t span_events_max_samples_stored; /* newrelic.span_events.max_samples_stored + */ nrinistr_t trace_observer_host; /* newrelic.infinite_tracing.trace_observer.host */ nriniuint_t @@ -453,8 +455,7 @@ nriniuint_t nriniuint_t span_queue_size; /* newrelic.infinite_tracing.span_events.queue_size */ nriniuint_t - agent_span_queue_size; /* newrelic.infinite_tracing.span_events.agent_queue.size - */ + agent_span_queue_size; /* newrelic.infinite_tracing.span_events.agent_queue.size*/ nrinitime_t agent_span_queue_timeout; /* newrelic.infinite_tracing.span_events.agent_queue.timeout */ diff --git a/agent/php_nrini.c b/agent/php_nrini.c index 6e054f9d4..5d2f5c180 100644 --- a/agent/php_nrini.c +++ b/agent/php_nrini.c @@ -107,7 +107,7 @@ * (stage == ZEND_INI_STAGE_STARTUP) * * Case 2: php not invoked with -dvar=value - * 1: the value comes from the newrelic.ini file (stage == + * 1: the value comes from the newrelic.ini file (stage == * ZEND_INI_STAGE_STARTUP) (minit time) * * Case 3: newrelic.ini file present, but the value is commented out @@ -407,19 +407,19 @@ static PHP_INI_DISP(nr_framework_dh) { * char *new_value * uint new_value_length * void *mh_arg1 the offset into the blob of data holding all ini - * values - * void *mh_arg2 the blob of data holding all ini values + * values + * void *mh_arg2 the blob of data holding all ini values * void *mh_arg3 unused for our purposes int stage taken from the set - * shown below + * shown below * TSRMLS_DC * * On PHP 7, the arguments are similar, but with PHP 7 appropriate changes for * the string and thread safety: * zend_ini_entry *entry * zend_string *new_value - * void *mh_arg1 the offset into the blob of data holding all ini - * values - * void *mh_arg2 the blob of data holding all ini values + * void *mh_arg1 the offset into the blob of data holding all ini + * values + * void *mh_arg2 the blob of data holding all ini values * void *mh_arg3 unused for our purposes int stage taken from the set * shown below * @@ -1213,6 +1213,44 @@ static PHP_INI_MH(nr_boolean_mh) { return SUCCESS; } +static PHP_INI_MH(nr_cat_enabled_mh) { + nrinibool_t* p; + int val = 0; + +#ifndef ZTS + char* base = (char*)mh_arg2; +#else + char* base = (char*)ts_resource(*((int*)mh_arg2)); +#endif + + p = (nrinibool_t*)(base + (size_t)mh_arg1); + + (void)entry; + (void)mh_arg3; + (void)NEW_VALUE_LEN; + NR_UNUSED_TSRMLS; + + p->where = 0; + + val = nr_bool_from_str(NEW_VALUE); + + if (-1 == val) { + return FAILURE; + } + + if (0 != val) { + nrl_warning(NRL_INIT, + "Cross Application Training (CAT) has been enabled. " + "Note that CAT has been deprecated and will be removed " + "in a future release."); + } + + p->value = (zend_bool)val; + p->where = stage; + + return SUCCESS; +} + static PHP_INI_MH(nr_tt_detail_mh) { nriniuint_t* p; int val = 1; @@ -1303,6 +1341,44 @@ static PHP_INI_MH(nr_tt_max_segments_web_mh) { return SUCCESS; } +static PHP_INI_MH(nr_span_events_max_samples_stored_mh) { + nriniuint_t* p; + int val = NR_DEFAULT_SPAN_EVENTS_MAX_SAMPLES_STORED; + +#ifndef ZTS + char* base = (char*)mh_arg2; +#else + char* base = (char*)ts_resource(*((int*)mh_arg2)); +#endif + + p = (nriniuint_t*)(base + (size_t)mh_arg1); + + (void)entry; + (void)mh_arg3; + NR_UNUSED_TSRMLS; + + /* Anything other than a valid value will result in the + * default value of NR_DEFAULT_SPAN_EVENTS_MAX_SAMPLES_STORED. + */ + + p->where = 0; + + if (0 != NEW_VALUE_LEN) { + val = (int)strtol(NEW_VALUE, 0, 0); + if ((0 >= val) || (NR_MAX_SPAN_EVENTS_MAX_SAMPLES_STORED < val)) { + val = NR_DEFAULT_SPAN_EVENTS_MAX_SAMPLES_STORED; + nrl_debug(NRL_INIT, + "Invalid span_event.max_samples_stored value \"%.8s\"; using " + "%d instead", + NEW_VALUE, val); + } + } + p->value = (zend_uint)val; + p->where = stage; + + return SUCCESS; +} + static PHP_INI_MH(nr_span_queue_size_mh) { nriniuint_t* p; int val = 1; @@ -1771,13 +1847,13 @@ PHP_INI_ENTRY_EX("newrelic.daemon.loglevel", 0) PHP_INI_ENTRY_EX( "newrelic.daemon.port", - NR_PHP_INI_DEFAULT_PORT, /* port and address share the same default */ + NR_PHP_INI_DEFAULT_PORT, /* port and address share the same default */ NR_PHP_SYSTEM, nr_daemon_port_mh, 0) PHP_INI_ENTRY_EX( "newrelic.daemon.address", - NR_PHP_INI_DEFAULT_PORT, /* port and address share the same default */ + NR_PHP_INI_DEFAULT_PORT, /* port and address share the same default */ NR_PHP_SYSTEM, nr_daemon_address_mh, 0) @@ -1980,10 +2056,11 @@ STD_PHP_INI_ENTRY_EX("newrelic.framework", zend_newrelic_globals, newrelic_globals, nr_framework_dh) +/* DEPRECATED */ STD_PHP_INI_ENTRY_EX("newrelic.cross_application_tracer.enabled", - "1", + "0", NR_PHP_REQUEST, - nr_boolean_mh, + nr_cat_enabled_mh, cross_process_enabled, zend_newrelic_globals, newrelic_globals, @@ -2547,7 +2624,7 @@ STD_PHP_INI_ENTRY_EX("newrelic.custom_parameters_enabled", * functions */ STD_PHP_INI_ENTRY_EX("newrelic.distributed_tracing_enabled", - "0", + "1", NR_PHP_REQUEST, nr_boolean_mh, distributed_tracing_enabled, @@ -2586,11 +2663,11 @@ STD_PHP_INI_ENTRY_EX("newrelic.span_events_enabled", newrelic_globals, 0) -STD_PHP_INI_ENTRY_EX("newrelic.special.max_span_events", - "0", +STD_PHP_INI_ENTRY_EX("newrelic.span_events.max_samples_stored", + NR_STR2(NR_DEFAULT_SPAN_EVENTS_MAX_SAMPLES_STORED), NR_PHP_REQUEST, - nr_unsigned_int_mh, - max_span_events, + nr_span_events_max_samples_stored_mh, + span_events_max_samples_stored, zend_newrelic_globals, newrelic_globals, 0) @@ -2854,11 +2931,10 @@ void zm_info_newrelic(void); /* ctags landing pad only */ PHP_MINFO_FUNCTION(newrelic) { php_info_print_table_start(); php_info_print_table_header(2, "New Relic RPM Monitoring", - NR_PHP_PROCESS_GLOBALS(enabled) - ? "enabled" - : NR_PHP_PROCESS_GLOBALS(mpm_bad) - ? "disabled due to threaded MPM" - : "disabled"); + NR_PHP_PROCESS_GLOBALS(enabled) ? "enabled" + : NR_PHP_PROCESS_GLOBALS(mpm_bad) + ? "disabled due to threaded MPM" + : "disabled"); php_info_print_table_row(2, "New Relic Version", nr_version_verbose()); php_info_print_table_end(); @@ -2918,7 +2994,7 @@ static int nr_ini_settings(zend_ini_entry* ini_entry, == nr_strncmp(PHP_INI_ENTRY_NAME(ini_entry), NR_PSTR("newrelic.distributed_tracing_enabled")))) { /* - * The collector requires that the value of + * The collector requires that the value of * newrelic.browser_monitoring.debug is a bool, so we must convert it * here. * diff --git a/agent/php_txn.c b/agent/php_txn.c index 575977af1..e35630d61 100644 --- a/agent/php_txn.c +++ b/agent/php_txn.c @@ -546,7 +546,7 @@ bool nr_php_txn_is_policy_secure(const char* policy_name, } if (0 == strcmp("allow_raw_exception_messages", policy_name)) { - /* + /* * allow_raw_exception_messages is considered insecure when * the private newrelic.allow_raw_exception_messages ini value is 1. */ @@ -554,7 +554,7 @@ bool nr_php_txn_is_policy_secure(const char* policy_name, } if (0 == strcmp("custom_events", policy_name)) { - /* + /* * custom_events is considered insecure when the * newrelic.custom_events_enabled ini value is 1. */ @@ -562,7 +562,7 @@ bool nr_php_txn_is_policy_secure(const char* policy_name, } if (0 == strcmp("custom_parameters", policy_name)) { - /* + /* * custom_parameters is considered insecure when the * newrelic.custom_parameters_enabled ini value is 1. */ @@ -581,7 +581,7 @@ nrobj_t* nr_php_txn_get_supported_security_policy_settings(nrtxnopt_t* opts) { int i; int count_supported_policy_names; - /* + /* * The policies we support. Non supported policies are omitted to save * space on the wire (vs. sending them with support/enabled of 0. */ @@ -682,7 +682,7 @@ nr_status_t nr_php_txn_begin(const char* appnames, opts.distributed_tracing_exclude_newrelic_header = NRINI(distributed_tracing_exclude_newrelic_header); opts.span_events_enabled = NRINI(span_events_enabled); - opts.max_span_events = NRINI(max_span_events); + opts.span_events_max_samples_stored = NRINI(span_events_max_samples_stored); opts.max_segments = is_cli ? NRINI(tt_max_segments_cli) : NRINI(tt_max_segments_web); opts.span_queue_batch_size = NRINI(agent_span_queue_size); @@ -720,6 +720,7 @@ nr_status_t nr_php_txn_begin(const char* appnames, info.trace_observer_host = nr_strdup(NRINI(trace_observer_host)); info.trace_observer_port = NRINI(trace_observer_port); info.span_queue_size = NRINI(span_queue_size); + info.span_events_max_samples_stored = NRINI(span_events_max_samples_stored); NRPRG(app) = nr_agent_find_or_add_app( nr_agent_applist, &info, @@ -847,10 +848,17 @@ nr_status_t nr_php_txn_begin(const char* appnames, "to use distributed tracing"); } +#if ZEND_MODULE_API_NO >= ZEND_8_1_X_API_NO + if (nr_php_ini_setting_is_set_by_user("opcache.enable") + && NR_PHP_PROCESS_GLOBALS(preload_framework_library_detection)) { + nr_php_user_instrumentation_from_opcache(TSRMLS_C); + } +#else if (nr_php_ini_setting_is_set_by_user("opcache.preload") && NR_PHP_PROCESS_GLOBALS(preload_framework_library_detection)) { nr_php_user_instrumentation_from_opcache(TSRMLS_C); } +#endif return NR_SUCCESS; } @@ -868,9 +876,9 @@ static int nr_php_txn_should_ignore(int ignoretxn TSRMLS_DC) { return ignoretxn; } -/* +/* * Actually shutdown, without checking if we should ignore or if the txn is - * NULL. + * NULL. */ static void nr_php_txn_do_shutdown(nrtxn_t* txn TSRMLS_DC) { char* request_uri; diff --git a/agent/php_vm.c b/agent/php_vm.c index 19f4bb215..948658ac0 100644 --- a/agent/php_vm.c +++ b/agent/php_vm.c @@ -88,6 +88,7 @@ static int nr_php_handle_cufa_fcall(zend_execute_data* execute_data) { nr_php_opcode_handler_entry_t prev_handler; const zend_op* prev_opline; + nrl_verbosedebug(NRL_AGENT, "%s: cannot get function from call", __func__); /* * We should have execute_data (and there isn't a realistic case where we * wouldn't other than memory corruption), so if we don't, we should bail as diff --git a/agent/scripts/newrelic.ini.private.template b/agent/scripts/newrelic.ini.private.template index b638a16f0..07c69e567 100644 --- a/agent/scripts/newrelic.ini.private.template +++ b/agent/scripts/newrelic.ini.private.template @@ -128,15 +128,6 @@ ; ;newrelic.special.enable_extension_instrumentation = false -; Setting: newrelic.special.max_span_events -; Type : unsigned integer -; Scope : per-directory -; Default: 0 -; Info : The maximum number of span events added to the span event reservoir -; per transaction. A value of 0 will use the agent default. -; -;newrelic.special.max_span_events = 0 - ; Setting: newrelic.browser_monitoring.debug ; Type : boolean ; Scope : per-directory diff --git a/agent/scripts/newrelic.ini.template b/agent/scripts/newrelic.ini.template index 1865b34f4..b0b127c58 100644 --- a/agent/scripts/newrelic.ini.template +++ b/agent/scripts/newrelic.ini.template @@ -856,22 +856,24 @@ newrelic.daemon.logfile = "/var/log/newrelic/newrelic-daemon.log" ; Setting: newrelic.cross_application_tracer.enabled ; Type : boolean ; Scope : per-directory -; Default: true +; Default: false ; Info : Enables or disables support for Cross Application Tracing, aka "CAT". +; NOTE: As of April 2022 CAT has been deprecated and will be removed at a future date. ; -;newrelic.cross_application_tracer.enabled = true +;newrelic.cross_application_tracer.enabled = false ; Setting: newrelic.distributed_tracing_enabled ; Type : boolean ; Scope : per-directory -; Default: false +; Default: true ; Info : Distributed tracing lets you see the path that a request takes -; through your distributed system. Enabling distributed tracing changes -; the behavior of some New Relic features, so carefully consult the -; transition guide before you enable this feature: +; through your distributed system. See this guide for more information: +; https://docs.newrelic.com/docs/distributed-tracing/concepts/introduction-distributed-tracing +; When distributed tracing is enabled it changes the behavior of some +; New Relic features. See this guide for details: ; https://docs.newrelic.com/docs/transition-guide-distributed-tracing ; -;newrelic.distributed_tracing_enabled = false +;newrelic.distributed_tracing_enabled = true ; Setting: newrelic.distributed_tracing_exclude_newrelic_header ; Type : boolean @@ -898,6 +900,17 @@ newrelic.daemon.logfile = "/var/log/newrelic/newrelic-daemon.log" ; ;newrelic.span_events_enabled = true +; Setting: newrelic.span_events.max_samples_stored +; Type : unsigned integer +; Scope : per-directory +; Default: 2000 +; Info : The maximum number of span events added to the span event reservoir +; per transaction. A value of 0 will use the agent default. The max +; setting is 10000. +; +;newrelic.span_events.max_samples_stored = 0 + + ; Setting: newrelic.infinite_tracing.trace_observer.host ; Type : string ; Scope : per-directory diff --git a/agent/tests/test_api_metadata.c b/agent/tests/test_api_metadata_dt_disabled.c similarity index 88% rename from agent/tests/test_api_metadata.c rename to agent/tests/test_api_metadata_dt_disabled.c index 3a033ab83..33003be35 100644 --- a/agent/tests/test_api_metadata.c +++ b/agent/tests/test_api_metadata_dt_disabled.c @@ -29,7 +29,7 @@ static void test_is_sampled(TSRMLS_D) { tlib_php_request_end(); } -static void test_get_linking_metadata(TSRMLS_D) { +static void test_get_linking_metadata_when_dt_disabled(TSRMLS_D) { zval* retval; zval* val; @@ -67,7 +67,7 @@ static void test_get_linking_metadata(TSRMLS_D) { tlib_php_request_end(); } -static void test_get_trace_metadata(TSRMLS_D) { +static void test_get_trace_metadata_when_dt_disabled(TSRMLS_D) { zval* retval; tlib_php_request_start(); @@ -90,11 +90,12 @@ void test_main(void* p NRUNUSED) { void*** tsrm_ls = NULL; #endif /* ZTS && !PHP7 */ - tlib_php_engine_create("" PTSRMLS_CC); + tlib_php_engine_create( + "newrelic.distributed_tracing_enabled = false\n" PTSRMLS_CC); test_is_sampled(TSRMLS_C); - test_get_linking_metadata(TSRMLS_C); - test_get_trace_metadata(TSRMLS_C); + test_get_linking_metadata_when_dt_disabled(TSRMLS_C); + test_get_trace_metadata_when_dt_disabled(TSRMLS_C); tlib_php_engine_destroy(TSRMLS_C); } diff --git a/agent/tests/test_api_metadata_dt_enabled.c b/agent/tests/test_api_metadata_dt_enabled.c new file mode 100644 index 000000000..218387c55 --- /dev/null +++ b/agent/tests/test_api_metadata_dt_enabled.c @@ -0,0 +1,103 @@ +/* + * Copyright 2020 New Relic Corporation. All rights reserved. + * SPDX-License-Identifier: Apache-2.0 + * + * This file contains basic sanity checks for trace and entity metadata API + * calls: newrelic_get_trace_metadata() newrelic_get_linking_metadata() + * newrelic_is_sampled() + */ + +#include "tlib_php.h" + +#include "php_agent.h" +#include "php_api.h" +#include "php_hash.h" + +tlib_parallel_info_t parallel_info + = {.suggested_nthreads = -1, .state_size = 0}; + +static void test_is_sampled(TSRMLS_D) { + zval* retval; + + tlib_php_request_start(); + + retval = nr_php_call(NULL, "newrelic_is_sampled"); + tlib_pass_if_zval_is_bool_value("newrelic_is_sampled() returns a bool ", 0, + retval); + + nr_php_zval_free(&retval); + tlib_php_request_end(); +} + +static void test_get_linking_metadata_when_dt_enabled(TSRMLS_D) { + zval* retval; + zval* val; + + tlib_php_request_start(); + + retval = nr_php_call(NULL, "newrelic_get_linking_metadata"); + + tlib_pass_if_zval_type_is("newrelic_get_linking_metadata() returns an array ", + IS_ARRAY, retval); + + val = nr_php_zend_hash_find(Z_ARRVAL_P(retval), "entity.type"); + tlib_pass_if_not_null("entity.name", val); + tlib_pass_if_zval_type_is("entity.type", IS_STRING, val); + tlib_pass_if_str_equal("entity.type", Z_STRVAL_P(val), "SERVICE"); + + val = nr_php_zend_hash_find(Z_ARRVAL_P(retval), "entity.name"); + tlib_pass_if_not_null("entity.name", val); + tlib_pass_if_zval_type_is("entity.name", IS_STRING, val); + + val = nr_php_zend_hash_find(Z_ARRVAL_P(retval), "hostname"); + tlib_pass_if_not_null("hostname", val); + tlib_pass_if_zval_type_is("hostname", IS_STRING, val); + + val = nr_php_zend_hash_find(Z_ARRVAL_P(retval), "trace.id"); + tlib_pass_if_not_null("trace.id", val); + tlib_pass_if_zval_type_is("trace.id is string", IS_STRING, val); + + val = nr_php_zend_hash_find(Z_ARRVAL_P(retval), "span.id"); + tlib_pass_if_null("span.id", val); + + nr_php_zval_free(&retval); + + tlib_php_request_end(); +} + +static void test_get_trace_metadata_when_dt_enabled(TSRMLS_D) { + zval* retval; + + tlib_php_request_start(); + + retval = nr_php_call(NULL, "newrelic_get_trace_metadata"); + + tlib_pass_if_zval_type_is("newrelic_get_trace_metadata() returns an array ", + IS_ARRAY, retval); + + tlib_pass_if_size_t_equal("trace metadata present", 1, + nr_php_zend_hash_num_elements(Z_ARRVAL_P(retval))); + + zval* val = nr_php_zend_hash_find(Z_ARRVAL_P(retval), "trace_id"); + tlib_pass_if_not_null("trace_id present", val); + tlib_pass_if_zval_type_is("trace_id is string", IS_STRING, val); + + nr_php_zval_free(&retval); + + tlib_php_request_end(); +} + +void test_main(void* p NRUNUSED) { +#if defined(ZTS) && !defined(PHP7) + void*** tsrm_ls = NULL; +#endif /* ZTS && !PHP7 */ + + + tlib_php_engine_create("newrelic.distributed_tracing_enabled = true\n" PTSRMLS_CC); + + test_is_sampled(TSRMLS_C); + test_get_linking_metadata_when_dt_enabled(TSRMLS_C); + test_get_trace_metadata_when_dt_enabled(TSRMLS_C); + + tlib_php_engine_destroy(TSRMLS_C); +} diff --git a/axiom/cmd_appinfo_transmit.c b/axiom/cmd_appinfo_transmit.c index a0c3578ab..f7fcee73b 100644 --- a/axiom/cmd_appinfo_transmit.c +++ b/axiom/cmd_appinfo_transmit.c @@ -153,6 +153,8 @@ nr_flatbuffer_t* nr_appinfo_create_query(const char* agent_run_id, nr_flatbuffers_object_begin(fb, APP_NUM_FIELDS); nr_flatbuffers_object_prepend_u64(fb, APP_SPAN_QUEUE_SIZE, info->span_queue_size, 0); + nr_flatbuffers_object_prepend_u64(fb, APP_SPAN_EVENTS_MAX_SAMPLES_STORED, + info->span_events_max_samples_stored, 0); nr_flatbuffers_object_prepend_u16(fb, APP_TRACE_OBSERVER_PORT, info->trace_observer_port, 0); nr_flatbuffers_object_prepend_uoffset(fb, APP_TRACE_OBSERVER_HOST, @@ -369,7 +371,7 @@ nr_status_t nr_cmd_appinfo_process_reply(const uint8_t* data, */ nr_cmd_appinfo_process_event_harvest_config( nro_get_hash_hash(app->connect_reply, "event_harvest_config", NULL), - &app->limits); + &app->limits, app->info); /* * Finally, handle the harvest timing information. @@ -380,7 +382,8 @@ nr_status_t nr_cmd_appinfo_process_reply(const uint8_t* data, } void nr_cmd_appinfo_process_event_harvest_config(const nrobj_t* config, - nr_app_limits_t* app_limits) { + nr_app_limits_t* app_limits, + nr_app_info_t info) { const nrobj_t* harvest_limits = nro_get_hash_hash(config, "harvest_limits", NULL); @@ -396,7 +399,10 @@ void nr_cmd_appinfo_process_event_harvest_config(const nrobj_t* config, app_limits->error_events = nr_cmd_appinfo_process_get_harvest_limit( harvest_limits, "error_event_data", NR_MAX_ERRORS); app_limits->span_events = nr_cmd_appinfo_process_get_harvest_limit( - harvest_limits, "span_event_data", NR_MAX_SPAN_EVENTS); + harvest_limits, "span_event_data", + 0 == info.span_events_max_samples_stored + ? NR_MAX_SPAN_EVENTS_MAX_SAMPLES_STORED + : info.span_events_max_samples_stored); } int nr_cmd_appinfo_process_get_harvest_limit(const nrobj_t* limits, diff --git a/axiom/nr_app.c b/axiom/nr_app.c index 1bc418c25..f59b32955 100644 --- a/axiom/nr_app.c +++ b/axiom/nr_app.c @@ -272,6 +272,8 @@ static nrapp_t* create_new_app(const nr_app_info_t* info) { app->info.trace_observer_host = nr_strdup(info->trace_observer_host); app->info.trace_observer_port = info->trace_observer_port; app->info.span_queue_size = info->span_queue_size; + app->info.span_events_max_samples_stored + = info->span_events_max_samples_stored; app->rnd = nr_random_create(); nr_random_seed_from_time(app->rnd); diff --git a/axiom/nr_app.h b/axiom/nr_app.h index 52205c1ac..aa4bceaf9 100644 --- a/axiom/nr_app.h +++ b/axiom/nr_app.h @@ -74,6 +74,8 @@ typedef struct _nr_app_info_t { char* trace_observer_host; /* 8T trace observer host */ uint16_t trace_observer_port; /* 8T trace observer port */ uint64_t span_queue_size; /* 8T span queue size (for the daemon) */ + uint64_t span_events_max_samples_stored; /* maximum number of spans (for the + daemon) */ } nr_app_info_t; /* @@ -115,7 +117,8 @@ typedef struct _nrapp_t { nr_app_harvest_t harvest; /* Harvest timing and sampling data */ /* The limits are set based on the event harvest configuration provided in - * the connect reply. They do not reflect any agent side configuration. */ + * the connect reply. They do not reflect any agent side configuration. + * The exception is the span_event which is negotiated with the backend. */ nr_app_limits_t limits; } nrapp_t; diff --git a/axiom/nr_commands_private.h b/axiom/nr_commands_private.h index bb423add8..4bda179d6 100644 --- a/axiom/nr_commands_private.h +++ b/axiom/nr_commands_private.h @@ -79,7 +79,8 @@ enum { APP_TRACE_OBSERVER_HOST = 13, APP_TRACE_OBSERVER_PORT = 14, APP_SPAN_QUEUE_SIZE = 15, - APP_NUM_FIELDS = 16, + APP_SPAN_EVENTS_MAX_SAMPLES_STORED = 16, + APP_NUM_FIELDS = 17, }; /* Generated from: table AppReply */ @@ -186,7 +187,8 @@ extern void nr_cmd_appinfo_process_harvest_timing(nr_flatbuffers_table_t* reply, extern void nr_cmd_appinfo_process_event_harvest_config( const nrobj_t* config, - nr_app_limits_t* app_limits); + nr_app_limits_t* app_limits, + nr_app_info_t info); extern int nr_cmd_appinfo_process_get_harvest_limit(const nrobj_t* limits, const char* key, diff --git a/axiom/nr_limits.h b/axiom/nr_limits.h index 85e8ec11b..c00f851bd 100644 --- a/axiom/nr_limits.h +++ b/axiom/nr_limits.h @@ -33,9 +33,14 @@ #define NR_MAX_SEGMENTS 2000 /* - * The maximum number of span events in a transaction. + * The default maximum number of span events in a transaction. */ -#define NR_MAX_SPAN_EVENTS 1000 +#define NR_DEFAULT_SPAN_EVENTS_MAX_SAMPLES_STORED 2000 + +/* + * The absolute maximum number of span events in a transaction. + */ +#define NR_MAX_SPAN_EVENTS_MAX_SAMPLES_STORED 10000 /* * The maximum number of span events in an 8T span batch. diff --git a/axiom/nr_txn.c b/axiom/nr_txn.c index 2efff3fd3..cdfd61efc 100644 --- a/axiom/nr_txn.c +++ b/axiom/nr_txn.c @@ -1423,11 +1423,14 @@ void nr_txn_end(nrtxn_t* txn) { /* * Finalise the segment tree. */ - txn->final_data = nr_segment_tree_finalise(txn, NR_MAX_SEGMENTS, - (0 != txn->options.max_span_events) - ? txn->options.max_span_events - : NR_MAX_SPAN_EVENTS, - nr_txn_handle_total_time, NULL); + txn->final_data = nr_segment_tree_finalise( + txn, NR_MAX_SEGMENTS, + ((0 < txn->options.span_events_max_samples_stored) + && (NR_MAX_SPAN_EVENTS_MAX_SAMPLES_STORED + >= txn->options.span_events_max_samples_stored)) + ? txn->options.span_events_max_samples_stored + : NR_DEFAULT_SPAN_EVENTS_MAX_SAMPLES_STORED, + nr_txn_handle_total_time, NULL); } bool nr_txn_set_timing(nrtxn_t* txn, nrtime_t start, nrtime_t duration) { diff --git a/axiom/nr_txn.h b/axiom/nr_txn.h index ec6cd0794..bea06f606 100644 --- a/axiom/nr_txn.h +++ b/axiom/nr_txn.h @@ -78,7 +78,8 @@ typedef struct _nrtxnopt_t { int tt_is_apdex_f; /* tt_threshold is 4 * apdex_t */ nrtime_t ep_threshold; /* Explain Plan threshold in usec */ nrtime_t ss_threshold; /* Slow SQL stack threshold in usec */ - int cross_process_enabled; /* Whether or not to read and modify headers */ + int cross_process_enabled; /* DEPRECATED Whether or not to read and modify + headers */ int allow_raw_exception_messages; /* Whether to replace the error/exception messages with generic text */ int custom_parameters_enabled; /* Whether to allow recording of custom @@ -93,9 +94,12 @@ typedef struct _nrtxnopt_t { W3C trace context headers */ int span_events_enabled; /* Whether span events are enabled */ - size_t max_span_events; /* The maximum number of span events per transaction. - When set to 0, the app harvest's span event limit - is used. */ + size_t + span_events_max_samples_stored; /* The maximum number of span events per + transaction. When set to 0, the default + event limit + NR_DEFAULT_SPAN_EVENTS_MAX_SAMPLES_STORED + is used. */ size_t max_segments; /* The maximum number of segments that are kept in the segment tree at a time. When set to 0 or 1, no maximum is applied. */ diff --git a/axiom/nr_version.c b/axiom/nr_version.c index 911afda41..a82aec670 100644 --- a/axiom/nr_version.c +++ b/axiom/nr_version.c @@ -28,8 +28,9 @@ * xigua 21Apr2021 (9.17) * yam 23Aug2021 (9.18) * zomp 02Mar2022 (9.19) + * allium 14Mar2022 (9.20) */ -#define NR_CODENAME "allium" +#define NR_CODENAME "buttercup" const char* nr_version(void) { return NR_STR2(NR_VERSION); diff --git a/axiom/tests/test_app_helpers.h b/axiom/tests/test_app_helpers.h index 0754cc463..a6709cdd8 100644 --- a/axiom/tests/test_app_helpers.h +++ b/axiom/tests/test_app_helpers.h @@ -17,7 +17,7 @@ static inline nr_app_limits_t default_app_limits(void) { .analytics_events = NR_MAX_ANALYTIC_EVENTS, .custom_events = NR_MAX_CUSTOM_EVENTS, .error_events = NR_MAX_ERRORS, - .span_events = NR_MAX_SPAN_EVENTS, + .span_events = NR_DEFAULT_SPAN_EVENTS_MAX_SAMPLES_STORED, }; } diff --git a/axiom/tests/test_cmd_appinfo.c b/axiom/tests/test_cmd_appinfo.c index b3b898707..004110fc2 100644 --- a/axiom/tests/test_cmd_appinfo.c +++ b/axiom/tests/test_cmd_appinfo.c @@ -66,6 +66,10 @@ static void test_create_empty_query(void) { tlib_pass_if_uint64_t_equal( __func__, 0, nr_flatbuffers_table_read_u64(&app, APP_SPAN_QUEUE_SIZE, 0)); + tlib_pass_if_uint64_t_equal(__func__, 0, + nr_flatbuffers_table_read_u64( + &app, APP_SPAN_EVENTS_MAX_SAMPLES_STORED, 0)); + nr_flatbuffers_destroy(&query); } @@ -91,6 +95,7 @@ static void test_create_query(void) { info.trace_observer_host = nr_strdup("my_trace_observer"); info.trace_observer_port = 443; info.span_queue_size = 10000; + info.span_events_max_samples_stored = 1234; query = nr_appinfo_create_query("12345", "this_host", &info); @@ -138,6 +143,9 @@ static void test_create_query(void) { tlib_pass_if_uint64_t_equal( __func__, info.span_queue_size, nr_flatbuffers_table_read_u16(&app, APP_SPAN_QUEUE_SIZE, 0)); + tlib_pass_if_uint64_t_equal(__func__, info.span_events_max_samples_stored, + nr_flatbuffers_table_read_u16( + &app, APP_SPAN_EVENTS_MAX_SAMPLES_STORED, 0)); high_security = nr_flatbuffers_table_read_i8(&app, APP_FIELD_HIGH_SECURITY, 0); @@ -632,13 +640,15 @@ static void test_process_connected_app(void) { * 2. custom_events_limit is 0 because the field is present and set to 0. * 3. error_events_limit is 100 because the field is present but invalid, * as it is null, so the default value is used. - * 4. span_events_limit is 1000 because the field is omitted, so the default - * value is used. + * 4. span_events_limit is 10000 because the field is omitted, so the max + * value from the backend is assumed unless the value has been configured + * locally. */ tlib_pass_if_int_equal(__func__, 833, app.limits.analytics_events); tlib_pass_if_int_equal(__func__, 0, app.limits.custom_events); tlib_pass_if_int_equal(__func__, NR_MAX_ERRORS, app.limits.error_events); - tlib_pass_if_int_equal(__func__, NR_MAX_SPAN_EVENTS, app.limits.span_events); + tlib_pass_if_int_equal(__func__, NR_MAX_SPAN_EVENTS_MAX_SAMPLES_STORED, + app.limits.span_events); /* * Perform same test again to make sure that populated fields are freed @@ -940,33 +950,39 @@ static void test_process_event_harvest_config(void) { "}" "}"); + nr_app_info_t info; + info.span_events_max_samples_stored + = NR_DEFAULT_SPAN_EVENTS_MAX_SAMPLES_STORED; + app_limits = app_limits_all_zero; - nr_cmd_appinfo_process_event_harvest_config(NULL, &app_limits); + nr_cmd_appinfo_process_event_harvest_config(NULL, &app_limits, info); tlib_pass_if_bytes_equal("a NULL config should enable all event types", &app_limits_all_default, sizeof(nr_app_limits_t), &app_limits, sizeof(nr_app_limits_t)); app_limits = app_limits_all_zero; - nr_cmd_appinfo_process_event_harvest_config(array, &app_limits); + nr_cmd_appinfo_process_event_harvest_config(array, &app_limits, info); tlib_pass_if_bytes_equal("an invalid config should enable all event types", &app_limits_all_default, sizeof(nr_app_limits_t), &app_limits, sizeof(nr_app_limits_t)); app_limits = app_limits_all_zero; - nr_cmd_appinfo_process_event_harvest_config(empty, &app_limits); + nr_cmd_appinfo_process_event_harvest_config(empty, &app_limits, info); tlib_pass_if_bytes_equal("an empty config should enable all event types", &app_limits_all_default, sizeof(nr_app_limits_t), &app_limits, sizeof(nr_app_limits_t)); app_limits = app_limits_all_zero; - nr_cmd_appinfo_process_event_harvest_config(limits_disabled, &app_limits); + nr_cmd_appinfo_process_event_harvest_config(limits_disabled, &app_limits, + info); tlib_pass_if_bytes_equal( "a config with all types disabled should disable all event types", &app_limits_all_zero, sizeof(nr_app_limits_t), &app_limits, sizeof(nr_app_limits_t)); app_limits = app_limits_all_zero; - nr_cmd_appinfo_process_event_harvest_config(limits_enabled, &app_limits); + nr_cmd_appinfo_process_event_harvest_config(limits_enabled, &app_limits, + info); tlib_pass_if_bytes_equal( "a config with all types enabled should enable all event types", &app_limits_all_enabled, sizeof(nr_app_limits_t), &app_limits, diff --git a/axiom/tests/test_cmd_txndata.c b/axiom/tests/test_cmd_txndata.c index 96dd3f53f..3ac8ddde3 100644 --- a/axiom/tests/test_cmd_txndata.c +++ b/axiom/tests/test_cmd_txndata.c @@ -825,8 +825,9 @@ static void test_encode_trace(void) { root->stop_time = duration; nr_segment_end(&root); - txn.final_data = nr_segment_tree_finalise(&txn, NR_MAX_SEGMENTS, - NR_MAX_SPAN_EVENTS, NULL, NULL); + txn.final_data = nr_segment_tree_finalise( + &txn, NR_MAX_SEGMENTS, NR_DEFAULT_SPAN_EVENTS_MAX_SAMPLES_STORED, NULL, + NULL); fb = nr_txndata_encode(&txn); nr_flatbuffers_table_init_root(&tbl, nr_flatbuffers_data(fb), nr_flatbuffers_len(fb)); diff --git a/axiom/tests/test_segment.c b/axiom/tests/test_segment.c index fcc2f2a68..eacc9891b 100644 --- a/axiom/tests/test_segment.c +++ b/axiom/tests/test_segment.c @@ -2324,7 +2324,7 @@ static void test_segment_ensure_id(void) { .state = NR_APP_OK, .limits = { .analytics_events = NR_MAX_ANALYTIC_EVENTS, - .span_events = NR_MAX_SPAN_EVENTS, + .span_events = NR_DEFAULT_SPAN_EVENTS_MAX_SAMPLES_STORED, }, }; nrtxnopt_t opts; @@ -2493,7 +2493,7 @@ static void test_segment_to_span_event(void) { .state = NR_APP_OK, .limits = { .analytics_events = NR_MAX_ANALYTIC_EVENTS, - .span_events = NR_MAX_SPAN_EVENTS, + .span_events = NR_DEFAULT_SPAN_EVENTS_MAX_SAMPLES_STORED, }, }; nrtxnopt_t opts; @@ -2859,7 +2859,7 @@ static void test_segment_record_exception(void) { .state = NR_APP_OK, .limits = { .analytics_events = NR_MAX_ANALYTIC_EVENTS, - .span_events = NR_MAX_SPAN_EVENTS, + .span_events = NR_DEFAULT_SPAN_EVENTS_MAX_SAMPLES_STORED, }, }; nrtxnopt_t opts; @@ -3199,4 +3199,4 @@ void test_main(void* p NRUNUSED) { test_segment_record_exception(); test_segment_attributes_user_add(); test_segment_attributes_user_txn_event_add(); -} \ No newline at end of file +} diff --git a/axiom/tests/test_segment_helpers.h b/axiom/tests/test_segment_helpers.h index 5ecc73655..06701c483 100644 --- a/axiom/tests/test_segment_helpers.h +++ b/axiom/tests/test_segment_helpers.h @@ -242,7 +242,7 @@ static NRUNUSED nrtxn_t* new_txn(int background) { .analytics_events = NR_MAX_ANALYTIC_EVENTS, .custom_events = NR_MAX_CUSTOM_EVENTS, .error_events = NR_MAX_ERRORS, - .span_events = NR_MAX_SPAN_EVENTS, + .span_events = NR_DEFAULT_SPAN_EVENTS_MAX_SAMPLES_STORED, }; txn = nr_txn_begin(&app, &nr_txn_test_options, 0); diff --git a/axiom/tests/test_txn.c b/axiom/tests/test_txn.c index 584afe5ce..92f785119 100644 --- a/axiom/tests/test_txn.c +++ b/axiom/tests/test_txn.c @@ -3951,9 +3951,9 @@ static void test_create_event(void) { NR_ATTRIBUTE_DESTINATION_ALL & ~NR_ATTRIBUTE_DESTINATION_TXN_EVENT, "NOPE", 2); - txn.final_data - = nr_segment_tree_finalise(&txn, NR_MAX_SEGMENTS, NR_MAX_SPAN_EVENTS, - nr_txn_handle_total_time, NULL); + txn.final_data = nr_segment_tree_finalise( + &txn, NR_MAX_SEGMENTS, NR_DEFAULT_SPAN_EVENTS_MAX_SAMPLES_STORED, + nr_txn_handle_total_time, NULL); event = nr_txn_to_event(0); tlib_pass_if_null("null txn", event); @@ -4124,7 +4124,8 @@ static void test_create_event_with_retimed_segments(void) { nr_segment_end(&seg); txn->final_data = nr_segment_tree_finalise( - txn, NR_MAX_SEGMENTS, NR_MAX_SPAN_EVENTS, nr_txn_handle_total_time, NULL); + txn, NR_MAX_SEGMENTS, NR_DEFAULT_SPAN_EVENTS_MAX_SAMPLES_STORED, + nr_txn_handle_total_time, NULL); event = nr_txn_to_event(txn); tlib_pass_if_str_equal("retimed segments", nr_analytics_event_json(event), @@ -4636,8 +4637,9 @@ static void test_txn_dt_cross_agent_testcase(nrapp_t* app, txn->segment_root->start_time = 1000; txn->segment_root->stop_time = 2000; txn->segment_count++; - txn->final_data = nr_segment_tree_finalise(txn, NR_MAX_SEGMENTS, - NR_MAX_SPAN_EVENTS, NULL, NULL); + txn->final_data = nr_segment_tree_finalise( + txn, NR_MAX_SEGMENTS, NR_DEFAULT_SPAN_EVENTS_MAX_SAMPLES_STORED, NULL, + NULL); /* * Intrinsics. @@ -4922,8 +4924,9 @@ static void test_txn_trace_context_cross_agent_testcase(nrapp_t* app, txn->segment_root->start_time = 1000; txn->segment_root->stop_time = 2000; txn->segment_count++; - txn->final_data = nr_segment_tree_finalise(txn, NR_MAX_SEGMENTS, - NR_MAX_SPAN_EVENTS, NULL, NULL); + txn->final_data = nr_segment_tree_finalise( + txn, NR_MAX_SEGMENTS, NR_DEFAULT_SPAN_EVENTS_MAX_SAMPLES_STORED, NULL, + NULL); /* * Intrinsics. @@ -5977,7 +5980,8 @@ static void test_accept_before_create_distributed_tracing(void) { txn.segment_slab = nr_slab_create(sizeof(nr_segment_t), 0); txn.segment_root = nr_segment_start(&txn, NULL, NULL); txn.unscoped_metrics = nrm_table_create(0); - txn.abs_start_time = (nrtime_t)1482959525577 * NR_TIME_DIVISOR_MS + expected_duration * NR_TIME_DIVISOR; + txn.abs_start_time = (nrtime_t)1482959525577 * NR_TIME_DIVISOR_MS + + expected_duration * NR_TIME_DIVISOR; /* * Test : Valid accept before create. @@ -6055,7 +6059,8 @@ static void test_txn_accept_distributed_trace_payload_metrics(void) { txn.options.distributed_tracing_enabled = true; txn.app_connect_reply = nro_create_from_json("{\"trusted_account_key\":\"9123\"}"); - txn.abs_start_time = (nrtime_t)1482959525577 * NR_TIME_DIVISOR_MS + expected_duration * NR_TIME_DIVISOR; + txn.abs_start_time = (nrtime_t)1482959525577 * NR_TIME_DIVISOR_MS + + expected_duration * NR_TIME_DIVISOR; /* * Test : Successful (web) @@ -6208,7 +6213,7 @@ static void test_txn_accept_distributed_trace_payload_w3c(void) { nrtime_t payload_timestamp_ms = 1529445826000; nrtime_t txn_timestamp_us = 15214458260000 * NR_TIME_DIVISOR_MS; nrtime_t delta_timestamp_us = nr_time_duration( - (payload_timestamp_ms * NR_TIME_DIVISOR_MS), txn_timestamp_us); + (payload_timestamp_ms * NR_TIME_DIVISOR_MS), txn_timestamp_us); char* traceparent; tlib_fail_if_int64_t_equal("Zero duration", 0, delta_timestamp_us); @@ -7931,7 +7936,7 @@ static void test_segment_record_error(void) { .state = NR_APP_OK, .limits = { .analytics_events = NR_MAX_ANALYTIC_EVENTS, - .span_events = NR_MAX_SPAN_EVENTS, + .span_events = NR_DEFAULT_SPAN_EVENTS_MAX_SAMPLES_STORED, }, }; nrtxnopt_t opts; diff --git a/docker-compose.yaml b/docker-compose.yaml index 43335a61e..410c33295 100644 --- a/docker-compose.yaml +++ b/docker-compose.yaml @@ -2,11 +2,11 @@ # Copyright 2021 New Relic Corporation. All rights reserved. # SPDX-License-Identifier: Apache-2.0 # -version: '3.7' +version: '3.8' services: # The Database mysqldb: - image: mysql:5.7 + image: mysql:5.6 restart: always environment: MYSQL_ROOT_PASSWORD: admin @@ -20,28 +20,60 @@ services: redisdb: build: context: . - dockerfile: files/Dockerfile.redis + dockerfile: files/Dockerfile.redis restart: always ports: - "6379:6379" container_name: redisdb + memcached: + image: memcached:latest + restart: always + ports: + - "11211:11211" + container_name: memcached +# mongodb: +# image: mongo:latest +# restart: always +# ports: +# - "27019:27019" + postgres: + image: postgres + restart: always + environment: + POSTGRES_PASSWORD: root + POSTGRES_USER: postgres + ports: + - "5432:5432" + container_name: postgres agent: build: context: . dockerfile: files/Dockerfile user: ${UID}:${GID} environment: + MEMCACHE_HOST: memcached + +# MONGO_HOST: mongodb + MYSQL_DB: database - MYSQL_USER: root + MYSQL_USER: admin MYSQL_PASSWD: admin MYSQL_HOST: mysqldb + + PG_HOST: postgres + PG_PORT: 5432 + PG_USER: postgres + PG_PW: root + + PREDIS_HOME: /usr/src/vendor/predis/predis/ REDIS_HOST: redisdb - PS1: "New Relic > " - NEWRELIC_COLLECTOR_HOST : ${NEWRELIC_COLLECTOR_HOST:-collector.newrelic.com} - NEWRELIC_LICENSE_KEY: ${NEWRELIC_LICENSE_KEY} + + PS1: "New Relic > " + NEWRELIC_COLLECTOR_HOST : ${NEW_RELIC_COLLECTOR_HOST:-collector.newrelic.com} + NEWRELIC_LICENSE_KEY: ${NEW_RELIC_LICENSE_KEY} volumes: - ${PWD}:/usr/src/myapp - working_dir: /usr/src/myapp + working_dir: /usr/src/myapp stdin_open: true tty: true container_name: agent diff --git a/files/Dockerfile b/files/Dockerfile index ac1e77c13..983115ccf 100644 --- a/files/Dockerfile +++ b/files/Dockerfile @@ -13,16 +13,6 @@ FROM php:${PHP_VER:-8.0} RUN docker-php-source extract -# -# The explain plan in the sql tests contain partition/filtered properties -# but the tests can't currently be updated to reflect that since the sql -# database on our CI doesn't include those values. -# RUN docker-php-ext-install pdo pdo_mysql -# - -RUN pecl install redis && docker-php-ext-enable redis - - # # Uncomment deb-src lines for all enabled repos. First part of single-quoted # string (up the the !) is the pattern of the lines that will be ignored. @@ -43,6 +33,10 @@ RUN apt-get update \ insserv procps vim ${PHP_USER_SPECIFIED_PACKAGES} \ zlib1g-dev libmcrypt-dev +# pgsql extension +RUN apt-get install -y libpq-dev +RUN docker-php-ext-install pgsql + # # Other tools # @@ -72,7 +66,7 @@ RUN apt-get update && apt-get install -y \ strace \ python-dev \ python-setuptools \ - python-yaml \ + python3-yaml \ sqlite3 \ libsqlite3-dev \ openssl \ @@ -105,6 +99,62 @@ RUN if [ -z "$(grep '^8\.' /etc/debian_version)" ]; then \ apt-get install -y argon2 libghc-argon2-dev; \ fi +# install composer +WORKDIR /usr/src +RUN php -r "copy('https://getcomposer.org/installer', 'composer-setup.php');" +RUN php -r "if (hash_file('sha384', 'composer-setup.php') === '906a84df04cea2aa72f40b5f787e49f22d4c2f19492ac310e8cba5b96ac8b64115ac402c8cd292b8a03482574915d1a8') { echo 'Installer verified'; } else { echo 'Installer corrupt'; unlink('composer-setup.php'); } echo PHP_EOL;" +RUN php composer-setup.php +RUN php -r "unlink('composer-setup.php');" + +# +# The explain plan in the sql tests contain partition/filtered properties +# but the tests can't currently be updated to reflect that since the sql +# database on our CI doesn't include those values. +# +# Further explanation: +# mysql tests are written to work with mysql 5.6 (or earlier?) server +# mysql server 5.7+ have additional columns (as mentioned above) which +# will cause the current mysql tests to fail. +# +# arm64 notes: +# mysql server 8.0 is currently the only version available for arm64 +# and 8.0 has problems with how the explanation for informational_schema +# work (refer to bug https://bugs.mysql.com/bug.php?id=102536) so to run +# the mysql tests a separate machine running mysql server 5.6 is required. +RUN docker-php-ext-install pdo pdo_mysql + +RUN docker-php-ext-install mysqli + +# redis +RUN pecl install redis && docker-php-ext-enable redis + +# memcache +RUN pecl install memcache && docker-php-ext-enable memcache + +# memcached +RUN apt-get install -y libmemcached-dev +RUN pecl install memcached && docker-php-ext-enable memcached + +# mongo? +# this extension is no longer maintained and doesn't work with +# recent PHP releases +#RUN pecl install mongo && docker-php-ext-enable mongo + +# mongodb - need tests written for this maintained mongo extension +#RUN pecl install mongodb && docker-php-ext-enable mongodb + +# uopz +RUN pecl install uopz && docker-php-ext-enable uopz + +# configure uopz to honor exit() and die() otherwise it just ignores these +RUN echo "uopz.exit=1" > /usr/local/etc/php/conf.d/uopz-enable-exit.ini + +# install predis +# installation will be in /usr/src/vendor/predis/predis +# which is value which should be used for PREDIS_HOME +RUN php composer.phar require "predis/predis" +RUN php composer.phar update + # # These args need to be repeated so we can propagate the VARS within this build context. # diff --git a/protocol/flatbuffers/protocol.fbs b/protocol/flatbuffers/protocol.fbs index 60776f7c8..49474c97b 100644 --- a/protocol/flatbuffers/protocol.fbs +++ b/protocol/flatbuffers/protocol.fbs @@ -15,22 +15,23 @@ namespace protocol; // table App { - license: string; - app_name: string; - agent_language: string; - agent_version: string; - high_security: bool; - redirect_collector: string; - environment: string; // pre-computed json - settings: string; // pre-computed json - labels: string; // pre-computed json - display_host: string; // added in the 5.1 PHP agent release - security_policy_token: string; // added in the 8.1 PHP agent release - supported_security_policies: string; // added for PHP agent release 8.1 - host: string; // added for PHP agent release 9.2 - trace_observer_host: string; // added for PHP agent release 9.11 - trace_observer_port: uint16; // added for PHP agent release 9.11 - span_queue_size: uint64; // added for PHP agent release 9.11 + license: string; + app_name: string; + agent_language: string; + agent_version: string; + high_security: bool; + redirect_collector: string; + environment: string; // pre-computed json + settings: string; // pre-computed json + labels: string; // pre-computed json + display_host: string; // added in the 5.1 PHP agent release + security_policy_token: string; // added in the 8.1 PHP agent release + supported_security_policies: string; // added for PHP agent release 8.1 + host: string; // added for PHP agent release 9.2 + trace_observer_host: string; // added for PHP agent release 9.11 + trace_observer_port: uint16; // added for PHP agent release 9.11 + span_queue_size: uint64; // added for PHP agent release 9.11 + span_events_max_samples_stored: uint64; // added for PHP agent release 9.21 } enum AppStatus : byte { Unknown = 0, Disconnected = 1, InvalidLicense = 2, diff --git a/src/flatbuffersdata/data.go b/src/flatbuffersdata/data.go index 6197bc4a2..a3ecfa3fd 100644 --- a/src/flatbuffersdata/data.go +++ b/src/flatbuffersdata/data.go @@ -46,9 +46,7 @@ func MarshalAppInfo(info *newrelic.AppInfo) ([]byte, error) { protocol.AppAddTraceObserverHost(buf, traceObserverHost) protocol.AppAddTraceObserverPort(buf, info.TraceObserverPort) - if info.HighSecurity { - protocol.AppAddHighSecurity(buf, 1) - } + protocol.AppAddHighSecurity(buf, info.HighSecurity) appInfo := protocol.AppEnd(buf) diff --git a/src/flatbuffersdata/data_test.go b/src/flatbuffersdata/data_test.go index 29afb25f8..23132ac84 100644 --- a/src/flatbuffersdata/data_test.go +++ b/src/flatbuffersdata/data_test.go @@ -25,7 +25,7 @@ func BenchmarkAggregateTxn(b *testing.B) { } ag := newrelic.FlatTxn(data) - harvest := newrelic.NewHarvest(time.Now(), collector.NewHarvestLimits()) + harvest := newrelic.NewHarvest(time.Now(), collector.NewHarvestLimits(nil)) // Add the metrics, so we are only doing lookups in the loop ag.AggregateInto(harvest) @@ -137,7 +137,7 @@ func TestFlatbuffersTxnData(t *testing.T) { if nil != err { t.Fatal(err) } - harvest := newrelic.NewHarvest(time.Now(), collector.NewHarvestLimits()) + harvest := newrelic.NewHarvest(time.Now(), collector.NewHarvestLimits(nil)) ag := newrelic.FlatTxn(data) ag.AggregateInto(harvest) id := newrelic.AgentRunID("12345") @@ -184,7 +184,7 @@ func TestFlatbuffersTxnData(t *testing.T) { } out, err = harvest.SpanEvents.Data(id, now) - if nil != err || string(out) != `["12345",{"reservoir_size":1000,"events_seen":3},[[{"Span1":1}],[{"Span2":2}],[{"Span3":3}]]]` { + if nil != err || string(out) != `["12345",{"reservoir_size":10000,"events_seen":3},[[{"Span1":1}],[{"Span2":2}],[{"Span3":3}]]]` { t.Fatal(err, string(out)) } diff --git a/src/integration_runner/main.go b/src/integration_runner/main.go index 332e780f8..6971462b0 100644 --- a/src/integration_runner/main.go +++ b/src/integration_runner/main.go @@ -170,6 +170,8 @@ func merge(a, b map[string]string) map[string]string { func catRequest(w http.ResponseWriter, r *http.Request) { catFile := r.URL.Query().Get("file") + dtEnabled := r.URL.Query().Get("dt_enabled"); + catEnabled := r.URL.Query().Get("cat_enabled"); if "" == catFile { http.Error(w, "cat failure: no file provided", http.StatusBadRequest) return @@ -178,6 +180,23 @@ func catRequest(w http.ResponseWriter, r *http.Request) { env := merge(ctx.Env, nil) settings := merge(ctx.Settings, nil) settings["newrelic.appname"] = "ignore" + if ("false" == dtEnabled) { + settings["newrelic.distributed_tracing_enabled"] = "false"; + } else if ("true" == dtEnabled) { + settings["newrelic.distributed_tracing_enabled"] = "true"; + } else { + http.Error(w, "cat request: invalid value of dt_enabled - expected 'true' or 'false', got '" + dtEnabled +"'.", http.StatusBadRequest) + return + } + + if ("false" == catEnabled) { + settings["newrelic.cross_application_tracer.enabled"] = "false"; + } else if ("true" == catEnabled) { + settings["newrelic.cross_application_tracer.enabled"] = "true"; + } else { + http.Error(w, "cat request: invalid value of cat_enabled - expected 'true' or 'false', got '" + catEnabled +"'.", http.StatusBadRequest) + return + } tx, err := integration.CgiTx(integration.ScriptFile(catFile), env, settings, r.Header, ctx) if nil != err { @@ -581,7 +600,7 @@ func (h *IntegrationDataHandler) IncomingTxnData(id newrelic.AgentRunID, sample harvest := h.harvests[string(id)] if nil == harvest { - harvest = newrelic.NewHarvest(time.Now(), collector.NewHarvestLimits()) + harvest = newrelic.NewHarvest(time.Now(), collector.NewHarvestLimits(nil)) // Save a little memory by reducing the event pools. harvest.TxnEvents = newrelic.NewTxnEvents(50) harvest.CustomEvents = newrelic.NewCustomEvents(50) diff --git a/src/newrelic/app.go b/src/newrelic/app.go index 49ae21d32..16a35a6e4 100644 --- a/src/newrelic/app.go +++ b/src/newrelic/app.go @@ -71,6 +71,7 @@ type AppInfo struct { TraceObserverHost string TraceObserverPort uint16 SpanQueueSize uint64 + AgentEventLimits collector.EventConfigs } func (info *AppInfo) String() string { @@ -116,11 +117,12 @@ type PreconnectReply struct { // that are used in the daemon. The reply contains many more fields, but most // of them are used in the agent. type ConnectReply struct { - ID *AgentRunID `json:"agent_run_id"` - MetricRules MetricRules `json:"metric_name_rules"` - SamplingFrequency int `json:"sampling_target_period_in_seconds"` - SamplingTarget int `json:"sampling_target"` - EventHarvestConfig collector.EventHarvestConfig `json:"event_harvest_config"` + ID *AgentRunID `json:"agent_run_id"` + MetricRules MetricRules `json:"metric_name_rules"` + SamplingFrequency int `json:"sampling_target_period_in_seconds"` + SamplingTarget int `json:"sampling_target"` + EventHarvestConfig collector.EventHarvestConfig `json:"event_harvest_config"` + SpanEventHarvestConfig collector.SpanEventHarvestConfig `json:"span_event_harvest_config"` } // An App represents the state of an application. @@ -193,6 +195,7 @@ func EncodePayload(payload interface{}) ([]byte, error) { } func (info *AppInfo) ConnectPayloadInternal(pid int, util *utilization.Data) *RawConnectPayload { + data := &RawConnectPayload{ Pid: pid, Language: info.AgentLanguage, @@ -211,7 +214,7 @@ func (info *AppInfo) ConnectPayloadInternal(pid int, util *utilization.Data) *Ra // Providing the identifier below works around this issue and allows users // more flexibility in using application rollups. Identifier: info.Appname, - EventHarvestConfig: collector.NewEventHarvestConfig(), + EventHarvestConfig: collector.NewEventHarvestConfig(&info.AgentEventLimits), } // Fallback solution: if no host name was provided with the application @@ -279,6 +282,16 @@ func (app *App) NeedsConnectAttempt(now time.Time, backoff time.Duration) bool { return false } +//Since span events are not included in Faster Event Harvest due to concerns +//about downsampling within a distributed trace, the report period and harvest +//limit are reported separately in span_event_harvest_config instead of +//event_harvest_config. Combine them both into EventHarvestConfig here. +func combineEventConfig (ehc collector.EventHarvestConfig, sehc collector.SpanEventHarvestConfig) collector.EventHarvestConfig { + ehc.EventConfigs.SpanEventConfig.Limit = sehc.SpanEventConfig.Limit + ehc.EventConfigs.SpanEventConfig.ReportPeriod = sehc.SpanEventConfig.ReportPeriod + return ehc +} + func parseConnectReply(rawConnectReply []byte) (*ConnectReply, error) { var c ConnectReply @@ -290,6 +303,9 @@ func parseConnectReply(rawConnectReply []byte) (*ConnectReply, error) { return nil, errors.New("missing agent run id") } + // Since the collector now sends seperately, we need to internally combine the limits. + c.EventHarvestConfig = combineEventConfig(c.EventHarvestConfig, c.SpanEventHarvestConfig) + return &c, nil } diff --git a/src/newrelic/app_harvest_test.go b/src/newrelic/app_harvest_test.go index ed13e382c..036bbecb9 100644 --- a/src/newrelic/app_harvest_test.go +++ b/src/newrelic/app_harvest_test.go @@ -24,7 +24,7 @@ type MockedAppHarvest struct { } func (m *MockedAppHarvest) NewMockedAppHarvest() { - harvest := NewHarvest(time.Now(), collector.NewHarvestLimits()) + harvest := NewHarvest(time.Now(), collector.NewHarvestLimits(nil)) m.App.HarvestTrigger = triggerBuilder(HarvestAll, time.Duration(m.cycleDuration)) diff --git a/src/newrelic/app_test.go b/src/newrelic/app_test.go index 9920eacd6..07b30f3a4 100644 --- a/src/newrelic/app_test.go +++ b/src/newrelic/app_test.go @@ -8,6 +8,7 @@ package newrelic import ( "testing" "time" + "strconv" "newrelic/limits" "newrelic/sysinfo" @@ -37,6 +38,8 @@ func TestConnectPayloadInternal(t *testing.T) { Hostname: "some_host", } + info.AgentEventLimits.SpanEventConfig.Limit = 2323 + expected := &RawConnectPayload{ Pid: 123, Language: "php", @@ -211,81 +214,6 @@ func TestPreconnectPayloadEncoded(t *testing.T) { } } -func TestConnectPayloadEncoded(t *testing.T) { - ramInitializer := new(uint64) - *ramInitializer = 1000 - processors := 22 - util := &utilization.Data{ - MetadataVersion: 1, - LogicalProcessors: &processors, - RamMiB: ramInitializer, - } - info := &AppInfo{ - License: "the_license", - Appname: "one;two", - AgentLanguage: "php", - AgentVersion: "0.1", - HostDisplayName: "my_awesome_host", - Settings: map[string]interface{}{"a": "1", "b": true}, - Environment: JSONString(`[["b", 2]]`), - HighSecurity: false, - Labels: JSONString(`[{"label_type":"c","label_value":"d"}]`), - RedirectCollector: "collector.newrelic.com", - Hostname: "some_host", - } - - pid := 123 - expected := `[` + - `{` + - `"pid":123,` + - `"language":"php",` + - `"agent_version":"0.1",` + - `"host":"some_host",` + - `"display_host":"my_awesome_host",` + - `"settings":{"a":"1","b":true},` + - `"app_name":["one","two"],` + - `"high_security":false,` + - `"labels":[{"label_type":"c","label_value":"d"}],` + - `"environment":[["b",2]],` + - `"identifier":"one;two",` + - `"utilization":{"metadata_version":1,"logical_processors":22,"total_ram_mib":1000,"hostname":"some_host"},` + - `"event_harvest_config":{"report_period_ms":60000,"harvest_limits":{"error_event_data":100,"analytic_event_data":10000,"custom_event_data":10000,"span_event_data":1000}}` + - `}` + - `]` - - b, err := EncodePayload(info.ConnectPayloadInternal(pid, util)) - if err != nil { - t.Error(err) - } else if string(b) != expected { - t.Errorf("expected: %s\nactual: %s", expected, string(b)) - } - - // an empty string for the HostDisplayName should not produce JSON - info.HostDisplayName = "" - expected = `[` + - `{` + - `"pid":123,` + - `"language":"php",` + - `"agent_version":"0.1",` + - `"host":"some_host",` + - `"settings":{"a":"1","b":true},` + - `"app_name":["one","two"],` + - `"high_security":false,` + - `"labels":[{"label_type":"c","label_value":"d"}],` + - `"environment":[["b",2]],` + - `"identifier":"one;two",` + - `"utilization":{"metadata_version":1,"logical_processors":22,"total_ram_mib":1000,"hostname":"some_host"},` + - `"event_harvest_config":{"report_period_ms":60000,"harvest_limits":{"error_event_data":100,"analytic_event_data":10000,"custom_event_data":10000,"span_event_data":1000}}` + - `}` + - `]` - - b, err = EncodePayload(info.ConnectPayloadInternal(pid, util)) - if err != nil { - t.Error(err) - } else if string(b) != expected { - t.Errorf("expected: %s\nactual: %s", expected, string(b)) - } -} func TestNeedsConnectAttempt(t *testing.T) { var app App @@ -394,3 +322,116 @@ func TestAppKeyEquals(t *testing.T) { t.Errorf("Key for application info must not match: %v and %v", info, otherInfo) } } + +func TestConnectPayloadEncoded(t *testing.T) { + ramInitializer := new(uint64) + *ramInitializer = 1000 + processors := 22 + util := &utilization.Data{ + MetadataVersion: 1, + LogicalProcessors: &processors, + RamMiB: ramInitializer, + } + info := &AppInfo{ + License: "the_license", + Appname: "one;two", + AgentLanguage: "php", + AgentVersion: "0.1", + HostDisplayName: "my_awesome_host", + Settings: map[string]interface{}{"a": "1", "b": true}, + Environment: JSONString(`[["b", 2]]`), + HighSecurity: false, + Labels: JSONString(`[{"label_type":"c","label_value":"d"}]`), + RedirectCollector: "collector.newrelic.com", + Hostname: "some_host", + } + + + // A valid span event max samples stored value configured from the agent should + // propagate through and be sent to the collector + info.AgentEventLimits.SpanEventConfig.Limit = 2323 + + pid := 123 + expected := `[` + + `{` + + `"pid":123,` + + `"language":"php",` + + `"agent_version":"0.1",` + + `"host":"some_host",` + + `"display_host":"my_awesome_host",` + + `"settings":{"a":"1","b":true},` + + `"app_name":["one","two"],` + + `"high_security":false,` + + `"labels":[{"label_type":"c","label_value":"d"}],` + + `"environment":[["b",2]],` + + `"identifier":"one;two",` + + `"utilization":{"metadata_version":1,"logical_processors":22,"total_ram_mib":1000,"hostname":"some_host"},` + + `"event_harvest_config":{"report_period_ms":60000,"harvest_limits":{"error_event_data":100,"analytic_event_data":10000,"custom_event_data":10000,"span_event_data":2323}}` + + `}` + + `]` + + b, err := EncodePayload(info.ConnectPayloadInternal(pid, util)) + if err != nil { + t.Error(err) + } else if string(b) != expected { + t.Errorf("expected: %s\nactual: %s", expected, string(b)) + } + + // An invalid span event max samples stored value configured from the agent should + // propagate defaults through and be sent to the collector + info.AgentEventLimits.SpanEventConfig.Limit = 12345 + + pid = 123 + expected = `[` + + `{` + + `"pid":123,` + + `"language":"php",` + + `"agent_version":"0.1",` + + `"host":"some_host",` + + `"display_host":"my_awesome_host",` + + `"settings":{"a":"1","b":true},` + + `"app_name":["one","two"],` + + `"high_security":false,` + + `"labels":[{"label_type":"c","label_value":"d"}],` + + `"environment":[["b",2]],` + + `"identifier":"one;two",` + + `"utilization":{"metadata_version":1,"logical_processors":22,"total_ram_mib":1000,"hostname":"some_host"},` + + `"event_harvest_config":{"report_period_ms":60000,"harvest_limits":{"error_event_data":100,"analytic_event_data":10000,"custom_event_data":10000,"span_event_data":`+strconv.Itoa(limits.MaxSpanMaxEvents)+`}}`+ + `}` + + `]` + + b, err = EncodePayload(info.ConnectPayloadInternal(pid, util)) + if err != nil { + t.Error(err) + } else if string(b) != expected { + t.Errorf("expected: %s\nactual: %s", expected, string(b)) + } + + // an empty string for the HostDisplayName should not produce JSON + info.AgentEventLimits.SpanEventConfig.Limit = 1001 + info.HostDisplayName = "" + expected = `[` + + `{` + + `"pid":123,` + + `"language":"php",` + + `"agent_version":"0.1",` + + `"host":"some_host",` + + `"settings":{"a":"1","b":true},` + + `"app_name":["one","two"],` + + `"high_security":false,` + + `"labels":[{"label_type":"c","label_value":"d"}],` + + `"environment":[["b",2]],` + + `"identifier":"one;two",` + + `"utilization":{"metadata_version":1,"logical_processors":22,"total_ram_mib":1000,"hostname":"some_host"},` + + `"event_harvest_config":{"report_period_ms":60000,"harvest_limits":{"error_event_data":100,"analytic_event_data":10000,"custom_event_data":10000,"span_event_data":1001}}` + + `}` + + `]` + + b, err = EncodePayload(info.ConnectPayloadInternal(pid, util)) + if err != nil { + t.Error(err) + } else if string(b) != expected { + t.Errorf("expected: %s\nactual: %s", expected, string(b)) + } + +} diff --git a/src/newrelic/collector/event_data.go b/src/newrelic/collector/event_data.go index 768a83848..8c5d27af7 100644 --- a/src/newrelic/collector/event_data.go +++ b/src/newrelic/collector/event_data.go @@ -31,6 +31,17 @@ type rawEventHarvestConfig struct { HarvestLimits rawHarvestLimits `json:"harvest_limits"` } +// rawSpanEventHarvestConfig is the wire representation of the span_event_harvest_config, +// as opposed to the unmarshalled view that we provide to the rest of the +// daemon in EventConfigs. Since span events are not included in Faster Event Harvest +// due to concerns about downsampling within a distributed trace, the report period and +// harvest limit are reported separately in span_event_harvest_config instead of +// event_harvest_config; HOWEVER, they are still eventually added to EventConfigs for the daemon +// to use. +type rawSpanEventHarvestConfig struct { + ReportPeriodMS uint64 `json:"report_period_ms"` + SpanEventData *int `json:"harvest_limit"` +} // Event lets you specify the limit and report period for each event type, this // is used in EventConfigs. @@ -40,7 +51,8 @@ type Event struct { } // EventConfigs represents the local harvest limits and harvest interval that -// were created based on what the collector returned in the event_harvest_config. +// were created based on what the collector returned in the event_harvest_config +// and the span_event_harvest_config. type EventConfigs struct { ErrorEventConfig Event AnalyticEventConfig Event @@ -57,6 +69,12 @@ type EventHarvestConfig struct { EventConfigs EventConfigs } +// EventHarvestConfig holds the span_event_harvest_config object +// specified in connect messages. +type SpanEventHarvestConfig struct { + SpanEventConfig Event +} + // durationToMilliseconds converts a report period duration to a raw number of // milliseconds. As report period durations can never be negative, // durationToMilliseconds will return an error if the given duration is @@ -105,12 +123,70 @@ func getEventConfig(rawLimit *int, collectorRate time.Duration, defaultLimit int err = fmt.Errorf("getEventConfig: event limit negative %d", rawLimit) return 0, 0, err } else { - limit = *rawLimit + if *rawLimit > defaultLimit { + limit = defaultLimit + } else { + limit = *rawLimit + } period = collectorRate } return limit, period, nil } +// UnmarshalJSON unmarshals a span_harvest_config JSON object into an +// SpanEventHarvestConfig. +func (daemonConfig *SpanEventHarvestConfig) UnmarshalJSON(b []byte) error { + // Get the default report period in milliseconds. + reportPeriodMs, err := durationToMilliseconds(limits.DefaultReportPeriod) + if err != nil { + return err + } + + // Build a new struct that represents what we'll get from the collector with + // the defaults (this is to ensure there is some value if the collector provides + // invalid or incomplete JSONs). + defaultLimit := limits.MaxSpanMaxEvents + rawConfig := rawSpanEventHarvestConfig{ + ReportPeriodMS: reportPeriodMs, + SpanEventData: &defaultLimit, + } + + // Unmarshal the JSON into the new struct. + if err := json.Unmarshal(b, &rawConfig); err != nil { + return err + } + + // Validate the reporting period, since it cannot be zero, then copy it in as + // a time.Duration. + if rawConfig.ReportPeriodMS == 0 { + log.Warnf("Unexpected report period of %d ms received; ignoring and using the default %v instead", rawConfig.ReportPeriodMS, limits.DefaultReportPeriod) + daemonConfig.SpanEventConfig.ReportPeriod = limits.DefaultReportPeriod + } else { + daemonConfig.SpanEventConfig.ReportPeriod = time.Duration(rawConfig.ReportPeriodMS) * time.Millisecond + } + + var harvestConfig Event + + // Check the span event value to see what the report period and limit should be. + // getEventConfig will do additional data verification. + harvestConfig.Limit, + harvestConfig.ReportPeriod, + err = getEventConfig( + rawConfig.SpanEventData, + daemonConfig.SpanEventConfig.ReportPeriod, + limits.MaxSpanMaxEvents, + limits.DefaultReportPeriod) + if err != nil { + log.Infof("Unexpected negative Span event limit %d", rawConfig.SpanEventData) + return err + } + + // Copy the harvest limits in. + daemonConfig.SpanEventConfig = harvestConfig + + return nil +} + // UnmarshalJSON unmarshals an event_harvest_config JSON object into an // EventHarvestConfig. func (daemonConfig *EventHarvestConfig) UnmarshalJSON(b []byte) error { @@ -185,7 +261,7 @@ func (daemonConfig *EventHarvestConfig) UnmarshalJSON(b []byte) error { err = getEventConfig( rawLimits.SpanEventData, daemonConfig.ReportPeriod, - limits.MaxSpanEvents, + limits.MaxSpanMaxEvents, limits.DefaultReportPeriod) if err != nil { log.Infof("Unexpected negative Span event limit %d", rawLimits.SpanEventData) @@ -198,9 +274,24 @@ func (daemonConfig *EventHarvestConfig) UnmarshalJSON(b []byte) error { return nil } + // NewHarvestLimits creates a EventConfigs with the correct default limits. The -// collector should not know about our per-event report period. -func NewHarvestLimits() EventConfigs { +// collector should not know about our per-event report period. If we get +// per app config limits from the agent(s), we need to honor that. +// It takes an EventConfig variable so that if the agent has configured +// any limits, we can also incorporate those here. +func NewHarvestLimits(agentLimits * EventConfigs) EventConfigs { + + // Check if we have agent limits to incorporate. + // Currently only max span events is configurable via the agent. + spanEventLimit := limits.MaxSpanMaxEvents + if agentLimits != nil { + if (agentLimits.SpanEventConfig.Limit < limits.MaxSpanMaxEvents) && + (agentLimits.SpanEventConfig.Limit >= 0) { + spanEventLimit = agentLimits.SpanEventConfig.Limit + } + } + return EventConfigs{ ErrorEventConfig: Event { Limit: limits.MaxErrorEvents, @@ -212,7 +303,7 @@ func NewHarvestLimits() EventConfigs { Limit: limits.MaxCustomEvents, }, SpanEventConfig: Event { - Limit: limits.MaxSpanEvents, + Limit: spanEventLimit, }, } } @@ -221,10 +312,12 @@ func NewHarvestLimits() EventConfigs { // default values baked into the daemon. The collector should always receive // the daemon default values. We should never send back what we received from // the collector. We should never send per-event report periods. -func NewEventHarvestConfig() EventHarvestConfig { +// It takes an EventConfig variable so that if the agent has configured +// any limits, we can also incorporate those here. +func NewEventHarvestConfig(agentLimits * EventConfigs) EventHarvestConfig { return EventHarvestConfig{ ReportPeriod: limits.DefaultReportPeriod, - EventConfigs: NewHarvestLimits(), + EventConfigs: NewHarvestLimits(agentLimits), } } diff --git a/src/newrelic/collector/event_data_test.go b/src/newrelic/collector/event_data_test.go index 20d15134c..7a1b60b1e 100644 --- a/src/newrelic/collector/event_data_test.go +++ b/src/newrelic/collector/event_data_test.go @@ -49,7 +49,7 @@ func TestDurationToMillisecondsSuccess(t *testing.T) { } } -func TestMarshalJSON(t *testing.T) { +func TestMarshalJSONEvent(t *testing.T) { expected := `{"report_period_ms":20000,"harvest_limits":{"error_event_data":0,"analytic_event_data":0,"custom_event_data":0,"span_event_data":0}}` output, err := json.Marshal(EventHarvestConfig{ReportPeriod: 20 * time.Second}) if err != nil { @@ -64,7 +64,7 @@ func TestMarshalJSON(t *testing.T) { } } -func TestUnmarshalJSONError(t *testing.T) { +func TestUnmarshalJSONEventError(t *testing.T) { for _, input := range []struct { name string json string @@ -78,15 +78,37 @@ func TestUnmarshalJSONError(t *testing.T) { json: `{"harvest_limits":{"error_event_data":-1}}`, }, } { - ehc := NewEventHarvestConfig() + ehc := NewEventHarvestConfig(nil) if err := json.Unmarshal([]byte(input.json), &ehc); err == nil { - t.Errorf("%s: unexpected success unmarshalling JSON", input.name) + t.Errorf("%s: unexpected success unmarshalling event_harvest_config JSON", input.name) } } } +func TestUnmarshalJSONSpanEventError(t *testing.T) { + for _, input := range []struct { + name string + json string + }{ + { + name: "negative report period", + json: `{"report_period_ms":-1}`, + }, + { + name: "negative harvest limit", + json: `{"harvest_limit":-1}`, + }, + } { + sehc := NewDefaultSpanEventHarvestConfig() + if err := json.Unmarshal([]byte(input.json), &sehc); err == nil { + t.Errorf("%s: unexpected success unmarshalling span_event_harvest_config JSON, got %v", input.name, sehc) + } + } +} + + func CreateEventConfig(reportPeriod time.Duration) EventConfigs { - eventConfig := NewHarvestLimits() + eventConfig := NewHarvestLimits(nil) eventConfig.ErrorEventConfig.ReportPeriod = reportPeriod eventConfig.AnalyticEventConfig.ReportPeriod = reportPeriod @@ -97,18 +119,43 @@ func CreateEventConfig(reportPeriod time.Duration) EventConfigs { } func NewDefaultEventHarvestConfig() EventHarvestConfig { - config := NewEventHarvestConfig() + config := NewEventHarvestConfig(nil) config.EventConfigs = CreateEventConfig(config.ReportPeriod) return config } -func TestUnmarshalJSONSuccess(t *testing.T) { +func NewSpanEventHarvestConfig(reportPeriod time.Duration, localLimit int) SpanEventHarvestConfig { + + rp:= reportPeriod + // The report period cannot be less than 1 ms + if reportPeriod > limits.DefaultReportPeriod || reportPeriod <= (1 * time.Millisecond) { + rp = limits.DefaultReportPeriod + } + + ll := localLimit + if localLimit > limits.MaxSpanMaxEvents || localLimit < 0 { + ll = limits.MaxSpanMaxEvents + } + return SpanEventHarvestConfig { + SpanEventConfig: + Event { + ReportPeriod: rp, + Limit: ll, + }, + } +} + +func NewDefaultSpanEventHarvestConfig() SpanEventHarvestConfig { + return NewSpanEventHarvestConfig(limits.DefaultReportPeriod, limits.MaxSpanMaxEvents) +} + +func TestUnmarshalJSONEventSuccess(t *testing.T) { defaultReportPeriodMs := limits.DefaultReportPeriod - // When reading the below expected values, note that NewEventHarvestConfig() + // When reading the below expected values, note that NewEventHarvestConfig(nil) // really means "use the builtin defaults". for _, input := range []struct { name string @@ -226,10 +273,10 @@ func TestUnmarshalJSONSuccess(t *testing.T) { } { // The given context shouldn't matter, but let's test a few variations to be // safe. - testUnmarshalJSONCaseSuccess(t, input.name, "no context", input.json, &EventHarvestConfig{}, &input.expected) + testUnmarshalJSONEventCaseSuccess(t, input.name, "no context", input.json, &EventHarvestConfig{}, &input.expected) - ehc := NewEventHarvestConfig() - testUnmarshalJSONCaseSuccess(t, input.name, "default context", input.json, &ehc, &input.expected) + ehc := NewEventHarvestConfig(nil) + testUnmarshalJSONEventCaseSuccess(t, input.name, "default context", input.json, &ehc, &input.expected) ehc = EventHarvestConfig{ ReportPeriod: 1234 * time.Nanosecond, @@ -248,15 +295,86 @@ func TestUnmarshalJSONSuccess(t *testing.T) { }, }, } - testUnmarshalJSONCaseSuccess(t, input.name, "junk context", input.json, &ehc, &input.expected) + testUnmarshalJSONEventCaseSuccess(t, input.name, "junk context", input.json, &ehc, &input.expected) } } -func testUnmarshalJSONCaseSuccess(t *testing.T, testName, contextName, inputJSON string, context *EventHarvestConfig, expected *EventHarvestConfig) { +func testUnmarshalJSONEventCaseSuccess(t *testing.T, testName, contextName, inputJSON string, context *EventHarvestConfig, expected *EventHarvestConfig) { if err := json.Unmarshal([]byte(inputJSON), &context); err != nil { - t.Errorf("%s; %s: unexpected error unmarshalling JSON: %v", testName, contextName, err) + t.Errorf("%s; %s: unexpected error unmarshalling event_harvest_config JSON: %v", testName, contextName, err) } if !reflect.DeepEqual(context, expected) { - t.Errorf("%s; %s: items are not equal: expected %v; got %v", testName, contextName, expected, context) + t.Errorf("%s; %s: unmarshalling JSON event_harvest_config items are not equal: expected %v; got %v", testName, contextName, expected, context) } } + + +func TestUnmarshalJSONSpanEventSuccess(t *testing.T) { + + // When reading the below expected values, note that NewEventHarvestConfig(nil) + // really means "use the builtin defaults". + + for _, input := range []struct { + name string + json string + expected SpanEventHarvestConfig + }{ + { + name: "empty JSON", + json: `{}`, + expected: NewDefaultSpanEventHarvestConfig(), + }, + { + name: "null report period only", + json: `{"report_period_ms":null}`, + expected: NewDefaultSpanEventHarvestConfig(), + }, + { + name: "zero report period only", + json: `{"report_period_ms":0}`, + expected: NewDefaultSpanEventHarvestConfig(), + }, + { + name: "valid report period only", + json: `{"report_period_ms":42}`, + expected: NewSpanEventHarvestConfig(42 * time.Millisecond, limits.MaxSpanMaxEvents), + }, + { + name: "zero harvest limit", + json: `{"harvest_limit":0}`, + expected: NewSpanEventHarvestConfig(limits.DefaultReportPeriod, 0), + }, + { + name: "valid non-zero harvest limit", + json: `{"harvest_limit":1234}`, + expected: NewSpanEventHarvestConfig(limits.DefaultReportPeriod, 1234), + }, + { + name: "valid nonzero harvest limit and valid report period", + json: `{"report_period_ms":75,"harvest_limit":1212}`, + expected: NewSpanEventHarvestConfig(75 * time.Millisecond, 1212), + }, + } { + // The given context shouldn't matter, but let's test a few variations to be + // safe. + + testUnmarshalJSONSpanEventCaseSuccess(t, input.name, "no context", input.json, &SpanEventHarvestConfig{}, &input.expected) + + sehc := NewDefaultSpanEventHarvestConfig() + testUnmarshalJSONSpanEventCaseSuccess(t, input.name, "default context", input.json, &sehc, &input.expected) + + sehc = NewSpanEventHarvestConfig(1234 * time.Nanosecond, 40000) + + testUnmarshalJSONSpanEventCaseSuccess(t, input.name, "junk context", input.json, &sehc, &input.expected) + } +} + +func testUnmarshalJSONSpanEventCaseSuccess(t *testing.T, testName, contextName, inputJSON string, context *SpanEventHarvestConfig, expected *SpanEventHarvestConfig) { + if err := json.Unmarshal([]byte(inputJSON), &context); err != nil { + t.Errorf("%s; %s: unexpected error unmarshalling span_event_harvest_config JSON: %v", testName, contextName, err) + } + if !reflect.DeepEqual(context, expected) { + + t.Errorf("%s; %s: unmarshalling JSON span_event_harvset_config items are not equal: expected %v; got %v", testName, contextName, expected, context) + } +} \ No newline at end of file diff --git a/src/newrelic/commands.go b/src/newrelic/commands.go index 21be3f01e..67509e5aa 100644 --- a/src/newrelic/commands.go +++ b/src/newrelic/commands.go @@ -263,13 +263,16 @@ func UnmarshalAppInfo(tbl flatbuffers.Table) *AppInfo { TraceObserverHost: string(app.TraceObserverHost()), TraceObserverPort: app.TraceObserverPort(), SpanQueueSize: app.SpanQueueSize(), + HighSecurity: app.HighSecurity(), + } info.initSettings(app.Settings()) - if app.HighSecurity() != 0 { - info.HighSecurity = true - } + // Of the four Event Limits (span, custom, analytic and error), + // only span events is configurable from the agent. + // If this changes in the future, the other values can be added here. + info.AgentEventLimits.SpanEventConfig.Limit = int(app.SpanEventsMaxSamplesStored()) return info } diff --git a/src/newrelic/harvest_test.go b/src/newrelic/harvest_test.go index d6d62cae9..94a6d0f5f 100644 --- a/src/newrelic/harvest_test.go +++ b/src/newrelic/harvest_test.go @@ -13,7 +13,7 @@ import ( ) func TestCreateFinalMetricsWithLotsOfMetrics(t *testing.T) { - harvest := NewHarvest(time.Date(2015, time.November, 11, 1, 2, 0, 0, time.UTC), collector.NewHarvestLimits()) + harvest := NewHarvest(time.Date(2015, time.November, 11, 1, 2, 0, 0, time.UTC), collector.NewHarvestLimits(nil)) harvest.TxnEvents.AddEvent(AnalyticsEvent{data: []byte(`[{"z":42},{},{}]`), priority: SamplingPriority(0.8)}) harvest.TxnEvents.AddEvent(AnalyticsEvent{data: []byte(`[{"z":42},{},{}]`), priority: SamplingPriority(0.8)}) @@ -84,7 +84,7 @@ func TestCreateFinalMetricsWithLotsOfMetrics(t *testing.T) { } func TestCreateFinalMetricsWithNoMetrics(t *testing.T) { - harvest := NewHarvest(time.Date(2015, time.November, 11, 1, 2, 0, 0, time.UTC), collector.NewHarvestLimits()) + harvest := NewHarvest(time.Date(2015, time.November, 11, 1, 2, 0, 0, time.UTC), collector.NewHarvestLimits(nil)) harvest.pidSet[0] = struct{}{} limits := collector.EventHarvestConfig{ ReportPeriod: 1234, @@ -133,55 +133,55 @@ func TestCreateFinalMetricsWithNoMetrics(t *testing.T) { func TestHarvestEmpty(t *testing.T) { startTime := time.Date(2015, time.November, 11, 1, 2, 0, 0, time.UTC) - if !NewHarvest(startTime, collector.NewHarvestLimits()).empty() { + if !NewHarvest(startTime, collector.NewHarvestLimits(nil)).empty() { t.Errorf("NewHarvest().empty() = false, want true") } var h *Harvest - h = NewHarvest(startTime, collector.NewHarvestLimits()) + h = NewHarvest(startTime, collector.NewHarvestLimits(nil)) h.pidSet[0] = struct{}{} if h.empty() { t.Errorf("Harvest.empty() = true, want false") } - h = NewHarvest(startTime, collector.NewHarvestLimits()) + h = NewHarvest(startTime, collector.NewHarvestLimits(nil)) h.CustomEvents.AddEvent(AnalyticsEvent{priority: 0.42}) if h.empty() { t.Errorf("Harvest.empty() = true, want false") } - h = NewHarvest(startTime, collector.NewHarvestLimits()) + h = NewHarvest(startTime, collector.NewHarvestLimits(nil)) h.ErrorEvents.AddEvent(AnalyticsEvent{priority: 0.42}) if h.empty() { t.Errorf("Harvest.empty() = true, want false") } - h = NewHarvest(startTime, collector.NewHarvestLimits()) + h = NewHarvest(startTime, collector.NewHarvestLimits(nil)) h.Errors.AddError(51, []byte{}) /* Error priority = 51 */ if h.empty() { t.Errorf("Harvest.empty() = true, want false") } - h = NewHarvest(startTime, collector.NewHarvestLimits()) + h = NewHarvest(startTime, collector.NewHarvestLimits(nil)) h.Metrics.AddCount("WebTransaction", "", 1, Forced) if h.empty() { t.Errorf("Harvest.empty() = true, want false") } - h = NewHarvest(startTime, collector.NewHarvestLimits()) + h = NewHarvest(startTime, collector.NewHarvestLimits(nil)) h.SlowSQLs.Observe(&SlowSQL{}) if h.empty() { t.Errorf("Harvest.empty() = true, want false") } - h = NewHarvest(startTime, collector.NewHarvestLimits()) + h = NewHarvest(startTime, collector.NewHarvestLimits(nil)) h.TxnEvents.AddEvent(AnalyticsEvent{priority: 0.42}) if h.empty() { t.Errorf("Harvest.empty() = true, want false") } - h = NewHarvest(startTime, collector.NewHarvestLimits()) + h = NewHarvest(startTime, collector.NewHarvestLimits(nil)) h.TxnTraces.AddTxnTrace(&TxnTrace{DurationMillis: 42}) /* Transactions traces are sampled by duration */ if h.empty() { t.Errorf("Harvest.empty() = true, want false") diff --git a/src/newrelic/harvest_trigger.go b/src/newrelic/harvest_trigger.go index 45ae2799e..e348b3dc1 100644 --- a/src/newrelic/harvest_trigger.go +++ b/src/newrelic/harvest_trigger.go @@ -30,7 +30,7 @@ func (reply *ConnectReply) isHarvestAll() bool { eventsConfig := reply.EventHarvestConfig.EventConfigs collectorReportPeriod := reply.EventHarvestConfig.ReportPeriod - // If any event has a unique report period we will need be able to harvest + // If any event has a unique report period we will not be able to harvest // all events at the same time. if eventsConfig.ErrorEventConfig.ReportPeriod != collectorReportPeriod || eventsConfig.AnalyticEventConfig.ReportPeriod != collectorReportPeriod || diff --git a/src/newrelic/limits/limits.go b/src/newrelic/limits/limits.go index 1315349b9..5da671101 100644 --- a/src/newrelic/limits/limits.go +++ b/src/newrelic/limits/limits.go @@ -30,7 +30,7 @@ const ( MaxTxnEvents = 10 * 1000 MaxCustomEvents = 10 * 1000 MaxErrorEvents = 100 - MaxSpanEvents = 1000 + MaxSpanMaxEvents = 10000 MaxErrors = 20 MaxSlowSQLs = 10 MaxRegularTraces = 1 @@ -76,4 +76,5 @@ const ( // MinFlatbufferSize is the minimum size of a flatbuffers message (no agent // run or message body). This should be updated when new fields are added. MinFlatbufferSize = 12 + ) diff --git a/src/newrelic/processor.go b/src/newrelic/processor.go index 2acd1a6bc..83eae8094 100644 --- a/src/newrelic/processor.go +++ b/src/newrelic/processor.go @@ -306,6 +306,7 @@ func (p *Processor) considerConnect(app *App) { go func() { p.connectAttemptChannel <- ConnectApplication(args) }() + } func (p *Processor) processAppInfo(m AppInfoMessage) { @@ -766,7 +767,7 @@ func integrationLog(now time.Time, id AgentRunID, p PayloadCreator) { func (p *Processor) IncomingTxnData(id AgentRunID, sample AggregaterInto) { if p.cfg.IntegrationMode { - h := NewHarvest(time.Now(), collector.NewHarvestLimits()) + h := NewHarvest(time.Now(), collector.NewHarvestLimits(nil)) sample.AggregateInto(h) now := time.Now() integrationLog(now, id, h.Metrics) diff --git a/src/newrelic/processor_test.go b/src/newrelic/processor_test.go index ec0a66da3..77ddb0d9c 100644 --- a/src/newrelic/processor_test.go +++ b/src/newrelic/processor_test.go @@ -26,6 +26,7 @@ var ( sampleTrace = &TxnTrace{Data: data} sampleCustomEvent = []byte("half birthday") + sampleSpanEvent = []byte("belated birthday") sampleErrorEvent = []byte("forgotten birthday") ) @@ -129,6 +130,9 @@ var ( txnErrorEventSample = AggregaterIntoFn(func(h *Harvest) { h.ErrorEvents.AddEventFromData(sampleErrorEvent, SamplingPriority(0.8)) }) + txnSpanEventSample = AggregaterIntoFn(func(h *Harvest) { + h.SpanEvents.AddEventFromData(sampleSpanEvent, SamplingPriority(0.8)) + }) txnEventSample1Times = func(times int) AggregaterIntoFn { return AggregaterIntoFn(func(h *Harvest) { for i := 0; i < times; i++ { @@ -247,12 +251,111 @@ func TestProcessorHarvestErrorEvents(t *testing.T) { m.p.quit() } +func TestProcessorHarvestSpanEvents(t *testing.T) { + m := NewMockedProcessor(1) + + m.DoAppInfo(t, nil, AppStateUnknown) + + m.DoConnectConfiguredReply(t, `{"agent_run_id":"` + idOne.String() + `","zip":"zap","span_event_harvest_config":{"report_period_ms":5000,"harvest_limit":7},"event_harvest_config":{"report_period_ms":5000,"harvest_limits":{"analytics_event_data":5,"custom_event_data":5,"error_event_data":0,"span_event_data":5}}}`) + m.DoAppInfo(t, nil, AppStateConnected) + + m.TxnData(t, idOne, txnSpanEventSample) + m.TxnData(t, idOne, txnSpanEventSample) + + // Now we'll force a harvest for a span event type, and make sure we + // receive that harvest. + m.processorHarvestChan <- ProcessorHarvest{ + AppHarvest: m.p.harvests[idOne], + ID: idOne, + Type: HarvestSpanEvents, + } + + cp := <-m.clientParams + <-m.p.trackProgress // receive harvest notice, two span events in the data + if string(cp.data) != `["one",{"reservoir_size":7,"events_seen":2},[belated birthday,belated birthday]]` { + t.Fatal(string(cp.data)) + } + m.p.quit() + +} + +func TestProcessorHarvestSpanEventsZeroReservoir(t *testing.T) { + m := NewMockedProcessor(1) + + m.DoAppInfo(t, nil, AppStateUnknown) + + m.DoConnectConfiguredReply(t, `{"agent_run_id":"` + idOne.String() + `","zip":"zap","span_event_harvest_config":{"report_period_ms":5000,"harvest_limit":0},"event_harvest_config":{"report_period_ms":5000,"harvest_limits":{"analytics_event_data":5,"custom_event_data":5,"error_event_data":0,"span_event_data":5}}}`) + m.DoAppInfo(t, nil, AppStateConnected) + + m.TxnData(t, idOne, txnSpanEventSample) + m.TxnData(t, idOne, txnSpanEventSample) + m.TxnData(t, idOne, txnCustomEventSample) + + // Trigger a span event harvest. Due to the span_event_data limit being + // zero, no harvest should actually occur here. + + m.processorHarvestChan <- ProcessorHarvest{ + AppHarvest: m.p.harvests[idOne], + ID: idOne, + Type: HarvestSpanEvents, + } + + // No check of m.clientParams here because we expect no harvest to occur + // due to the zero error_event_data limit. + <-m.p.trackProgress // receive harvest notice + + // Now we'll force a harvest for a different event type, and make sure we + // receive that harvest (and not a span event harvest). + m.processorHarvestChan <- ProcessorHarvest{ + AppHarvest: m.p.harvests[idOne], + ID: idOne, + Type: HarvestCustomEvents, + } + + cp := <-m.clientParams + <-m.p.trackProgress // receive harvest notice + if string(cp.data) != `["one",{"reservoir_size":5,"events_seen":1},[half birthday]]` { + t.Fatal(string(cp.data)) + } + m.p.quit() + +} + +func TestProcessorHarvestSpanEventsExceedReservoir(t *testing.T) { + m := NewMockedProcessor(1) + + m.DoAppInfo(t, nil, AppStateUnknown) + + m.DoConnectConfiguredReply(t, `{"agent_run_id":"` + idOne.String() + `","zip":"zap","span_event_harvest_config":{"report_period_ms":5000,"harvest_limit":1},"event_harvest_config":{"report_period_ms":5000,"harvest_limits":{"analytics_event_data":5,"custom_event_data":5,"error_event_data":0,"span_event_data":5}}}`) + m.DoAppInfo(t, nil, AppStateConnected) + + m.TxnData(t, idOne, txnSpanEventSample) + m.TxnData(t, idOne, txnSpanEventSample) + + // Now we'll force a harvest for a span event type, and make sure we + // receive that harvest. + m.processorHarvestChan <- ProcessorHarvest{ + AppHarvest: m.p.harvests[idOne], + ID: idOne, + Type: HarvestSpanEvents, + } + + cp := <-m.clientParams + <-m.p.trackProgress // receive harvest notice with 2 span events seen, but only one span sent + if string(cp.data) != `["one",{"reservoir_size":1,"events_seen":2},[belated birthday]]` { + t.Fatal(string(cp.data)) + } + m.p.quit() + +} + + func TestProcessorHarvestZeroErrorEvents(t *testing.T) { m := NewMockedProcessor(1) m.DoAppInfo(t, nil, AppStateUnknown) - m.DoConnectConfiguredReply(t, `{"agent_run_id":"` + idOne.String() + `","zip":"zap","event_harvest_config":{"report_period_ms":5000,"harvest_limits":{"analytics_event_data":5,"custom_event_data":5,"error_event_data":0,"span_event_data":5}}}`) + m.DoConnectConfiguredReply(t, `{"agent_run_id":"` + idOne.String() + `","zip":"zap","span_event_harvest_config":{"report_period_ms":5000,"harvest_limit":7},"event_harvest_config":{"report_period_ms":5000,"harvest_limits":{"analytics_event_data":5,"custom_event_data":5,"error_event_data":0,"span_event_data":5}}}`) m.DoAppInfo(t, nil, AppStateConnected) m.TxnData(t, idOne, txnErrorEventSample) diff --git a/src/newrelic/protocol/App.go b/src/newrelic/protocol/App.go index 5f2cec2fa..f70327c63 100644 --- a/src/newrelic/protocol/App.go +++ b/src/newrelic/protocol/App.go @@ -1,9 +1,9 @@ +// Code generated by the FlatBuffers compiler. DO NOT EDIT. // // Copyright 2020 New Relic Corporation. All rights reserved. // SPDX-License-Identifier: Apache-2.0 // -// Code generated by the FlatBuffers compiler. DO NOT EDIT. package protocol @@ -22,6 +22,13 @@ func GetRootAsApp(buf []byte, offset flatbuffers.UOffsetT) *App { return x } +func GetSizePrefixedRootAsApp(buf []byte, offset flatbuffers.UOffsetT) *App { + n := flatbuffers.GetUOffsetT(buf[offset+flatbuffers.SizeUint32:]) + x := &App{} + x.Init(buf, n+offset+flatbuffers.SizeUint32) + return x +} + func (rcv *App) Init(buf []byte, i flatbuffers.UOffsetT) { rcv._tab.Bytes = buf rcv._tab.Pos = i @@ -63,16 +70,16 @@ func (rcv *App) AgentVersion() []byte { return nil } -func (rcv *App) HighSecurity() byte { +func (rcv *App) HighSecurity() bool { o := flatbuffers.UOffsetT(rcv._tab.Offset(12)) if o != 0 { - return rcv._tab.GetByte(o + rcv._tab.Pos) + return rcv._tab.GetBool(o + rcv._tab.Pos) } - return 0 + return false } -func (rcv *App) MutateHighSecurity(n byte) bool { - return rcv._tab.MutateByteSlot(12, n) +func (rcv *App) MutateHighSecurity(n bool) bool { + return rcv._tab.MutateBoolSlot(12, n) } func (rcv *App) RedirectCollector() []byte { @@ -171,8 +178,20 @@ func (rcv *App) MutateSpanQueueSize(n uint64) bool { return rcv._tab.MutateUint64Slot(34, n) } +func (rcv *App) SpanEventsMaxSamplesStored() uint64 { + o := flatbuffers.UOffsetT(rcv._tab.Offset(36)) + if o != 0 { + return rcv._tab.GetUint64(o + rcv._tab.Pos) + } + return 0 +} + +func (rcv *App) MutateSpanEventsMaxSamplesStored(n uint64) bool { + return rcv._tab.MutateUint64Slot(36, n) +} + func AppStart(builder *flatbuffers.Builder) { - builder.StartObject(16) + builder.StartObject(17) } func AppAddLicense(builder *flatbuffers.Builder, license flatbuffers.UOffsetT) { builder.PrependUOffsetTSlot(0, flatbuffers.UOffsetT(license), 0) @@ -186,8 +205,8 @@ func AppAddAgentLanguage(builder *flatbuffers.Builder, agentLanguage flatbuffers func AppAddAgentVersion(builder *flatbuffers.Builder, agentVersion flatbuffers.UOffsetT) { builder.PrependUOffsetTSlot(3, flatbuffers.UOffsetT(agentVersion), 0) } -func AppAddHighSecurity(builder *flatbuffers.Builder, highSecurity byte) { - builder.PrependByteSlot(4, highSecurity, 0) +func AppAddHighSecurity(builder *flatbuffers.Builder, highSecurity bool) { + builder.PrependBoolSlot(4, highSecurity, false) } func AppAddRedirectCollector(builder *flatbuffers.Builder, redirectCollector flatbuffers.UOffsetT) { builder.PrependUOffsetTSlot(5, flatbuffers.UOffsetT(redirectCollector), 0) @@ -222,6 +241,9 @@ func AppAddTraceObserverPort(builder *flatbuffers.Builder, traceObserverPort uin func AppAddSpanQueueSize(builder *flatbuffers.Builder, spanQueueSize uint64) { builder.PrependUint64Slot(15, spanQueueSize, 0) } +func AppAddSpanEventsMaxSamplesStored(builder *flatbuffers.Builder, spanEventsMaxSamplesStored uint64) { + builder.PrependUint64Slot(16, spanEventsMaxSamplesStored, 0) +} func AppEnd(builder *flatbuffers.Builder) flatbuffers.UOffsetT { return builder.EndObject() } diff --git a/tests/include/config.php b/tests/include/config.php index 202fe0ec1..8f29f3faf 100644 --- a/tests/include/config.php +++ b/tests/include/config.php @@ -51,11 +51,30 @@ function isset_or($check, $alternate = NULL) $EXTERNAL_HOST = getenv('EXTERNAL_HOST'); $EXTERNAL_TRACING_URL = $EXTERNAL_HOST . "/cat"; +function make_dt_enabled_param() +{ + $value = "false"; + if (ini_get("newrelic.distributed_tracing_enabled")) + $value = "true"; + + return "dt_enabled=" . $value; +} + +function make_cat_enabled_param() +{ + $value = "false"; + if (ini_get("newrelic.cross_application_tracer.enabled")) + $value = "true"; + + return "cat_enabled=" . $value; +} + function make_tracing_url($file) { global $EXTERNAL_TRACING_URL; - return $EXTERNAL_TRACING_URL . '?file=' . $file; + return $EXTERNAL_TRACING_URL . '?file=' . $file . + '&' . make_dt_enabled_param() . '&' . make_cat_enabled_param(); } $PG_USER = isset_or('PG_USER', 'postgres'); diff --git a/tests/integration/api/add_custom_parameter/test_bad_input.php b/tests/integration/api/add_custom_parameter/test_bad_input.php index 6c0b56299..1971ef594 100644 --- a/tests/integration/api/add_custom_parameter/test_bad_input.php +++ b/tests/integration/api/add_custom_parameter/test_bad_input.php @@ -28,7 +28,11 @@ "timestamp": "??", "duration": "??", "totalTime": "??", - "error": false + "error": false, + "guid": "??", + "sampled": true, + "priority": "??", + "traceId": "??" }, { }, diff --git a/tests/integration/api/add_custom_parameter/test_key_conversions.php b/tests/integration/api/add_custom_parameter/test_key_conversions.php index c95aa1779..1a349c39f 100644 --- a/tests/integration/api/add_custom_parameter/test_key_conversions.php +++ b/tests/integration/api/add_custom_parameter/test_key_conversions.php @@ -24,7 +24,11 @@ "timestamp": "??", "duration": "??", "totalTime": "??", - "error": false + "error": false, + "guid": "??", + "sampled": true, + "priority": "??", + "traceId": "??" }, { "foo": "IS_STRING", diff --git a/tests/integration/api/add_custom_parameter/test_span_event.php b/tests/integration/api/add_custom_parameter/test_span_event.php index 87556d2ee..69b2f5515 100644 --- a/tests/integration/api/add_custom_parameter/test_span_event.php +++ b/tests/integration/api/add_custom_parameter/test_span_event.php @@ -58,7 +58,7 @@ [ "?? agent run id", { - "reservoir_size": 1000, + "reservoir_size": 10000, "events_seen": 2 }, [ diff --git a/tests/integration/api/add_custom_parameter/test_value_conversions.php b/tests/integration/api/add_custom_parameter/test_value_conversions.php index 4b82cbfab..e6cbc24b3 100644 --- a/tests/integration/api/add_custom_parameter/test_value_conversions.php +++ b/tests/integration/api/add_custom_parameter/test_value_conversions.php @@ -24,7 +24,11 @@ "timestamp": "??", "duration": "??", "totalTime": "??", - "error": true + "error": true, + "guid": "??", + "sampled": true, + "priority": "??", + "traceId": "??" }, { "IS_STRING": "foo", diff --git a/tests/integration/api/add_custom_span_parameter/test_span_event_parameter_disabled.php b/tests/integration/api/add_custom_span_parameter/test_span_event_parameter_disabled.php index 0a01235d5..34d869a78 100644 --- a/tests/integration/api/add_custom_span_parameter/test_span_event_parameter_disabled.php +++ b/tests/integration/api/add_custom_span_parameter/test_span_event_parameter_disabled.php @@ -27,7 +27,7 @@ [ "?? agent run id", { - "reservoir_size": 1000, + "reservoir_size": 10000, "events_seen": 2 }, [ diff --git a/tests/integration/api/add_custom_span_parameter/test_span_event_parameter_duplicate.php b/tests/integration/api/add_custom_span_parameter/test_span_event_parameter_duplicate.php index 0b0243856..dc7aa370c 100644 --- a/tests/integration/api/add_custom_span_parameter/test_span_event_parameter_duplicate.php +++ b/tests/integration/api/add_custom_span_parameter/test_span_event_parameter_duplicate.php @@ -64,7 +64,7 @@ [ "?? agent run id", { - "reservoir_size": 1000, + "reservoir_size": 10000, "events_seen": 2 }, [ diff --git a/tests/integration/api/add_custom_span_parameter/test_span_event_parameter_duplicate_te_off.php b/tests/integration/api/add_custom_span_parameter/test_span_event_parameter_duplicate_te_off.php index bdb5ae6cd..3c793b454 100644 --- a/tests/integration/api/add_custom_span_parameter/test_span_event_parameter_duplicate_te_off.php +++ b/tests/integration/api/add_custom_span_parameter/test_span_event_parameter_duplicate_te_off.php @@ -38,7 +38,7 @@ [ "?? agent run id", { - "reservoir_size": 1000, + "reservoir_size": 10000, "events_seen": 2 }, [ diff --git a/tests/integration/api/add_custom_span_parameter/test_span_event_parameter_filter.php b/tests/integration/api/add_custom_span_parameter/test_span_event_parameter_filter.php index 781cca703..2695f6985 100644 --- a/tests/integration/api/add_custom_span_parameter/test_span_event_parameter_filter.php +++ b/tests/integration/api/add_custom_span_parameter/test_span_event_parameter_filter.php @@ -29,7 +29,7 @@ [ "?? agent run id", { - "reservoir_size": 1000, + "reservoir_size": 10000, "events_seen": 2 }, [ diff --git a/tests/integration/api/add_custom_span_parameter/test_span_event_parameter_invalid.php b/tests/integration/api/add_custom_span_parameter/test_span_event_parameter_invalid.php index da5f10c29..42d7ea7ff 100644 --- a/tests/integration/api/add_custom_span_parameter/test_span_event_parameter_invalid.php +++ b/tests/integration/api/add_custom_span_parameter/test_span_event_parameter_invalid.php @@ -28,7 +28,7 @@ [ "?? agent run id", { - "reservoir_size": 1000, + "reservoir_size": 10000, "events_seen": 1 }, [ diff --git a/tests/integration/api/add_custom_span_parameter/test_span_event_parameter_max_key.php b/tests/integration/api/add_custom_span_parameter/test_span_event_parameter_max_key.php index e296c69a1..9b833870b 100644 --- a/tests/integration/api/add_custom_span_parameter/test_span_event_parameter_max_key.php +++ b/tests/integration/api/add_custom_span_parameter/test_span_event_parameter_max_key.php @@ -27,7 +27,7 @@ [ "?? agent run id", { - "reservoir_size": 1000, + "reservoir_size": 10000, "events_seen": 2 }, [ diff --git a/tests/integration/api/add_custom_span_parameter/test_span_event_parameter_max_key_te_off.php b/tests/integration/api/add_custom_span_parameter/test_span_event_parameter_max_key_te_off.php index ac6539706..bddb6e596 100644 --- a/tests/integration/api/add_custom_span_parameter/test_span_event_parameter_max_key_te_off.php +++ b/tests/integration/api/add_custom_span_parameter/test_span_event_parameter_max_key_te_off.php @@ -32,7 +32,7 @@ [ "?? agent run id", { - "reservoir_size": 1000, + "reservoir_size": 10000, "events_seen": 2 }, [ diff --git a/tests/integration/api/add_custom_span_parameter/test_span_event_parameter_max_parameters.php b/tests/integration/api/add_custom_span_parameter/test_span_event_parameter_max_parameters.php index 543c8da3b..5103b9183 100644 --- a/tests/integration/api/add_custom_span_parameter/test_span_event_parameter_max_parameters.php +++ b/tests/integration/api/add_custom_span_parameter/test_span_event_parameter_max_parameters.php @@ -88,7 +88,7 @@ [ "?? agent run id", { - "reservoir_size": 1000, + "reservoir_size": 10000, "events_seen": 2 }, [ diff --git a/tests/integration/api/add_custom_span_parameter/test_span_event_parameter_max_value.php b/tests/integration/api/add_custom_span_parameter/test_span_event_parameter_max_value.php index f5f6c90ae..9530350cd 100644 --- a/tests/integration/api/add_custom_span_parameter/test_span_event_parameter_max_value.php +++ b/tests/integration/api/add_custom_span_parameter/test_span_event_parameter_max_value.php @@ -26,7 +26,7 @@ [ "?? agent run id", { - "reservoir_size": 1000, + "reservoir_size": 10000, "events_seen": 2 }, [ diff --git a/tests/integration/api/add_custom_span_parameter/test_span_event_parameter_max_value_te_off.php b/tests/integration/api/add_custom_span_parameter/test_span_event_parameter_max_value_te_off.php index 9d84a5649..c3a1bf2d1 100644 --- a/tests/integration/api/add_custom_span_parameter/test_span_event_parameter_max_value_te_off.php +++ b/tests/integration/api/add_custom_span_parameter/test_span_event_parameter_max_value_te_off.php @@ -36,7 +36,7 @@ [ "?? agent run id", { - "reservoir_size": 1000, + "reservoir_size": 10000, "events_seen": 2 }, [ diff --git a/tests/integration/api/add_custom_span_parameter/test_span_event_parameter_maxplus_parameters.php b/tests/integration/api/add_custom_span_parameter/test_span_event_parameter_maxplus_parameters.php index 970eba708..f5145360b 100644 --- a/tests/integration/api/add_custom_span_parameter/test_span_event_parameter_maxplus_parameters.php +++ b/tests/integration/api/add_custom_span_parameter/test_span_event_parameter_maxplus_parameters.php @@ -88,7 +88,7 @@ [ "?? agent run id", { - "reservoir_size": 1000, + "reservoir_size": 10000, "events_seen": 2 }, [ diff --git a/tests/integration/api/add_custom_span_parameter/test_span_event_parameter_maxplus_parameters_te_off.php b/tests/integration/api/add_custom_span_parameter/test_span_event_parameter_maxplus_parameters_te_off.php index 93720b950..11757a83f 100644 --- a/tests/integration/api/add_custom_span_parameter/test_span_event_parameter_maxplus_parameters_te_off.php +++ b/tests/integration/api/add_custom_span_parameter/test_span_event_parameter_maxplus_parameters_te_off.php @@ -94,7 +94,7 @@ [ "?? agent run id", { - "reservoir_size": 1000, + "reservoir_size": 10000, "events_seen": 2 }, [ diff --git a/tests/integration/api/add_custom_span_parameter/test_span_event_parameter_maxplus_span_and_te.php b/tests/integration/api/add_custom_span_parameter/test_span_event_parameter_maxplus_span_and_te.php index cffdb2311..9c28abd55 100644 --- a/tests/integration/api/add_custom_span_parameter/test_span_event_parameter_maxplus_span_and_te.php +++ b/tests/integration/api/add_custom_span_parameter/test_span_event_parameter_maxplus_span_and_te.php @@ -214,7 +214,7 @@ [ "?? agent run id", { - "reservoir_size": 1000, + "reservoir_size": 10000, "events_seen": 2 }, [ diff --git a/tests/integration/api/add_custom_span_parameter/test_span_event_parameter_maxplus_span_and_te_te_off.php b/tests/integration/api/add_custom_span_parameter/test_span_event_parameter_maxplus_span_and_te_te_off.php index f6e299e4f..f14d501a2 100644 --- a/tests/integration/api/add_custom_span_parameter/test_span_event_parameter_maxplus_span_and_te_te_off.php +++ b/tests/integration/api/add_custom_span_parameter/test_span_event_parameter_maxplus_span_and_te_te_off.php @@ -128,7 +128,7 @@ [ "?? agent run id", { - "reservoir_size": 1000, + "reservoir_size": 10000, "events_seen": 2 }, [ diff --git a/tests/integration/api/add_custom_span_parameter/test_span_event_parameter_overwrite.php b/tests/integration/api/add_custom_span_parameter/test_span_event_parameter_overwrite.php index b1d2faa0f..4e4b48f5e 100644 --- a/tests/integration/api/add_custom_span_parameter/test_span_event_parameter_overwrite.php +++ b/tests/integration/api/add_custom_span_parameter/test_span_event_parameter_overwrite.php @@ -27,7 +27,7 @@ [ "?? agent run id", { - "reservoir_size": 1000, + "reservoir_size": 10000, "events_seen": 2 }, [ diff --git a/tests/integration/api/add_custom_span_parameter/test_span_event_parameter_te_off.php b/tests/integration/api/add_custom_span_parameter/test_span_event_parameter_te_off.php index 10dcef7b9..c8ea42aa7 100644 --- a/tests/integration/api/add_custom_span_parameter/test_span_event_parameter_te_off.php +++ b/tests/integration/api/add_custom_span_parameter/test_span_event_parameter_te_off.php @@ -28,7 +28,7 @@ [ "?? agent run id", { - "reservoir_size": 1000, + "reservoir_size": 10000, "events_seen": 2 }, [ diff --git a/tests/integration/api/add_custom_span_parameter/test_span_event_parameter_types.php b/tests/integration/api/add_custom_span_parameter/test_span_event_parameter_types.php index 52ef0a09e..a94459e1a 100644 --- a/tests/integration/api/add_custom_span_parameter/test_span_event_parameter_types.php +++ b/tests/integration/api/add_custom_span_parameter/test_span_event_parameter_types.php @@ -27,7 +27,7 @@ [ "?? agent run id", { - "reservoir_size": 1000, + "reservoir_size": 10000, "events_seen": 2 }, [ diff --git a/tests/integration/api/add_custom_tracer/test_happy.php b/tests/integration/api/add_custom_tracer/test_happy.php index 4b4d1580a..9b88d13e9 100644 --- a/tests/integration/api/add_custom_tracer/test_happy.php +++ b/tests/integration/api/add_custom_tracer/test_happy.php @@ -19,6 +19,10 @@ "?? timeframe start", "?? timeframe stop", [ + [{"name":"DurationByCaller/Unknown/Unknown/Unknown/Unknown/all"}, + [1, "??", "??", "??", "??", "??"]], + [{"name":"DurationByCaller/Unknown/Unknown/Unknown/Unknown/allOther"}, + [1, "??", "??", "??", "??", "??"]], [{"name":"Custom/MY_function"}, [1, "??", "??", "??", "??", "??"]], [{"name":"Custom/MY_function", "scope":"OtherTransaction/php__FILE__" }, [1, "??", "??", "??", "??", "??"]], diff --git a/tests/integration/api/add_custom_tracer/test_not_user_function.php b/tests/integration/api/add_custom_tracer/test_not_user_function.php index 21e99a143..2f17047fe 100644 --- a/tests/integration/api/add_custom_tracer/test_not_user_function.php +++ b/tests/integration/api/add_custom_tracer/test_not_user_function.php @@ -14,6 +14,10 @@ "?? timeframe start", "?? timeframe stop", [ + [{"name":"DurationByCaller/Unknown/Unknown/Unknown/Unknown/all"}, + [1, "??", "??", "??", "??", "??"]], + [{"name":"DurationByCaller/Unknown/Unknown/Unknown/Unknown/allOther"}, + [1, "??", "??", "??", "??", "??"]], [{"name":"OtherTransaction/all"}, [1, "??", "??", "??", "??", "??"]], [{"name":"OtherTransaction/php__FILE__"}, [1, "??", "??", "??", "??", "??"]], [{"name":"OtherTransactionTotalTime"}, [1, "??", "??", "??", "??", "??"]], diff --git a/tests/integration/api/add_custom_tracer/test_short_segments.php b/tests/integration/api/add_custom_tracer/test_short_segments.php index 945d189b1..514c3ff1a 100644 --- a/tests/integration/api/add_custom_tracer/test_short_segments.php +++ b/tests/integration/api/add_custom_tracer/test_short_segments.php @@ -35,7 +35,11 @@ "totalTime": "??", "cpu_time": "??", "cpu_user_time": "??", - "cpu_sys_time": "??" + "cpu_sys_time": "??", + "guid": "??", + "sampled": true, + "priority": "??", + "traceId": "??" } } ], @@ -60,6 +64,10 @@ "?? timeframe start", "?? timeframe stop", [ + [{"name":"DurationByCaller/Unknown/Unknown/Unknown/Unknown/all"}, + [1, "??", "??", "??", "??", "??"]], + [{"name":"DurationByCaller/Unknown/Unknown/Unknown/Unknown/allOther"}, + [1, "??", "??", "??", "??", "??"]], [{"name":"Custom/my_function"}, [1000, "??", "??", "??", "??", "??"]], [{"name":"Custom/my_function", "scope":"OtherTransaction/php__FILE__" }, [1000, "??", "??", "??", "??", "??"]], diff --git a/tests/integration/api/custom_metric/test_bad_input.php b/tests/integration/api/custom_metric/test_bad_input.php index e2eadddff..4b258c1d8 100644 --- a/tests/integration/api/custom_metric/test_bad_input.php +++ b/tests/integration/api/custom_metric/test_bad_input.php @@ -32,6 +32,10 @@ "?? timeframe start", "?? timeframe stop", [ + [{"name":"DurationByCaller/Unknown/Unknown/Unknown/Unknown/all"}, + [1, "??", "??", "??", "??", "??"]], + [{"name":"DurationByCaller/Unknown/Unknown/Unknown/Unknown/allOther"}, + [1, "??", "??", "??", "??", "??"]], [{"name":"OtherTransaction/all"}, [1, "??", "??", "??", "??", "??"]], [{"name":"OtherTransaction/php__FILE__"}, [1, "??", "??", "??", "??", "??"]], [{"name":"OtherTransactionTotalTime"}, [1, "??", "??", "??", "??", "??"]], diff --git a/tests/integration/api/custom_metric/test_bad_input.php8.php b/tests/integration/api/custom_metric/test_bad_input.php8.php index ae855129e..bada9515d 100644 --- a/tests/integration/api/custom_metric/test_bad_input.php8.php +++ b/tests/integration/api/custom_metric/test_bad_input.php8.php @@ -32,6 +32,10 @@ "?? timeframe start", "?? timeframe stop", [ + [{"name":"DurationByCaller/Unknown/Unknown/Unknown/Unknown/all"}, + [1, "??", "??", "??", "??", "??"]], + [{"name":"DurationByCaller/Unknown/Unknown/Unknown/Unknown/allOther"}, + [1, "??", "??", "??", "??", "??"]], [{"name":"OtherTransaction/all"}, [1, "??", "??", "??", "??", "??"]], [{"name":"OtherTransaction/php__FILE__"}, [1, "??", "??", "??", "??", "??"]], [{"name":"OtherTransactionTotalTime"}, [1, "??", "??", "??", "??", "??"]], diff --git a/tests/integration/api/custom_metric/test_happy.php b/tests/integration/api/custom_metric/test_happy.php index 2f524f123..af96ec2e5 100644 --- a/tests/integration/api/custom_metric/test_happy.php +++ b/tests/integration/api/custom_metric/test_happy.php @@ -22,6 +22,10 @@ "?? timeframe start", "?? timeframe stop", [ + [{"name":"DurationByCaller/Unknown/Unknown/Unknown/Unknown/all"}, + [1, "??", "??", "??", "??", "??"]], + [{"name":"DurationByCaller/Unknown/Unknown/Unknown/Unknown/allOther"}, + [1, "??", "??", "??", "??", "??"]], [{"name":"Custom/Application/Metric"}, [3, 7.0, 7.0, 1.0, 4.0, 21.0]], [{"name":"OtherTransaction/all"}, [1, "??", "??", "??", "??", "??"]], [{"name":"OtherTransaction/php__FILE__"}, [1, "??", "??", "??", "??", "??"]], diff --git a/tests/integration/api/datastore/test_all_parameters_no_children.php b/tests/integration/api/datastore/test_all_parameters_no_children.php index 72fe8a721..ac4f0cbbc 100644 --- a/tests/integration/api/datastore/test_all_parameters_no_children.php +++ b/tests/integration/api/datastore/test_all_parameters_no_children.php @@ -20,6 +20,10 @@ "?? start time", "?? stop time", [ + [{"name":"DurationByCaller/Unknown/Unknown/Unknown/Unknown/all"}, + [1, "??", "??", "??", "??", "??"]], + [{"name":"DurationByCaller/Unknown/Unknown/Unknown/Unknown/allOther"}, + [1, "??", "??", "??", "??", "??"]], [{"name":"Datastore/all"}, [1, "??", "??", "??", "??", "??"]], [{"name":"Datastore/allOther"}, [1, "??", "??", "??", "??", "??"]], [{"name":"Datastore/MongoDB/all"}, [1, "??", "??", "??", "??", "??"]], @@ -75,7 +79,11 @@ "totalTime": "??", "cpu_time": "??", "cpu_user_time": "??", - "cpu_sys_time": "??" + "cpu_sys_time": "??", + "guid": "??", + "sampled": true, + "priority": "??", + "traceId": "??" } } ], diff --git a/tests/integration/api/datastore/test_all_parameters_nosql.php b/tests/integration/api/datastore/test_all_parameters_nosql.php index b3954dad1..1f9444054 100644 --- a/tests/integration/api/datastore/test_all_parameters_nosql.php +++ b/tests/integration/api/datastore/test_all_parameters_nosql.php @@ -20,6 +20,10 @@ "?? start time", "?? stop time", [ + [{"name":"DurationByCaller/Unknown/Unknown/Unknown/Unknown/all"}, + [1, "??", "??", "??", "??", "??"]], + [{"name":"DurationByCaller/Unknown/Unknown/Unknown/Unknown/allOther"}, + [1, "??", "??", "??", "??", "??"]], [{"name":"Datastore/all"}, [1, "??", "??", "??", "??", "??"]], [{"name":"Datastore/allOther"}, [1, "??", "??", "??", "??", "??"]], [{"name":"Datastore/MongoDB/all"}, [1, "??", "??", "??", "??", "??"]], @@ -74,7 +78,11 @@ "totalTime": "??", "cpu_time": "??", "cpu_user_time": "??", - "cpu_sys_time": "??" + "cpu_sys_time": "??", + "guid": "??", + "sampled": true, + "priority": "??", + "traceId": "??" } } ], diff --git a/tests/integration/api/datastore/test_all_parameters_sql_no_query.php b/tests/integration/api/datastore/test_all_parameters_sql_no_query.php index 85a9eb0bb..41179d5ee 100644 --- a/tests/integration/api/datastore/test_all_parameters_sql_no_query.php +++ b/tests/integration/api/datastore/test_all_parameters_sql_no_query.php @@ -21,6 +21,10 @@ "?? start time", "?? stop time", [ + [{"name":"DurationByCaller/Unknown/Unknown/Unknown/Unknown/all"}, + [1, "??", "??", "??", "??", "??"]], + [{"name":"DurationByCaller/Unknown/Unknown/Unknown/Unknown/allOther"}, + [1, "??", "??", "??", "??", "??"]], [{"name":"Datastore/all"}, [1, "??", "??", "??", "??", "??"]], [{"name":"Datastore/allOther"}, [1, "??", "??", "??", "??", "??"]], [{"name":"Datastore/MySQL/all"}, [1, "??", "??", "??", "??", "??"]], @@ -75,7 +79,11 @@ "totalTime": "??", "cpu_time": "??", "cpu_user_time": "??", - "cpu_sys_time": "??" + "cpu_sys_time": "??", + "guid": "??", + "sampled": true, + "priority": "??", + "traceId": "??" } } ], diff --git a/tests/integration/api/datastore/test_all_parameters_sql_obfuscated.php b/tests/integration/api/datastore/test_all_parameters_sql_obfuscated.php index 00aa1d150..9ce892afa 100644 --- a/tests/integration/api/datastore/test_all_parameters_sql_obfuscated.php +++ b/tests/integration/api/datastore/test_all_parameters_sql_obfuscated.php @@ -21,6 +21,10 @@ "?? start time", "?? stop time", [ + [{"name":"DurationByCaller/Unknown/Unknown/Unknown/Unknown/all"}, + [1, "??", "??", "??", "??", "??"]], + [{"name":"DurationByCaller/Unknown/Unknown/Unknown/Unknown/allOther"}, + [1, "??", "??", "??", "??", "??"]], [{"name":"Datastore/all"}, [1, "??", "??", "??", "??", "??"]], [{"name":"Datastore/allOther"}, [1, "??", "??", "??", "??", "??"]], [{"name":"Datastore/MySQL/all"}, [1, "??", "??", "??", "??", "??"]], @@ -76,7 +80,11 @@ "totalTime": "??", "cpu_time": "??", "cpu_user_time": "??", - "cpu_sys_time": "??" + "cpu_sys_time": "??", + "guid": "??", + "sampled": true, + "priority": "??", + "traceId": "??" } } ], diff --git a/tests/integration/api/datastore/test_all_parameters_sql_raw.php b/tests/integration/api/datastore/test_all_parameters_sql_raw.php index 1ea86ba86..6e6969e1e 100644 --- a/tests/integration/api/datastore/test_all_parameters_sql_raw.php +++ b/tests/integration/api/datastore/test_all_parameters_sql_raw.php @@ -21,6 +21,10 @@ "?? start time", "?? stop time", [ + [{"name":"DurationByCaller/Unknown/Unknown/Unknown/Unknown/all"}, + [1, "??", "??", "??", "??", "??"]], + [{"name":"DurationByCaller/Unknown/Unknown/Unknown/Unknown/allOther"}, + [1, "??", "??", "??", "??", "??"]], [{"name":"Datastore/all"}, [1, "??", "??", "??", "??", "??"]], [{"name":"Datastore/allOther"}, [1, "??", "??", "??", "??", "??"]], [{"name":"Datastore/MySQL/all"}, [1, "??", "??", "??", "??", "??"]], @@ -76,7 +80,11 @@ "totalTime": "??", "cpu_time": "??", "cpu_user_time": "??", - "cpu_sys_time": "??" + "cpu_sys_time": "??", + "guid": "??", + "sampled": true, + "priority": "??", + "traceId": "??" } } ], diff --git a/tests/integration/api/datastore/test_basic.php b/tests/integration/api/datastore/test_basic.php index 43d02695a..0a5c2f268 100644 --- a/tests/integration/api/datastore/test_basic.php +++ b/tests/integration/api/datastore/test_basic.php @@ -20,6 +20,10 @@ "?? start time", "?? stop time", [ + [{"name":"DurationByCaller/Unknown/Unknown/Unknown/Unknown/all"}, + [1, "??", "??", "??", "??", "??"]], + [{"name":"DurationByCaller/Unknown/Unknown/Unknown/Unknown/allOther"}, + [1, "??", "??", "??", "??", "??"]], [{"name":"Datastore/all"}, [1, "??", "??", "??", "??", "??"]], [{"name":"Datastore/allOther"}, [1, "??", "??", "??", "??", "??"]], [{"name":"Datastore/custom/all"}, [1, "??", "??", "??", "??", "??"]], @@ -74,7 +78,11 @@ "totalTime": "??", "cpu_time": "??", "cpu_user_time": "??", - "cpu_sys_time": "??" + "cpu_sys_time": "??", + "guid": "??", + "sampled": true, + "priority": "??", + "traceId": "??" } } ], diff --git a/tests/integration/api/distributed_trace/newrelic/test_keep_span_with_payload.php b/tests/integration/api/distributed_trace/newrelic/test_keep_span_with_payload.php index ea821ddf2..4620dead2 100644 --- a/tests/integration/api/distributed_trace/newrelic/test_keep_span_with_payload.php +++ b/tests/integration/api/distributed_trace/newrelic/test_keep_span_with_payload.php @@ -25,7 +25,7 @@ [ "?? agent run id", { - "reservoir_size": 1000, + "reservoir_size": 10000, "events_seen": 2 }, [ diff --git a/tests/integration/api/internal/test_get_request_metadata_cat.php b/tests/integration/api/internal/test_get_request_metadata_cat.php index 4977cd37f..43e8c782f 100644 --- a/tests/integration/api/internal/test_get_request_metadata_cat.php +++ b/tests/integration/api/internal/test_get_request_metadata_cat.php @@ -9,8 +9,8 @@ */ /*INI -newrelic.cross_process_enabled=1 newrelic.distributed_tracing_enabled=0 +newrelic.cross_application_tracer.enabled = true */ /*EXPECT diff --git a/tests/integration/api/notice_error/test_errors_not_filtered.php b/tests/integration/api/notice_error/test_errors_not_filtered.php index 3e7cb50cc..f8389aff0 100644 --- a/tests/integration/api/notice_error/test_errors_not_filtered.php +++ b/tests/integration/api/notice_error/test_errors_not_filtered.php @@ -49,7 +49,12 @@ "error.message": "Report Me!", "transactionName": "OtherTransaction\/php__FILE__", "duration": "??", - "nr.transactionGuid": "??" + "nr.transactionGuid": "??", + "guid": "??", + "sampled": true, + "priority": "??", + "traceId": "??", + "spanId": "??" }, {}, {} diff --git a/tests/integration/api/notice_error/test_exceptions_not_filtered.php b/tests/integration/api/notice_error/test_exceptions_not_filtered.php index c2ff06d3c..a62a04abb 100644 --- a/tests/integration/api/notice_error/test_exceptions_not_filtered.php +++ b/tests/integration/api/notice_error/test_exceptions_not_filtered.php @@ -51,7 +51,12 @@ "error.message": "Noticed exception 'Exception' with message 'Sample Exception' in __FILE__:??", "transactionName": "OtherTransaction\/php__FILE__", "duration": "??", - "nr.transactionGuid": "??" + "nr.transactionGuid": "??", + "guid": "??", + "sampled": true, + "priority": "??", + "traceId": "??", + "spanId": "??" }, {}, {} diff --git a/tests/integration/api/notice_error/test_last_error_wins.php b/tests/integration/api/notice_error/test_last_error_wins.php index b660d5d48..1c45f2e23 100644 --- a/tests/integration/api/notice_error/test_last_error_wins.php +++ b/tests/integration/api/notice_error/test_last_error_wins.php @@ -48,7 +48,12 @@ "error.message": "Noticed exception 'Exception' with message 'Sample Exception' in __FILE__:??", "transactionName": "OtherTransaction\/php__FILE__", "duration": "??", - "nr.transactionGuid": "??" + "nr.transactionGuid": "??", + "guid": "??", + "sampled": true, + "priority": "??", + "traceId": "??", + "spanId": "??" }, {}, {} diff --git a/tests/integration/api/notice_error/test_prioritize_api.php b/tests/integration/api/notice_error/test_prioritize_api.php index bc748354f..3bc270475 100644 --- a/tests/integration/api/notice_error/test_prioritize_api.php +++ b/tests/integration/api/notice_error/test_prioritize_api.php @@ -52,7 +52,12 @@ "error.message": "Noticed exception 'Exception' with message 'Sample Exception' in __FILE__:??", "transactionName": "OtherTransaction\/php__FILE__", "duration": "??", - "nr.transactionGuid": "??" + "nr.transactionGuid": "??", + "guid": "??", + "sampled": true, + "priority": "??", + "traceId": "??", + "spanId": "??" }, {}, {} diff --git a/tests/integration/api/notice_error/test_priority.php b/tests/integration/api/notice_error/test_priority.php index ae125e8a5..e411e0969 100644 --- a/tests/integration/api/notice_error/test_priority.php +++ b/tests/integration/api/notice_error/test_priority.php @@ -45,7 +45,12 @@ "error.message": "highest priority", "transactionName": "OtherTransaction\/php__FILE__", "duration": "??", - "nr.transactionGuid": "??" + "nr.transactionGuid": "??", + "guid": "??", + "sampled": true, + "priority": "??", + "traceId": "??", + "spanId": "??" }, {}, {} diff --git a/tests/integration/api/notice_error/test_uncaught_is_ultimate.php b/tests/integration/api/notice_error/test_uncaught_is_ultimate.php index 633306f1a..015d687f1 100644 --- a/tests/integration/api/notice_error/test_uncaught_is_ultimate.php +++ b/tests/integration/api/notice_error/test_uncaught_is_ultimate.php @@ -51,7 +51,12 @@ "error.message": "Uncaught exception 'Exception' with message 'Sample Exception' in __FILE__:??", "transactionName": "OtherTransaction\/php__FILE__", "duration": "??", - "nr.transactionGuid": "??" + "nr.transactionGuid": "??", + "guid": "??", + "sampled": true, + "priority": "??", + "traceId": "??", + "spanId": "??" }, {}, {} diff --git a/tests/integration/api/other/test_end_transaction_nested.php b/tests/integration/api/other/test_end_transaction_nested.php index 2fa62e29d..30bc19a32 100644 --- a/tests/integration/api/other/test_end_transaction_nested.php +++ b/tests/integration/api/other/test_end_transaction_nested.php @@ -52,7 +52,11 @@ "totalTime": "??", "cpu_time": "??", "cpu_user_time": "??", - "cpu_sys_time": "??" + "cpu_sys_time": "??", + "guid": "??", + "sampled": true, + "priority": "??", + "traceId": "??" } } ], diff --git a/tests/integration/api/other/test_ignore_apdex.php b/tests/integration/api/other/test_ignore_apdex.php index 13b3fef3e..d5649db2a 100644 --- a/tests/integration/api/other/test_ignore_apdex.php +++ b/tests/integration/api/other/test_ignore_apdex.php @@ -14,6 +14,10 @@ "?? timeframe start", "?? timeframe stop", [ + [{"name":"DurationByCaller/Unknown/Unknown/Unknown/Unknown/all"}, + [1, "??", "??", "??", "??", "??"]], + [{"name":"DurationByCaller/Unknown/Unknown/Unknown/Unknown/allWeb"}, + [1, "??", "??", "??", "??", "??"]], [{"name":"HttpDispatcher"}, [1, "??", "??", "??", "??", "??"]], [{"name":"WebTransaction"}, [1, "??", "??", "??", "??", "??"]], [{"name":"WebTransaction/Uri__FILE__"}, [1, "??", "??", "??", "??", "??"]], diff --git a/tests/integration/api/other/test_set_user_attributes_happy.php b/tests/integration/api/other/test_set_user_attributes_happy.php index a473e74ba..24b4f25dc 100644 --- a/tests/integration/api/other/test_set_user_attributes_happy.php +++ b/tests/integration/api/other/test_set_user_attributes_happy.php @@ -20,8 +20,12 @@ "timestamp": "??", "duration": "??", "totalTime": "??", - "error": false - }, + "error": false, + "guid": "??", + "sampled": true, + "priority": "??", + "traceId": "??" + }, { "product": "my_product", "account": "my_account", diff --git a/tests/integration/api/other/test_start_and_end_transaction.php b/tests/integration/api/other/test_start_and_end_transaction.php index 92175b733..8e08fdf39 100644 --- a/tests/integration/api/other/test_start_and_end_transaction.php +++ b/tests/integration/api/other/test_start_and_end_transaction.php @@ -45,7 +45,11 @@ "totalTime": "??", "cpu_time": "??", "cpu_user_time": "??", - "cpu_sys_time": "??" + "cpu_sys_time": "??", + "guid": "??", + "sampled": true, + "priority": "??", + "traceId": "??" } } ], diff --git a/tests/integration/api/set_appname/test_already_ended.php b/tests/integration/api/set_appname/test_already_ended.php index 4f4ff3acf..6d8fb40f6 100644 --- a/tests/integration/api/set_appname/test_already_ended.php +++ b/tests/integration/api/set_appname/test_already_ended.php @@ -19,6 +19,10 @@ "?? timeframe start", "?? timeframe stop", [ + [{"name":"DurationByCaller/Unknown/Unknown/Unknown/Unknown/all"}, + [1, "??", "??", "??", "??", "??"]], + [{"name":"DurationByCaller/Unknown/Unknown/Unknown/Unknown/allOther"}, + [1, "??", "??", "??", "??", "??"]], [{"name":"OtherTransaction/all"}, [1, "??", "??", "??", "??", "??"]], [{"name":"OtherTransaction/php__FILE__"}, [1, "??", "??", "??", "??", "??"]], [{"name":"OtherTransactionTotalTime"}, [1, "??", "??", "??", "??", "??"]], diff --git a/tests/integration/api/set_appname/test_appname_license.php b/tests/integration/api/set_appname/test_appname_license.php index 864ed40cf..fa9c79097 100644 --- a/tests/integration/api/set_appname/test_appname_license.php +++ b/tests/integration/api/set_appname/test_appname_license.php @@ -18,6 +18,10 @@ "?? timeframe start", "?? timeframe stop", [ + [{"name":"DurationByCaller/Unknown/Unknown/Unknown/Unknown/all"}, + [1, "??", "??", "??", "??", "??"]], + [{"name":"DurationByCaller/Unknown/Unknown/Unknown/Unknown/allOther"}, + [1, "??", "??", "??", "??", "??"]], [{"name":"OtherTransaction/all"}, [1, "??", "??", "??", "??", "??"]], [{"name":"OtherTransaction/php__FILE__"}, [1, "??", "??", "??", "??", "??"]], [{"name":"OtherTransactionTotalTime"}, [1, "??", "??", "??", "??", "??"]], diff --git a/tests/integration/api/set_appname/test_appname_switch_license.php b/tests/integration/api/set_appname/test_appname_switch_license.php index 19751465a..902b53018 100644 --- a/tests/integration/api/set_appname/test_appname_switch_license.php +++ b/tests/integration/api/set_appname/test_appname_switch_license.php @@ -18,6 +18,10 @@ "?? timeframe start", "?? timeframe stop", [ + [{"name":"DurationByCaller/Unknown/Unknown/Unknown/Unknown/all"}, + [2, "??", "??", "??", "??", "??"]], + [{"name":"DurationByCaller/Unknown/Unknown/Unknown/Unknown/allOther"}, + [2, "??", "??", "??", "??", "??"]], [{"name":"OtherTransaction/all"}, [2, "??", "??", "??", "??", "??"]], [{"name":"OtherTransaction/php__FILE__"}, [2, "??", "??", "??", "??", "??"]], [{"name":"OtherTransactionTotalTime"}, [2, "??", "??", "??", "??", "??"]], diff --git a/tests/integration/api/set_appname/test_appname_switch_license_lasp.php b/tests/integration/api/set_appname/test_appname_switch_license_lasp.php index b86975cce..82c2d2665 100644 --- a/tests/integration/api/set_appname/test_appname_switch_license_lasp.php +++ b/tests/integration/api/set_appname/test_appname_switch_license_lasp.php @@ -24,6 +24,10 @@ "?? timeframe start", "?? timeframe stop", [ + [{"name":"DurationByCaller/Unknown/Unknown/Unknown/Unknown/all"}, + [1, "??", "??", "??", "??", "??"]], + [{"name":"DurationByCaller/Unknown/Unknown/Unknown/Unknown/allOther"}, + [1, "??", "??", "??", "??", "??"]], [{"name":"OtherTransaction/all"}, [1, "??", "??", "??", "??", "??"]], [{"name":"OtherTransaction/php__FILE__"}, [1, "??", "??", "??", "??", "??"]], [{"name":"OtherTransactionTotalTime"}, [1, "??", "??", "??", "??", "??"]], diff --git a/tests/integration/api/set_appname/test_bad_params.php b/tests/integration/api/set_appname/test_bad_params.php index 16382bf1d..343218c71 100644 --- a/tests/integration/api/set_appname/test_bad_params.php +++ b/tests/integration/api/set_appname/test_bad_params.php @@ -30,6 +30,14 @@ "?? timeframe start", "?? timeframe stop", [ + [{"name":"DurationByCaller/Unknown/Unknown/Unknown/Unknown/all"}, + [1, "??", "??", "??", "??", "??"]], + [{"name":"DurationByCaller/Unknown/Unknown/Unknown/Unknown/allOther"}, + [1, "??", "??", "??", "??", "??"]], + [{"name":"ErrorsByCaller/Unknown/Unknown/Unknown/Unknown/all"}, + [1, "??", "??", "??", "??", "??"]], + [{"name":"ErrorsByCaller/Unknown/Unknown/Unknown/Unknown/allOther"}, + [1, "??", "??", "??", "??", "??"]], [{"name":"Errors/all"}, [1, "??", "??", "??", "??", "??"]], [{"name":"Errors/allOther"}, [1, "??", "??", "??", "??", "??"]], [{"name":"Errors/OtherTransaction/php__FILE__"}, [1, "??", "??", "??", "??", "??"]], diff --git a/tests/integration/api/set_appname/test_bad_params.php8.php b/tests/integration/api/set_appname/test_bad_params.php8.php index 657c3e5b5..2bc63e7d5 100644 --- a/tests/integration/api/set_appname/test_bad_params.php8.php +++ b/tests/integration/api/set_appname/test_bad_params.php8.php @@ -29,6 +29,10 @@ "?? timeframe start", "?? timeframe stop", [ + [{"name":"DurationByCaller/Unknown/Unknown/Unknown/Unknown/all"}, + [1, "??", "??", "??", "??", "??"]], + [{"name":"DurationByCaller/Unknown/Unknown/Unknown/Unknown/allOther"}, + [1, "??", "??", "??", "??", "??"]], [{"name":"OtherTransaction/all"}, [1, "??", "??", "??", "??", "??"]], [{"name":"OtherTransaction/php__FILE__"}, [1, "??", "??", "??", "??", "??"]], [{"name":"OtherTransactionTotalTime"}, [1, "??", "??", "??", "??", "??"]], diff --git a/tests/integration/api/set_appname/test_no_license.php b/tests/integration/api/set_appname/test_no_license.php index bfcb2cab8..ef905f5eb 100644 --- a/tests/integration/api/set_appname/test_no_license.php +++ b/tests/integration/api/set_appname/test_no_license.php @@ -18,6 +18,10 @@ "?? timeframe start", "?? timeframe stop", [ + [{"name":"DurationByCaller/Unknown/Unknown/Unknown/Unknown/all"}, + [1, "??", "??", "??", "??", "??"]], + [{"name":"DurationByCaller/Unknown/Unknown/Unknown/Unknown/allOther"}, + [1, "??", "??", "??", "??", "??"]], [{"name":"OtherTransaction/all"}, [1, "??", "??", "??", "??", "??"]], [{"name":"OtherTransaction/php__FILE__"}, [1, "??", "??", "??", "??", "??"]], [{"name":"OtherTransactionTotalTime"}, [1, "??", "??", "??", "??", "??"]], diff --git a/tests/integration/api/set_appname/test_transmit_false.php b/tests/integration/api/set_appname/test_transmit_false.php index 3b0a41920..2d29583c8 100644 --- a/tests/integration/api/set_appname/test_transmit_false.php +++ b/tests/integration/api/set_appname/test_transmit_false.php @@ -19,6 +19,10 @@ "?? timeframe start", "?? timeframe stop", [ + [{"name":"DurationByCaller/Unknown/Unknown/Unknown/Unknown/all"}, + [1, "??", "??", "??", "??", "??"]], + [{"name":"DurationByCaller/Unknown/Unknown/Unknown/Unknown/allOther"}, + [1, "??", "??", "??", "??", "??"]], [{"name":"OtherTransaction/all"}, [1, "??", "??", "??", "??", "??"]], [{"name":"OtherTransaction/php__FILE__"}, [1, "??", "??", "??", "??", "??"]], [{"name":"OtherTransactionTotalTime"}, [1, "??", "??", "??", "??", "??"]], diff --git a/tests/integration/api/set_appname/test_transmit_int.php b/tests/integration/api/set_appname/test_transmit_int.php index 1fc76bfd6..50c503e94 100644 --- a/tests/integration/api/set_appname/test_transmit_int.php +++ b/tests/integration/api/set_appname/test_transmit_int.php @@ -20,6 +20,10 @@ "?? timeframe start", "?? timeframe stop", [ + [{"name":"DurationByCaller/Unknown/Unknown/Unknown/Unknown/all"}, + [3, "??", "??", "??", "??", "??"]], + [{"name":"DurationByCaller/Unknown/Unknown/Unknown/Unknown/allOther"}, + [3, "??", "??", "??", "??", "??"]], [{"name":"OtherTransaction/all"}, [3, "??", "??", "??", "??", "??"]], [{"name":"OtherTransaction/php__FILE__"}, [3, "??", "??", "??", "??", "??"]], [{"name":"OtherTransactionTotalTime"}, [3, "??", "??", "??", "??", "??"]], diff --git a/tests/integration/api/set_appname/test_transmit_true.php b/tests/integration/api/set_appname/test_transmit_true.php index 2a269cfd2..b6cf23508 100644 --- a/tests/integration/api/set_appname/test_transmit_true.php +++ b/tests/integration/api/set_appname/test_transmit_true.php @@ -20,6 +20,10 @@ "?? timeframe start", "?? timeframe stop", [ + [{"name":"DurationByCaller/Unknown/Unknown/Unknown/Unknown/all"}, + [3, "??", "??", "??", "??", "??"]], + [{"name":"DurationByCaller/Unknown/Unknown/Unknown/Unknown/allOther"}, + [3, "??", "??", "??", "??", "??"]], [{"name":"OtherTransaction/all"}, [3, "??", "??", "??", "??", "??"]], [{"name":"OtherTransaction/php__FILE__"}, [3, "??", "??", "??", "??", "??"]], [{"name":"OtherTransactionTotalTime"}, [3, "??", "??", "??", "??", "??"]], diff --git a/tests/integration/attributes/test_disabled.php b/tests/integration/attributes/test_disabled.php index 74ff76cf6..ea29d217f 100644 --- a/tests/integration/attributes/test_disabled.php +++ b/tests/integration/attributes/test_disabled.php @@ -52,7 +52,11 @@ "timestamp": "??", "duration": "??", "totalTime": "??", - "error": true + "error": true, + "guid": "??", + "sampled": true, + "priority": "??", + "traceId": "??" }, {}, {} diff --git a/tests/integration/attributes/test_disabled_all.php b/tests/integration/attributes/test_disabled_all.php index 832bb4627..772addd7a 100644 --- a/tests/integration/attributes/test_disabled_all.php +++ b/tests/integration/attributes/test_disabled_all.php @@ -50,7 +50,11 @@ "timestamp": "??", "duration": "??", "totalTime": "??", - "error": true + "error": true, + "guid": "??", + "sampled": true, + "priority": "??", + "traceId": "??" }, {}, {} diff --git a/tests/integration/attributes/test_disabled_old.php b/tests/integration/attributes/test_disabled_old.php index f39e4b32d..f65d569c2 100644 --- a/tests/integration/attributes/test_disabled_old.php +++ b/tests/integration/attributes/test_disabled_old.php @@ -52,7 +52,11 @@ "timestamp": "??", "duration": "??", "totalTime": "??", - "error": true + "error": true, + "guid": "??", + "sampled": true, + "priority": "??", + "traceId": "??" }, {}, {} diff --git a/tests/integration/attributes/test_empty_request.php b/tests/integration/attributes/test_empty_request.php index 97db0a108..6c59063ae 100644 --- a/tests/integration/attributes/test_empty_request.php +++ b/tests/integration/attributes/test_empty_request.php @@ -69,7 +69,12 @@ "transactionName": "WebTransaction/Uri__FILE__", "duration": "??", "queueDuration": "??", - "nr.transactionGuid": "??" + "nr.transactionGuid": "??", + "guid": "??", + "sampled": true, + "priority": "??", + "traceId": "??", + "spanId": "??" }, {}, { diff --git a/tests/integration/attributes/test_enabled.php b/tests/integration/attributes/test_enabled.php index b2d5ffc94..8ee1b4e4b 100644 --- a/tests/integration/attributes/test_enabled.php +++ b/tests/integration/attributes/test_enabled.php @@ -53,7 +53,11 @@ "timestamp": "??", "duration": "??", "totalTime": "??", - "error": true + "error": true, + "guid": "??", + "sampled": true, + "priority": "??", + "traceId": "??" }, { "hat": "who" diff --git a/tests/integration/attributes/test_precedence.php b/tests/integration/attributes/test_precedence.php index 01a868691..a4622d6d0 100644 --- a/tests/integration/attributes/test_precedence.php +++ b/tests/integration/attributes/test_precedence.php @@ -62,7 +62,11 @@ "timestamp": "??", "duration": "??", "totalTime": "??", - "error": true + "error": true, + "guid": "??", + "sampled": true, + "priority": "??", + "traceId": "??" }, { "hat": "who" diff --git a/tests/integration/attributes/test_response_headers.php b/tests/integration/attributes/test_response_headers.php index 0c1293378..2f5ef841a 100644 --- a/tests/integration/attributes/test_response_headers.php +++ b/tests/integration/attributes/test_response_headers.php @@ -66,7 +66,12 @@ "transactionName": "WebTransaction/Uri__FILE__", "duration": "??", "queueDuration": "??", - "nr.transactionGuid": "??" + "nr.transactionGuid": "??", + "guid": "??", + "sampled": true, + "priority": "??", + "traceId": "??", + "spanId": "??" }, {}, { @@ -98,7 +103,11 @@ "totalTime": "??", "nr.apdexPerfZone": "F", "queueDuration": "??", - "error": true + "error": true, + "guid": "??", + "sampled": true, + "priority": "??", + "traceId": "??" }, { }, diff --git a/tests/integration/attributes/test_response_ini.php b/tests/integration/attributes/test_response_ini.php index 672c8a02f..b059b2f93 100644 --- a/tests/integration/attributes/test_response_ini.php +++ b/tests/integration/attributes/test_response_ini.php @@ -64,7 +64,12 @@ "transactionName": "WebTransaction/Uri__FILE__", "duration": "??", "queueDuration": "??", - "nr.transactionGuid": "??" + "nr.transactionGuid": "??", + "guid": "??", + "sampled": true, + "priority": "??", + "traceId": "??", + "spanId": "??" }, {}, { @@ -95,7 +100,11 @@ "totalTime": "??", "nr.apdexPerfZone": "F", "queueDuration": "??", - "error": true + "error": true, + "guid": "??", + "sampled": true, + "priority": "??", + "traceId": "??" }, { }, diff --git a/tests/integration/attributes/test_response_ini_set.php b/tests/integration/attributes/test_response_ini_set.php index 46eeaebb9..53200a43c 100644 --- a/tests/integration/attributes/test_response_ini_set.php +++ b/tests/integration/attributes/test_response_ini_set.php @@ -65,7 +65,12 @@ "transactionName": "WebTransaction/Uri__FILE__", "duration": "??", "queueDuration": "??", - "nr.transactionGuid": "??" + "nr.transactionGuid": "??", + "guid": "??", + "sampled": true, + "priority": "??", + "traceId": "??", + "spanId": "??" }, {}, { @@ -96,7 +101,11 @@ "totalTime": "??", "nr.apdexPerfZone": "F", "queueDuration": "??", - "error": true + "error": true, + "guid": "??", + "sampled": true, + "priority": "??", + "traceId": "??" }, { }, diff --git a/tests/integration/attributes/test_response_whitespace.php b/tests/integration/attributes/test_response_whitespace.php index 590e189fe..c11732dc1 100644 --- a/tests/integration/attributes/test_response_whitespace.php +++ b/tests/integration/attributes/test_response_whitespace.php @@ -61,7 +61,12 @@ "transactionName": "WebTransaction/Uri__FILE__", "duration": "??", "queueDuration": "??", - "nr.transactionGuid": "??" + "nr.transactionGuid": "??", + "guid": "??", + "sampled": true, + "priority": "??", + "traceId": "??", + "spanId": "??" }, {}, { @@ -93,7 +98,11 @@ "totalTime": "??", "nr.apdexPerfZone": "F", "queueDuration": "??", - "error": true + "error": true, + "guid": "??", + "sampled": true, + "priority": "??", + "traceId": "??" }, { }, diff --git a/tests/integration/attributes/test_transaction_background.php b/tests/integration/attributes/test_transaction_background.php index f3623e55b..45a48ed83 100644 --- a/tests/integration/attributes/test_transaction_background.php +++ b/tests/integration/attributes/test_transaction_background.php @@ -55,7 +55,12 @@ "error.message": "I'M COVERED IN BEES!", "transactionName": "OtherTransaction/php__FILE__", "duration": "??", - "nr.transactionGuid": "??" + "nr.transactionGuid": "??", + "guid": "??", + "sampled": true, + "priority": "??", + "traceId": "??", + "spanId": "??" }, {}, { @@ -80,7 +85,11 @@ "timestamp": "??", "duration": "??", "totalTime": "??", - "error": true + "error": true, + "guid": "??", + "sampled": true, + "priority": "??", + "traceId": "??" }, { }, diff --git a/tests/integration/attributes/test_transaction_non_web.php b/tests/integration/attributes/test_transaction_non_web.php index 26f98d61b..75f6aa56c 100644 --- a/tests/integration/attributes/test_transaction_non_web.php +++ b/tests/integration/attributes/test_transaction_non_web.php @@ -99,7 +99,7 @@ [ "?? agent run id", { - "reservoir_size": 1000, + "reservoir_size": 10000, "events_seen": 1 }, [ diff --git a/tests/integration/attributes/test_transaction_web.php b/tests/integration/attributes/test_transaction_web.php index 045c26baa..c5135df05 100644 --- a/tests/integration/attributes/test_transaction_web.php +++ b/tests/integration/attributes/test_transaction_web.php @@ -160,7 +160,7 @@ [ "?? agent run id", { - "reservoir_size": 1000, + "reservoir_size": 10000, "events_seen": 1 }, [ diff --git a/tests/integration/basic/test_call_user_func_array_0.php b/tests/integration/basic/test_call_user_func_array_0.php index 21fb2a087..217e65728 100644 --- a/tests/integration/basic/test_call_user_func_array_0.php +++ b/tests/integration/basic/test_call_user_func_array_0.php @@ -23,6 +23,10 @@ "?? timeframe start", "?? timeframe stop", [ + [{"name":"DurationByCaller/Unknown/Unknown/Unknown/Unknown/all"}, + [1, "??", "??", "??", "??", "??"]], + [{"name":"DurationByCaller/Unknown/Unknown/Unknown/Unknown/allOther"}, + [1, "??", "??", "??", "??", "??"]], [{"name":"Custom/foo"}, [1, "??", "??", "??", "??", "??"]], [{"name":"Custom/foo", "scope":"OtherTransaction/php__FILE__"}, [1, "??", "??", "??", "??", "??"]], [{"name":"OtherTransaction/all"}, [1, "??", "??", "??", "??", "??"]], diff --git a/tests/integration/basic/test_dl.php b/tests/integration/basic/test_dl.php index 0778bb843..9721e09c7 100644 --- a/tests/integration/basic/test_dl.php +++ b/tests/integration/basic/test_dl.php @@ -14,6 +14,14 @@ "?? timeframe start", "?? timeframe stop", [ + [{"name":"DurationByCaller/Unknown/Unknown/Unknown/Unknown/all"}, + [1, "??", "??", "??", "??", "??"]], + [{"name":"DurationByCaller/Unknown/Unknown/Unknown/Unknown/allOther"}, + [1, "??", "??", "??", "??", "??"]], + [{"name":"ErrorsByCaller/Unknown/Unknown/Unknown/Unknown/all"}, + [1, "??", "??", "??", "??", "??"]], + [{"name":"ErrorsByCaller/Unknown/Unknown/Unknown/Unknown/allOther"}, + [1, "??", "??", "??", "??", "??"]], [{"name":"Errors/all"}, [1, "??", "??", "??", "??", "??"]], [{"name":"Errors/allOther"}, [1, "??", "??", "??", "??", "??"]], [{"name":"Errors/OtherTransaction/php__FILE__"}, [1, "??", "??", "??", "??", "??"]], diff --git a/tests/integration/basic/test_internal_function.php b/tests/integration/basic/test_internal_function.php index 32c65f342..8cefca40d 100644 --- a/tests/integration/basic/test_internal_function.php +++ b/tests/integration/basic/test_internal_function.php @@ -46,7 +46,11 @@ "totalTime": "??", "cpu_time": "??", "cpu_user_time": "??", - "cpu_sys_time": "??" + "cpu_sys_time": "??", + "guid": "??", + "sampled": true, + "priority": "??", + "traceId": "??" } } ], diff --git a/tests/integration/basic/test_output_buffer.php b/tests/integration/basic/test_output_buffer.php index 5aa09f0b7..f2541431b 100644 --- a/tests/integration/basic/test_output_buffer.php +++ b/tests/integration/basic/test_output_buffer.php @@ -33,6 +33,10 @@ "?? timeframe start", "?? timeframe stop", [ + [{"name":"DurationByCaller/Unknown/Unknown/Unknown/Unknown/all"}, + [1, "??", "??", "??", "??", "??"]], + [{"name":"DurationByCaller/Unknown/Unknown/Unknown/Unknown/allOther"}, + [1, "??", "??", "??", "??", "??"]], [{"name":"OtherTransaction/all"}, [1, "??", "??", "??", "??", "??"]], [{"name":"OtherTransaction/php__FILE__"}, [1, "??", "??", "??", "??", "??"]], [{"name":"OtherTransactionTotalTime"}, [1, "??", "??", "??", "??", "??"]], diff --git a/tests/integration/distributed_tracing/newrelic/test_error_intrinsic.php b/tests/integration/distributed_tracing/newrelic/test_error_intrinsic.php index 7b40e6185..195540482 100644 --- a/tests/integration/distributed_tracing/newrelic/test_error_intrinsic.php +++ b/tests/integration/distributed_tracing/newrelic/test_error_intrinsic.php @@ -23,7 +23,11 @@ "timestamp": "??", "duration": "??", "totalTime": "??", - "error": false + "error": false, + "guid": "??", + "sampled": true, + "priority": "??", + "traceId": "??" }, {}, {} diff --git a/tests/integration/distributed_tracing/newrelic/test_error_intrinsic_error.php b/tests/integration/distributed_tracing/newrelic/test_error_intrinsic_error.php index 0dcb29ebd..f024ff549 100644 --- a/tests/integration/distributed_tracing/newrelic/test_error_intrinsic_error.php +++ b/tests/integration/distributed_tracing/newrelic/test_error_intrinsic_error.php @@ -24,7 +24,11 @@ "timestamp": "??", "duration": "??", "totalTime": "??", - "error": true + "error": true, + "guid": "??", + "sampled": true, + "priority": "??", + "traceId": "??" }, {}, { diff --git a/tests/integration/distributed_tracing/newrelic/test_error_intrinsic_exception.php b/tests/integration/distributed_tracing/newrelic/test_error_intrinsic_exception.php index 780308a56..5716e914e 100644 --- a/tests/integration/distributed_tracing/newrelic/test_error_intrinsic_exception.php +++ b/tests/integration/distributed_tracing/newrelic/test_error_intrinsic_exception.php @@ -24,7 +24,11 @@ "timestamp": "??", "duration": "??", "totalTime": "??", - "error": true + "error": true, + "guid": "??", + "sampled": true, + "priority": "??", + "traceId": "??" }, {}, { diff --git a/tests/integration/distributed_tracing/newrelic/test_intrinsics_notset_errors.php b/tests/integration/distributed_tracing/newrelic/test_intrinsics_notset_errors.php index 9d36fde26..79ec259a4 100644 --- a/tests/integration/distributed_tracing/newrelic/test_intrinsics_notset_errors.php +++ b/tests/integration/distributed_tracing/newrelic/test_intrinsics_notset_errors.php @@ -31,7 +31,11 @@ "totalTime": "??", "cpu_time": "??", "cpu_user_time": "??", - "cpu_sys_time": "??" + "cpu_sys_time": "??", + "guid": "??", + "sampled": true, + "priority": "??", + "traceId": "??" } } ] @@ -55,7 +59,12 @@ "error.message": "??", "transactionName": "??", "duration": "??", - "nr.transactionGuid": "??" + "nr.transactionGuid": "??", + "guid": "??", + "sampled": true, + "priority": "??", + "traceId": "??", + "spanId": "??" }, {}, {} diff --git a/tests/integration/distributed_tracing/newrelic/test_intrinsics_notset_txns.php b/tests/integration/distributed_tracing/newrelic/test_intrinsics_notset_txns.php index cb428545a..10fdd94cd 100644 --- a/tests/integration/distributed_tracing/newrelic/test_intrinsics_notset_txns.php +++ b/tests/integration/distributed_tracing/newrelic/test_intrinsics_notset_txns.php @@ -28,7 +28,11 @@ "timestamp": "??", "duration": "??", "totalTime": "??", - "error": false + "error": false, + "guid": "??", + "sampled": true, + "priority": "??", + "traceId": "??" }, {}, {} @@ -79,7 +83,11 @@ "totalTime": "??", "cpu_time": "??", "cpu_user_time": "??", - "cpu_sys_time": "??" + "cpu_sys_time": "??", + "guid": "??", + "sampled": true, + "priority": "??", + "traceId": "??" } } ], diff --git a/tests/integration/distributed_tracing/w3c/test_insert_dt_headers_nonref.php b/tests/integration/distributed_tracing/w3c/test_insert_dt_headers_nonref.php index 66530d246..5dda408f2 100644 --- a/tests/integration/distributed_tracing/w3c/test_insert_dt_headers_nonref.php +++ b/tests/integration/distributed_tracing/w3c/test_insert_dt_headers_nonref.php @@ -14,6 +14,14 @@ "?? start time", "?? stop time", [ + [{"name":"DurationByCaller/Unknown/Unknown/Unknown/Unknown/all"}, + [1, "??", "??", "??", "??", "??"]], + [{"name":"DurationByCaller/Unknown/Unknown/Unknown/Unknown/allOther"}, + [1, "??", "??", "??", "??", "??"]], + [{"name":"ErrorsByCaller/Unknown/Unknown/Unknown/Unknown/all"}, + [1, "??", "??", "??", "??", "??"]], + [{"name":"ErrorsByCaller/Unknown/Unknown/Unknown/Unknown/allOther"}, + [1, "??", "??", "??", "??", "??"]], [{"name":"Errors/OtherTransaction/php__FILE__"}, [1, "??", "??", "??", "??", "??"]], [{"name":"Errors/all"}, [1, "??", "??", "??", "??", "??"]], [{"name":"Errors/allOther"}, [1, "??", "??", "??", "??", "??"]], diff --git a/tests/integration/distributed_tracing/w3c/test_insert_dt_headers_wrong_arg_type.php b/tests/integration/distributed_tracing/w3c/test_insert_dt_headers_wrong_arg_type.php index 979f877a5..9006ba355 100644 --- a/tests/integration/distributed_tracing/w3c/test_insert_dt_headers_wrong_arg_type.php +++ b/tests/integration/distributed_tracing/w3c/test_insert_dt_headers_wrong_arg_type.php @@ -21,6 +21,14 @@ "?? start time", "?? stop time", [ + [{"name":"DurationByCaller/Unknown/Unknown/Unknown/Unknown/all"}, + [1, "??", "??", "??", "??", "??"]], + [{"name":"DurationByCaller/Unknown/Unknown/Unknown/Unknown/allOther"}, + [1, "??", "??", "??", "??", "??"]], + [{"name":"ErrorsByCaller/Unknown/Unknown/Unknown/Unknown/all"}, + [1, "??", "??", "??", "??", "??"]], + [{"name":"ErrorsByCaller/Unknown/Unknown/Unknown/Unknown/allOther"}, + [1, "??", "??", "??", "??", "??"]], [{"name":"Errors/OtherTransaction/php__FILE__"}, [1, "??", "??", "??", "??", "??"]], [{"name":"Errors/all"}, [1, "??", "??", "??", "??", "??"]], [{"name":"Errors/allOther"}, [1, "??", "??", "??", "??", "??"]], diff --git a/tests/integration/distributed_tracing/w3c/test_insert_dt_headers_wrong_arg_type.php8.php b/tests/integration/distributed_tracing/w3c/test_insert_dt_headers_wrong_arg_type.php8.php index f5ac17c4f..d12aadb5e 100644 --- a/tests/integration/distributed_tracing/w3c/test_insert_dt_headers_wrong_arg_type.php8.php +++ b/tests/integration/distributed_tracing/w3c/test_insert_dt_headers_wrong_arg_type.php8.php @@ -21,6 +21,14 @@ "?? start time", "?? stop time", [ + [{"name":"DurationByCaller/Unknown/Unknown/Unknown/Unknown/all"}, + [1, "??", "??", "??", "??", "??"]], + [{"name":"DurationByCaller/Unknown/Unknown/Unknown/Unknown/allOther"}, + [1, "??", "??", "??", "??", "??"]], + [{"name":"ErrorsByCaller/Unknown/Unknown/Unknown/Unknown/all"}, + [1, "??", "??", "??", "??", "??"]], + [{"name":"ErrorsByCaller/Unknown/Unknown/Unknown/Unknown/allOther"}, + [1, "??", "??", "??", "??", "??"]], [{"name":"Errors/OtherTransaction/php__FILE__"}, [1, "??", "??", "??", "??", "??"]], [{"name":"Errors/all"}, [1, "??", "??", "??", "??", "??"]], [{"name":"Errors/allOther"}, [1, "??", "??", "??", "??", "??"]], diff --git a/tests/integration/distributed_tracing/w3c/test_valid_inbound_no_sampled.php b/tests/integration/distributed_tracing/w3c/test_valid_inbound_no_sampled.php index 2a10ea431..d9a8e5726 100644 --- a/tests/integration/distributed_tracing/w3c/test_valid_inbound_no_sampled.php +++ b/tests/integration/distributed_tracing/w3c/test_valid_inbound_no_sampled.php @@ -88,7 +88,7 @@ [ "?? agent run id", { - "reservoir_size": 1000, + "reservoir_size": 10000, "events_seen": 1 }, [ diff --git a/tests/integration/distributed_tracing/w3c/test_valid_inbound_non_newrelic.php b/tests/integration/distributed_tracing/w3c/test_valid_inbound_non_newrelic.php index 186f91851..9bf409a68 100644 --- a/tests/integration/distributed_tracing/w3c/test_valid_inbound_non_newrelic.php +++ b/tests/integration/distributed_tracing/w3c/test_valid_inbound_non_newrelic.php @@ -87,7 +87,7 @@ [ "?? agent run id", { - "reservoir_size": 1000, + "reservoir_size": 10000, "events_seen": 1 }, [ diff --git a/tests/integration/distributed_tracing/w3c/test_valid_no_nr_state.php b/tests/integration/distributed_tracing/w3c/test_valid_no_nr_state.php index 22bd26234..92607ad78 100644 --- a/tests/integration/distributed_tracing/w3c/test_valid_no_nr_state.php +++ b/tests/integration/distributed_tracing/w3c/test_valid_no_nr_state.php @@ -77,7 +77,7 @@ [ "?? agent run id", { - "reservoir_size": 1000, + "reservoir_size": 10000, "events_seen": 1 }, [ diff --git a/tests/integration/errors/test_E_COMPILE_ERROR.zend.php b/tests/integration/errors/test_E_COMPILE_ERROR.zend.php index 30b87995e..01e6d5234 100644 --- a/tests/integration/errors/test_E_COMPILE_ERROR.zend.php +++ b/tests/integration/errors/test_E_COMPILE_ERROR.zend.php @@ -52,7 +52,12 @@ "error.message": "Cannot re-assign $this", "transactionName": "OtherTransaction\/php__FILE__", "duration": "??", - "nr.transactionGuid": "??" + "nr.transactionGuid": "??", + "guid": "??", + "sampled": true, + "priority": "??", + "traceId": "??", + "spanId": "??" }, {}, {} diff --git a/tests/integration/errors/test_E_COMPILE_WARNING.php b/tests/integration/errors/test_E_COMPILE_WARNING.php index 1cbc642bb..3391aa744 100644 --- a/tests/integration/errors/test_E_COMPILE_WARNING.php +++ b/tests/integration/errors/test_E_COMPILE_WARNING.php @@ -59,7 +59,12 @@ "error.message": "Unterminated comment starting line ??", "transactionName": "OtherTransaction\/php__FILE__", "duration": "??", - "nr.transactionGuid": "??" + "nr.transactionGuid": "??", + "guid": "??", + "sampled": true, + "priority": "??", + "traceId": "??", + "spanId": "??" }, {}, {} diff --git a/tests/integration/errors/test_E_COMPILE_WARNING.php8.php b/tests/integration/errors/test_E_COMPILE_WARNING.php8.php index 962175181..07c9f6615 100644 --- a/tests/integration/errors/test_E_COMPILE_WARNING.php8.php +++ b/tests/integration/errors/test_E_COMPILE_WARNING.php8.php @@ -59,7 +59,12 @@ "error.message": "Private methods cannot be final as they are never overridden by other classes", "transactionName": "OtherTransaction\/php__FILE__", "duration": "??", - "nr.transactionGuid": "??" + "nr.transactionGuid": "??", + "guid": "??", + "sampled": true, + "priority": "??", + "traceId": "??", + "spanId": "??" }, {}, {} diff --git a/tests/integration/errors/test_E_DEPRECATED_2.php5.php b/tests/integration/errors/test_E_DEPRECATED_2.php5.php index f94183b43..cf40c6d7f 100644 --- a/tests/integration/errors/test_E_DEPRECATED_2.php5.php +++ b/tests/integration/errors/test_E_DEPRECATED_2.php5.php @@ -61,7 +61,12 @@ "error.message": "preg_replace(): The \/e modifier is deprecated, use preg_replace_callback instead", "transactionName": "OtherTransaction\/php__FILE__", "duration": "??", - "nr.transactionGuid": "??" + "nr.transactionGuid": "??", + "guid": "??", + "sampled": true, + "priority": "??", + "traceId": "??", + "spanId": "??" }, {}, {} diff --git a/tests/integration/errors/test_E_DEPRECATED_2.php7.php b/tests/integration/errors/test_E_DEPRECATED_2.php7.php index f7ec3749d..ff5cd722c 100644 --- a/tests/integration/errors/test_E_DEPRECATED_2.php7.php +++ b/tests/integration/errors/test_E_DEPRECATED_2.php7.php @@ -65,7 +65,12 @@ "error.message": "mktime(): You should be using the time() function instead", "transactionName": "OtherTransaction\/php__FILE__", "duration": "??", - "nr.transactionGuid": "??" + "nr.transactionGuid": "??", + "guid": "??", + "sampled": true, + "priority": "??", + "traceId": "??", + "spanId": "??" }, {}, {} diff --git a/tests/integration/errors/test_E_DEPRECATED_2.php8.php b/tests/integration/errors/test_E_DEPRECATED_2.php8.php index dbb960da2..24026f767 100644 --- a/tests/integration/errors/test_E_DEPRECATED_2.php8.php +++ b/tests/integration/errors/test_E_DEPRECATED_2.php8.php @@ -63,7 +63,12 @@ "error.message": "Required parameter $b follows optional parameter $a", "transactionName": "OtherTransaction\/php__FILE__", "duration": "??", - "nr.transactionGuid": "??" + "nr.transactionGuid": "??", + "guid": "??", + "sampled": true, + "priority": "??", + "traceId": "??", + "spanId": "??" }, {}, {} diff --git a/tests/integration/errors/test_E_DEPRECATED_2.php81.php b/tests/integration/errors/test_E_DEPRECATED_2.php81.php index 2432e9e5f..91ffbed7b 100644 --- a/tests/integration/errors/test_E_DEPRECATED_2.php81.php +++ b/tests/integration/errors/test_E_DEPRECATED_2.php81.php @@ -60,7 +60,12 @@ "error.message": "Optional parameter $a declared before required parameter $b is implicitly treated as a required parameter", "transactionName": "OtherTransaction\/php__FILE__", "duration": "??", - "nr.transactionGuid": "??" + "nr.transactionGuid": "??", + "guid": "??", + "sampled": true, + "priority": "??", + "traceId": "??", + "spanId": "??" }, {}, {} diff --git a/tests/integration/errors/test_E_DEPRECATED_payload1.php b/tests/integration/errors/test_E_DEPRECATED_payload1.php index a1f1b5976..14b6ab3c2 100644 --- a/tests/integration/errors/test_E_DEPRECATED_payload1.php +++ b/tests/integration/errors/test_E_DEPRECATED_payload1.php @@ -56,7 +56,12 @@ "error.message": "Function newrelic_accept_distributed_trace_payload() is deprecated. Please see https://docs.newrelic.com/docs/agents/php-agent/features/distributed-tracing-php-agent#manual for more details.", "transactionName": "OtherTransaction\/php__FILE__", "duration": "??", - "nr.transactionGuid": "??" + "nr.transactionGuid": "??", + "guid": "??", + "sampled": true, + "priority": "??", + "traceId": "??", + "spanId": "??" }, {}, {} diff --git a/tests/integration/errors/test_E_DEPRECATED_payload2.php b/tests/integration/errors/test_E_DEPRECATED_payload2.php index cebe53e0b..64c5116eb 100644 --- a/tests/integration/errors/test_E_DEPRECATED_payload2.php +++ b/tests/integration/errors/test_E_DEPRECATED_payload2.php @@ -57,7 +57,12 @@ "error.message": "Function newrelic_accept_distributed_trace_payload_httpsafe() is deprecated. Please see https://docs.newrelic.com/docs/agents/php-agent/features/distributed-tracing-php-agent#manual for more details.", "transactionName": "OtherTransaction\/php__FILE__", "duration": "??", - "nr.transactionGuid": "??" + "nr.transactionGuid": "??", + "guid": "??", + "sampled": true, + "priority": "??", + "traceId": "??", + "spanId": "??" }, {}, {} diff --git a/tests/integration/errors/test_E_DEPRECATED_payload3.php b/tests/integration/errors/test_E_DEPRECATED_payload3.php index a6d87fd13..e0388eef3 100644 --- a/tests/integration/errors/test_E_DEPRECATED_payload3.php +++ b/tests/integration/errors/test_E_DEPRECATED_payload3.php @@ -57,7 +57,12 @@ "error.message": "Function newrelic_create_distributed_trace_payload() is deprecated. Please see https://docs.newrelic.com/docs/agents/php-agent/features/distributed-tracing-php-agent#manual for more details.", "transactionName": "OtherTransaction\/php__FILE__", "duration": "??", - "nr.transactionGuid": "??" + "nr.transactionGuid": "??", + "guid": "??", + "sampled": true, + "priority": "??", + "traceId": "??", + "spanId": "??" }, {}, {} diff --git a/tests/integration/errors/test_E_ERROR.php5.php b/tests/integration/errors/test_E_ERROR.php5.php index 6c50c0585..4ab8fd6bd 100644 --- a/tests/integration/errors/test_E_ERROR.php5.php +++ b/tests/integration/errors/test_E_ERROR.php5.php @@ -53,7 +53,12 @@ "error.message": "Call to undefined function not_a_function()", "transactionName": "OtherTransaction\/php__FILE__", "duration": "??", - "nr.transactionGuid": "??" + "nr.transactionGuid": "??", + "guid": "??", + "sampled": true, + "priority": "??", + "traceId": "??", + "spanId": "??" }, {}, {} diff --git a/tests/integration/errors/test_E_ERROR.php7.0.0.php b/tests/integration/errors/test_E_ERROR.php7.0.0.php index d3751179e..815e16fd7 100644 --- a/tests/integration/errors/test_E_ERROR.php7.0.0.php +++ b/tests/integration/errors/test_E_ERROR.php7.0.0.php @@ -55,7 +55,12 @@ "error.message": "Method C::__toString() must not throw an exception", "transactionName": "OtherTransaction\/php__FILE__", "duration": "??", - "nr.transactionGuid": "??" + "nr.transactionGuid": "??", + "guid": "??", + "sampled": true, + "priority": "??", + "traceId": "??", + "spanId": "??" }, {}, {} diff --git a/tests/integration/errors/test_E_ERROR.php7.0.1.php b/tests/integration/errors/test_E_ERROR.php7.0.1.php index 5ad1d1b99..a63e76088 100644 --- a/tests/integration/errors/test_E_ERROR.php7.0.1.php +++ b/tests/integration/errors/test_E_ERROR.php7.0.1.php @@ -54,7 +54,12 @@ "error.message": "Method C::__toString() must not throw an exception, caught Exception: ", "transactionName": "OtherTransaction\/php__FILE__", "duration": "??", - "nr.transactionGuid": "??" + "nr.transactionGuid": "??", + "guid": "??", + "sampled": true, + "priority": "??", + "traceId": "??", + "spanId": "??" }, {}, {} diff --git a/tests/integration/errors/test_E_ERROR.php7.4.php b/tests/integration/errors/test_E_ERROR.php7.4.php index 1b7642d41..a84a4d94d 100644 --- a/tests/integration/errors/test_E_ERROR.php7.4.php +++ b/tests/integration/errors/test_E_ERROR.php7.4.php @@ -50,7 +50,12 @@ "error.message": "Uncaught exception 'Exception' with message '' in __FILE__:??", "transactionName": "OtherTransaction\/php__FILE__", "duration": "??", - "nr.transactionGuid": "??" + "nr.transactionGuid": "??", + "guid": "??", + "sampled": true, + "priority": "??", + "traceId": "??", + "spanId": "??" }, {}, {} diff --git a/tests/integration/errors/test_E_PARSE.zend.php b/tests/integration/errors/test_E_PARSE.zend.php index 73eb3034f..5946a7788 100644 --- a/tests/integration/errors/test_E_PARSE.zend.php +++ b/tests/integration/errors/test_E_PARSE.zend.php @@ -59,7 +59,12 @@ "error.message": "syntax error, unexpected '}'", "transactionName": "OtherTransaction\/php__FILE__", "duration": "??", - "nr.transactionGuid": "??" + "nr.transactionGuid": "??", + "guid": "??", + "sampled": true, + "priority": "??", + "traceId": "??", + "spanId": "??" }, {}, {} diff --git a/tests/integration/errors/test_E_PARSE.zend.php8.php b/tests/integration/errors/test_E_PARSE.zend.php8.php index 092e81671..66b664913 100644 --- a/tests/integration/errors/test_E_PARSE.zend.php8.php +++ b/tests/integration/errors/test_E_PARSE.zend.php8.php @@ -59,7 +59,12 @@ "error.message": "syntax error, unexpected token \"}\"", "transactionName": "OtherTransaction\/php__FILE__", "duration": "??", - "nr.transactionGuid": "??" + "nr.transactionGuid": "??", + "guid": "??", + "sampled": true, + "priority": "??", + "traceId": "??", + "spanId": "??" }, {}, {} diff --git a/tests/integration/errors/test_E_RECOVERABLE.php5.php b/tests/integration/errors/test_E_RECOVERABLE.php5.php index e0c933e98..aba064930 100644 --- a/tests/integration/errors/test_E_RECOVERABLE.php5.php +++ b/tests/integration/errors/test_E_RECOVERABLE.php5.php @@ -57,7 +57,12 @@ "error.message": "Object of class stdClass could not be converted to string", "transactionName": "OtherTransaction\/php__FILE__", "duration": "??", - "nr.transactionGuid": "??" + "nr.transactionGuid": "??", + "guid": "??", + "sampled": true, + "priority": "??", + "traceId": "??", + "spanId": "??" }, {}, {} diff --git a/tests/integration/errors/test_E_RECOVERABLE.php7.4.php b/tests/integration/errors/test_E_RECOVERABLE.php7.4.php index 582c6a547..ec585ed43 100644 --- a/tests/integration/errors/test_E_RECOVERABLE.php7.4.php +++ b/tests/integration/errors/test_E_RECOVERABLE.php7.4.php @@ -56,7 +56,12 @@ "error.message": "Uncaught exception 'Error' with message 'Object of class stdClass could not be converted to string' in __FILE__:??", "transactionName": "OtherTransaction\/php__FILE__", "duration": "??", - "nr.transactionGuid": "??" + "nr.transactionGuid": "??", + "guid": "??", + "sampled": true, + "priority": "??", + "traceId": "??", + "spanId": "??" }, {}, {} diff --git a/tests/integration/errors/test_E_RECOVERABLE.php7.php b/tests/integration/errors/test_E_RECOVERABLE.php7.php index 947b6a192..90411a8b7 100644 --- a/tests/integration/errors/test_E_RECOVERABLE.php7.php +++ b/tests/integration/errors/test_E_RECOVERABLE.php7.php @@ -59,7 +59,12 @@ "error.message": "Object of class stdClass could not be converted to string", "transactionName": "OtherTransaction\/php__FILE__", "duration": "??", - "nr.transactionGuid": "??" + "nr.transactionGuid": "??", + "guid": "??", + "sampled": true, + "priority": "??", + "traceId": "??", + "spanId": "??" }, {}, {} diff --git a/tests/integration/errors/test_E_STRICT.php5.php b/tests/integration/errors/test_E_STRICT.php5.php index 96cf4a6c2..240582e98 100644 --- a/tests/integration/errors/test_E_STRICT.php5.php +++ b/tests/integration/errors/test_E_STRICT.php5.php @@ -62,7 +62,12 @@ "error.message": "mktime(): You should be using the time() function instead", "transactionName": "OtherTransaction\/php__FILE__", "duration": "??", - "nr.transactionGuid": "??" + "nr.transactionGuid": "??", + "guid": "??", + "sampled": true, + "priority": "??", + "traceId": "??", + "spanId": "??" }, {}, {} diff --git a/tests/integration/errors/test_E_STRICT.php7.php b/tests/integration/errors/test_E_STRICT.php7.php index ccb55508b..30b12af98 100644 --- a/tests/integration/errors/test_E_STRICT.php7.php +++ b/tests/integration/errors/test_E_STRICT.php7.php @@ -63,7 +63,12 @@ "error.message": "htmlentities(): Only basic entities substitution is supported for multi-byte encodings other than UTF-8; functionality is equivalent to htmlspecialchars", "transactionName": "OtherTransaction\/php__FILE__", "duration": "??", - "nr.transactionGuid": "??" + "nr.transactionGuid": "??", + "guid": "??", + "sampled": true, + "priority": "??", + "traceId": "??", + "spanId": "??" }, {}, {} diff --git a/tests/integration/errors/test_E_USER_DEPRECATED.php b/tests/integration/errors/test_E_USER_DEPRECATED.php index 8870a7d64..8b644d936 100644 --- a/tests/integration/errors/test_E_USER_DEPRECATED.php +++ b/tests/integration/errors/test_E_USER_DEPRECATED.php @@ -55,7 +55,12 @@ "error.message": "Sample E_USER_DEPRECATED", "transactionName": "OtherTransaction\/php__FILE__", "duration": "??", - "nr.transactionGuid": "??" + "nr.transactionGuid": "??", + "guid": "??", + "sampled": true, + "priority": "??", + "traceId": "??", + "spanId": "??" }, {}, {} diff --git a/tests/integration/errors/test_E_USER_ERROR.php b/tests/integration/errors/test_E_USER_ERROR.php index 6819383fa..b29fbf978 100644 --- a/tests/integration/errors/test_E_USER_ERROR.php +++ b/tests/integration/errors/test_E_USER_ERROR.php @@ -55,7 +55,12 @@ "error.message": "Sample E_USER_ERROR", "transactionName": "OtherTransaction\/php__FILE__", "duration": "??", - "nr.transactionGuid": "??" + "nr.transactionGuid": "??", + "guid": "??", + "sampled": true, + "priority": "??", + "traceId": "??", + "spanId": "??" }, {}, {} diff --git a/tests/integration/errors/test_E_USER_WARNING.php b/tests/integration/errors/test_E_USER_WARNING.php index 12050265b..4f502dba1 100644 --- a/tests/integration/errors/test_E_USER_WARNING.php +++ b/tests/integration/errors/test_E_USER_WARNING.php @@ -55,7 +55,12 @@ "error.message": "Sample E_USER_WARNING", "transactionName": "OtherTransaction\/php__FILE__", "duration": "??", - "nr.transactionGuid": "??" + "nr.transactionGuid": "??", + "guid": "??", + "sampled": true, + "priority": "??", + "traceId": "??", + "spanId": "??" }, {}, {} diff --git a/tests/integration/errors/test_E_WARNING.php5.php b/tests/integration/errors/test_E_WARNING.php5.php index 007ce497a..fd854a28e 100644 --- a/tests/integration/errors/test_E_WARNING.php5.php +++ b/tests/integration/errors/test_E_WARNING.php5.php @@ -57,7 +57,12 @@ "error.message": "Division by zero", "transactionName": "OtherTransaction\/php__FILE__", "duration": "??", - "nr.transactionGuid": "??" + "nr.transactionGuid": "??", + "guid": "??", + "sampled": true, + "priority": "??", + "traceId": "??", + "spanId": "??" }, {}, {} diff --git a/tests/integration/errors/test_E_WARNING.php7.php b/tests/integration/errors/test_E_WARNING.php7.php index 6105efbfa..1eb654bff 100644 --- a/tests/integration/errors/test_E_WARNING.php7.php +++ b/tests/integration/errors/test_E_WARNING.php7.php @@ -64,7 +64,12 @@ "error.message": "Division by zero", "transactionName": "OtherTransaction\/php__FILE__", "duration": "??", - "nr.transactionGuid": "??" + "nr.transactionGuid": "??", + "guid": "??", + "sampled": true, + "priority": "??", + "traceId": "??", + "spanId": "??" }, {}, {} diff --git a/tests/integration/errors/test_E_WARNING.php8.php b/tests/integration/errors/test_E_WARNING.php8.php index ebf1b6e6a..2b9d87f90 100644 --- a/tests/integration/errors/test_E_WARNING.php8.php +++ b/tests/integration/errors/test_E_WARNING.php8.php @@ -59,7 +59,12 @@ "error.message": "/include\\(\\): Failed opening 'abc.php' for inclusion \\(include_path='.:.*'\\)/", "transactionName": "OtherTransaction\/php__FILE__", "duration": "??", - "nr.transactionGuid": "??" + "nr.transactionGuid": "??", + "guid": "??", + "sampled": true, + "priority": "??", + "traceId": "??", + "spanId": "??" }, {}, {} diff --git a/tests/integration/errors/test_exception.php b/tests/integration/errors/test_exception.php index 042c71e41..da19f3d31 100644 --- a/tests/integration/errors/test_exception.php +++ b/tests/integration/errors/test_exception.php @@ -48,7 +48,12 @@ "error.message": "Uncaught exception 'Exception' with message 'Sample Exception' in __FILE__:??", "transactionName": "OtherTransaction\/php__FILE__", "duration": "??", - "nr.transactionGuid": "??" + "nr.transactionGuid": "??", + "guid": "??", + "sampled": true, + "priority": "??", + "traceId": "??", + "spanId": "??" }, {}, {} diff --git a/tests/integration/errors/test_ignore_all_except_E_WARNING.php5.php b/tests/integration/errors/test_ignore_all_except_E_WARNING.php5.php index f2e316058..1771d9dc7 100644 --- a/tests/integration/errors/test_ignore_all_except_E_WARNING.php5.php +++ b/tests/integration/errors/test_ignore_all_except_E_WARNING.php5.php @@ -63,7 +63,12 @@ "error.message": "Division by zero", "transactionName": "OtherTransaction\/php__FILE__", "duration": "??", - "nr.transactionGuid": "??" + "nr.transactionGuid": "??", + "guid": "??", + "sampled": true, + "priority": "??", + "traceId": "??", + "spanId": "??" }, {}, {} diff --git a/tests/integration/errors/test_ignore_all_except_E_WARNING.php7.php b/tests/integration/errors/test_ignore_all_except_E_WARNING.php7.php index 8d04997d1..0f3beadce 100644 --- a/tests/integration/errors/test_ignore_all_except_E_WARNING.php7.php +++ b/tests/integration/errors/test_ignore_all_except_E_WARNING.php7.php @@ -67,7 +67,12 @@ "error.message": "Division by zero", "transactionName": "OtherTransaction\/php__FILE__", "duration": "??", - "nr.transactionGuid": "??" + "nr.transactionGuid": "??", + "guid": "??", + "sampled": true, + "priority": "??", + "traceId": "??", + "spanId": "??" }, {}, {} diff --git a/tests/integration/errors/test_ignore_all_except_E_WARNING.php8.php b/tests/integration/errors/test_ignore_all_except_E_WARNING.php8.php index d6127b6e4..faaa2c09c 100644 --- a/tests/integration/errors/test_ignore_all_except_E_WARNING.php8.php +++ b/tests/integration/errors/test_ignore_all_except_E_WARNING.php8.php @@ -62,7 +62,12 @@ "error.message": "/include\\(\\): Failed opening 'abc.php' for inclusion \\(include_path='.:.*'\\)/", "transactionName": "OtherTransaction\/php__FILE__", "duration": "??", - "nr.transactionGuid": "??" + "nr.transactionGuid": "??", + "guid": "??", + "sampled": true, + "priority": "??", + "traceId": "??", + "spanId": "??" }, {}, {} diff --git a/tests/integration/errors/test_large_error_message.php b/tests/integration/errors/test_large_error_message.php new file mode 100644 index 000000000..a734119cf --- /dev/null +++ b/tests/integration/errors/test_large_error_message.php @@ -0,0 +1,66 @@ +/all"}, [2, "??", "??", "??", "??", "??"]], [{"name":"External//all", "scope":"OtherTransaction/php__FILE__"}, [2, "??", "??", "??", "??", "??"]], diff --git a/tests/integration/external/curl_exec/test_missing_handle.php b/tests/integration/external/curl_exec/test_missing_handle.php index caff941dc..0fc8980b5 100644 --- a/tests/integration/external/curl_exec/test_missing_handle.php +++ b/tests/integration/external/curl_exec/test_missing_handle.php @@ -22,6 +22,14 @@ "?? start time", "?? stop time", [ + [{"name":"DurationByCaller/Unknown/Unknown/Unknown/Unknown/all"}, + [1, "??", "??", "??", "??", "??"]], + [{"name":"DurationByCaller/Unknown/Unknown/Unknown/Unknown/allOther"}, + [1, "??", "??", "??", "??", "??"]], + [{"name": "ErrorsByCaller/Unknown/Unknown/Unknown/Unknown/all"}, + [1, "??", "??", "??", "??", "??"]], + [{"name": "ErrorsByCaller/Unknown/Unknown/Unknown/Unknown/allOther"}, + [1, "??", "??", "??", "??", "??"]], [{"name":"Errors/all"}, [1, "??", "??", "??", "??", "??"]], [{"name":"Errors/allOther"}, [1, "??", "??", "??", "??", "??"]], [{"name":"Errors/OtherTransaction/php__FILE__"}, [1, "??", "??", "??", "??", "??"]], diff --git a/tests/integration/external/curl_exec/test_span_sets_method.php b/tests/integration/external/curl_exec/test_span_sets_method.php index 6ef89faea..06e9e3935 100644 --- a/tests/integration/external/curl_exec/test_span_sets_method.php +++ b/tests/integration/external/curl_exec/test_span_sets_method.php @@ -26,7 +26,7 @@ [ "?? agent run id", { - "reservoir_size": 1000, + "reservoir_size": 10000, "events_seen": 5 }, [ diff --git a/tests/integration/external/curl_exec/test_synthetics.php b/tests/integration/external/curl_exec/test_synthetics.php index 6388a3307..67627a5b9 100644 --- a/tests/integration/external/curl_exec/test_synthetics.php +++ b/tests/integration/external/curl_exec/test_synthetics.php @@ -27,6 +27,11 @@ * ] */ +/*INI +newrelic.distributed_tracing_enabled=0 +newrelic.cross_application_tracer.enabled = true +*/ + /*HEADERS X-NewRelic-Synthetics=ENV[SYNTHETICS_HEADER_supportability] */ @@ -76,7 +81,7 @@ function test_curl() { $url = "http://" . make_tracing_url(realpath(dirname(__FILE__)) . '/../../../include/tracing_endpoint.php'); $ch = curl_init($url); - + $result = curl_exec($ch); if (false !== $result) { tap_ok("execute request"); diff --git a/tests/integration/external/curl_exec/test_synthetics_disabled.php b/tests/integration/external/curl_exec/test_synthetics_disabled.php index 2520c3896..9018f0767 100644 --- a/tests/integration/external/curl_exec/test_synthetics_disabled.php +++ b/tests/integration/external/curl_exec/test_synthetics_disabled.php @@ -17,7 +17,9 @@ */ /*INI +newrelic.distributed_tracing_enabled=0 newrelic.synthetics.enabled = false +newrelic.cross_application_tracer.enabled = true */ /* diff --git a/tests/integration/external/curl_exec/test_type_mismatch.php b/tests/integration/external/curl_exec/test_type_mismatch.php index 9c02577ad..af835dd37 100644 --- a/tests/integration/external/curl_exec/test_type_mismatch.php +++ b/tests/integration/external/curl_exec/test_type_mismatch.php @@ -21,6 +21,14 @@ "?? start time", "?? stop time", [ + [{"name":"DurationByCaller/Unknown/Unknown/Unknown/Unknown/all"}, + [1, "??", "??", "??", "??", "??"]], + [{"name":"DurationByCaller/Unknown/Unknown/Unknown/Unknown/allOther"}, + [1, "??", "??", "??", "??", "??"]], + [{"name": "ErrorsByCaller/Unknown/Unknown/Unknown/Unknown/all"}, + [1, "??", "??", "??", "??", "??"]], + [{"name": "ErrorsByCaller/Unknown/Unknown/Unknown/Unknown/allOther"}, + [1, "??", "??", "??", "??", "??"]], [{"name":"Errors/all"}, [1, "??", "??", "??", "??", "??"]], [{"name":"Errors/allOther"}, [1, "??", "??", "??", "??", "??"]], [{"name":"Errors/OtherTransaction/php__FILE__"}, [1, "??", "??", "??", "??", "??"]], diff --git a/tests/integration/external/curl_multi_exec/test_cat_simple.php b/tests/integration/external/curl_multi_exec/test_cat_simple.php index 95085c750..d4b084423 100644 --- a/tests/integration/external/curl_multi_exec/test_cat_simple.php +++ b/tests/integration/external/curl_multi_exec/test_cat_simple.php @@ -19,6 +19,11 @@ } */ +/*INI +newrelic.distributed_tracing_enabled=0 +newrelic.cross_application_tracer.enabled = true +*/ + /*EXPECT tracing endpoint reached tracing endpoint reached diff --git a/tests/integration/external/curl_multi_exec/test_http.php b/tests/integration/external/curl_multi_exec/test_http.php index dcea56984..b33b80ea9 100644 --- a/tests/integration/external/curl_multi_exec/test_http.php +++ b/tests/integration/external/curl_multi_exec/test_http.php @@ -29,6 +29,13 @@ "?? start time", "?? stop time", [ + [{"name":"DurationByCaller/Unknown/Unknown/Unknown/Unknown/all"}, + [1, "??", "??", "??", "??", "??"]], + [{"name":"DurationByCaller/Unknown/Unknown/Unknown/Unknown/allOther"}, + [1, "??", "??", "??", "??", "??"]], + [{"name": "Supportability/TraceContext/Create/Success"}, [4, "??", "??", "??", "??", "??"]], + [{"name": "Supportability/DistributedTrace/CreatePayload/Success"}, + [4, "??", "??", "??", "??", "??"]], [{"name":"External/all"}, [4, "??", "??", "??", "??", "??"]], [{"name":"External/allOther"}, [4, "??", "??", "??", "??", "??"]], [{"name":"External/127.0.0.1/all"}, [4, "??", "??", "??", "??", "??"]], diff --git a/tests/integration/external/curl_multi_exec/test_malformed_url.php b/tests/integration/external/curl_multi_exec/test_malformed_url.php index d84e51a5b..0feb80ea2 100644 --- a/tests/integration/external/curl_multi_exec/test_malformed_url.php +++ b/tests/integration/external/curl_multi_exec/test_malformed_url.php @@ -8,6 +8,10 @@ Test the agent's handling of malformed urls passed to curl_multi_exec(). */ +/*INI +newrelic.distributed_tracing_enabled=0 +*/ + /*SKIPIF 2097152)` +The maximum without DT is 7200; however, it causes +the listener to slow down so much that it will cause intermittent failures on other samples_stored tests. +Only 7000 span events must be sent when the limit is set to 7000. +*/ + +/*INI +newrelic.distributed_tracing_enabled = 1 +newrelic.transaction_tracer.threshold = 0 +newrelic.cross_application_tracer.enabled = false +newrelic.span_events.max_samples_stored = 7000 +*/ + +/*EXPECT_SPAN_EVENTS +[ + "?? agent run id", + { + "reservoir_size": 10000, + "events_seen": 7000 + }, + "??" +] +*/ + +newrelic_add_custom_tracer('main'); +function main() +{ + usleep(10); +} + +$sample_size = 10000; + +for ($i = 0; $i < $sample_size; $i++) { + main(); +} diff --git a/tests/integration/span_events/test_span_events_max_samples_stored6.php b/tests/integration/span_events/test_span_events_max_samples_stored6.php new file mode 100644 index 000000000..e03ec651e --- /dev/null +++ b/tests/integration/span_events/test_span_events_max_samples_stored6.php @@ -0,0 +1,42 @@ +Leave me alone!"} */