From a81ea3938599ce4ca29c90606db881e007492098 Mon Sep 17 00:00:00 2001 From: ZNeumann Date: Wed, 16 Mar 2022 11:17:15 -0600 Subject: [PATCH 01/12] Configurable span reservoir size (#384) * feat: change max_span_events variable to conform to agent spec; increase default to 2000 * feat: increase daemon reservoir size to 10K * fix integration tests to accommodate new span reservoir size * fix: update variable name changed to match agent spec hidden by gitignore * Update newrelic.ini.template --- .gitignore | 2 +- agent/php_newrelic.h | 2 +- agent/php_nrini.c | 4 +-- agent/php_txn.c | 2 +- agent/scripts/newrelic.ini.private.template | 9 ------ agent/scripts/newrelic.ini.template | 11 +++++++ axiom/cmd_appinfo_transmit.c | 3 +- axiom/nr_limits.h | 9 ++++-- axiom/nr_txn.c | 13 +++++---- axiom/nr_txn.h | 9 ++++-- axiom/tests/test_app_helpers.h | 2 +- axiom/tests/test_cmd_appinfo.c | 3 +- axiom/tests/test_cmd_txndata.c | 5 ++-- axiom/tests/test_segment.c | 8 ++--- axiom/tests/test_segment_helpers.h | 2 +- axiom/tests/test_txn.c | 29 +++++++++++-------- src/flatbuffersdata/data_test.go | 2 +- src/newrelic/app_test.go | 4 +-- src/newrelic/limits/limits.go | 2 +- .../add_custom_parameter/test_span_event.php | 2 +- .../test_span_event_parameter_disabled.php | 2 +- .../test_span_event_parameter_duplicate.php | 2 +- ..._span_event_parameter_duplicate_te_off.php | 2 +- .../test_span_event_parameter_filter.php | 2 +- .../test_span_event_parameter_invalid.php | 2 +- .../test_span_event_parameter_max_key.php | 2 +- ...st_span_event_parameter_max_key_te_off.php | 2 +- ...st_span_event_parameter_max_parameters.php | 2 +- .../test_span_event_parameter_max_value.php | 2 +- ..._span_event_parameter_max_value_te_off.php | 2 +- ...pan_event_parameter_maxplus_parameters.php | 2 +- ...nt_parameter_maxplus_parameters_te_off.php | 2 +- ...an_event_parameter_maxplus_span_and_te.php | 2 +- ...t_parameter_maxplus_span_and_te_te_off.php | 2 +- .../test_span_event_parameter_overwrite.php | 2 +- .../test_span_event_parameter_te_off.php | 2 +- .../test_span_event_parameter_types.php | 2 +- .../newrelic/test_keep_span_with_payload.php | 2 +- .../attributes/test_transaction_non_web.php | 2 +- .../attributes/test_transaction_web.php | 2 +- .../w3c/test_valid_inbound_no_sampled.php | 2 +- .../w3c/test_valid_inbound_non_newrelic.php | 2 +- .../w3c/test_valid_no_nr_state.php | 2 +- .../test_dt_correct_span_is_external.php | 2 +- .../curl_exec/test_dt_span_customrequest.php | 2 +- .../curl_exec/test_span_sets_method.php | 2 +- .../curl_multi_exec/test_span_sets_method.php | 2 +- .../test_spans_are_created_correctly.php | 2 +- .../external/guzzle5/test_spans_external.php | 2 +- .../test_spans_are_created_correctly.php | 2 +- ..._span_events_are_created_from_segments.php | 2 +- ...n_events_are_created_upon_caught_error.php | 2 +- ...ents_are_created_upon_caught_exception.php | 2 +- ...test_span_events_are_created_upon_exit.php | 2 +- ...events_are_created_upon_uncaught_error.php | 2 +- ...ts_are_created_upon_uncaught_exception.php | 2 +- ...t_span_events_error_collector_disabled.php | 2 +- ...st_span_events_exception_caught_nested.php | 2 +- ...vents_exception_caught_nested_rethrown.php | 2 +- ...n_events_exception_caught_notice_error.php | 2 +- ...s_exception_caught_notice_error_nested.php | 2 +- ...span_events_exception_caught_same_span.php | 2 +- ..._span_events_exception_uncaught_nested.php | 2 +- ...est_span_events_exist_when_no_segments.php | 2 +- .../test_span_events_hsm_error.php | 2 +- .../test_span_events_notice_error.php | 2 +- .../span_events/test_span_events_on_dt_on.php | 2 +- .../test_span_events_root_parent.php | 2 +- .../test_span_events_special_max_10.php | 4 +-- .../test_span_events_special_max_disabled.php | 10 +++---- 70 files changed, 127 insertions(+), 106 deletions(-) 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/agent/php_newrelic.h b/agent/php_newrelic.h index f4a13e3e9..0cee7e1fc 100644 --- a/agent/php_newrelic.h +++ b/agent/php_newrelic.h @@ -445,7 +445,7 @@ 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 */ +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 diff --git a/agent/php_nrini.c b/agent/php_nrini.c index 6e054f9d4..07fdaa41e 100644 --- a/agent/php_nrini.c +++ b/agent/php_nrini.c @@ -2586,11 +2586,11 @@ STD_PHP_INI_ENTRY_EX("newrelic.span_events_enabled", newrelic_globals, 0) -STD_PHP_INI_ENTRY_EX("newrelic.special.max_span_events", +STD_PHP_INI_ENTRY_EX("newrelic.span_events.max_samples_stored", "0", NR_PHP_REQUEST, nr_unsigned_int_mh, - max_span_events, + span_events_max_samples_stored, zend_newrelic_globals, newrelic_globals, 0) diff --git a/agent/php_txn.c b/agent/php_txn.c index 575977af1..dcf2754ef 100644 --- a/agent/php_txn.c +++ b/agent/php_txn.c @@ -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); 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..c2e5c97cd 100644 --- a/agent/scripts/newrelic.ini.template +++ b/agent/scripts/newrelic.ini.template @@ -898,6 +898,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/axiom/cmd_appinfo_transmit.c b/axiom/cmd_appinfo_transmit.c index a0c3578ab..8d6999aa8 100644 --- a/axiom/cmd_appinfo_transmit.c +++ b/axiom/cmd_appinfo_transmit.c @@ -396,7 +396,8 @@ 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", + NR_DEFAULT_SPAN_EVENTS_MAX_SAMPLES_STORED); } int nr_cmd_appinfo_process_get_harvest_limit(const nrobj_t* limits, 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..5e8da2e55 100644 --- a/axiom/nr_txn.h +++ b/axiom/nr_txn.h @@ -93,9 +93,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/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..a30c9b028 100644 --- a/axiom/tests/test_cmd_appinfo.c +++ b/axiom/tests/test_cmd_appinfo.c @@ -638,7 +638,8 @@ static void test_process_connected_app(void) { 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_DEFAULT_SPAN_EVENTS_MAX_SAMPLES_STORED, + app.limits.span_events); /* * Perform same test again to make sure that populated fields are freed 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/src/flatbuffersdata/data_test.go b/src/flatbuffersdata/data_test.go index 29afb25f8..b22e8b2a7 100644 --- a/src/flatbuffersdata/data_test.go +++ b/src/flatbuffersdata/data_test.go @@ -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/newrelic/app_test.go b/src/newrelic/app_test.go index 9920eacd6..1754e9efd 100644 --- a/src/newrelic/app_test.go +++ b/src/newrelic/app_test.go @@ -249,7 +249,7 @@ func TestConnectPayloadEncoded(t *testing.T) { `"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}}` + + `"event_harvest_config":{"report_period_ms":60000,"harvest_limits":{"error_event_data":100,"analytic_event_data":10000,"custom_event_data":10000,"span_event_data":10000}}` + `}` + `]` @@ -275,7 +275,7 @@ func TestConnectPayloadEncoded(t *testing.T) { `"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}}` + + `"event_harvest_config":{"report_period_ms":60000,"harvest_limits":{"error_event_data":100,"analytic_event_data":10000,"custom_event_data":10000,"span_event_data":10000}}` + `}` + `]` diff --git a/src/newrelic/limits/limits.go b/src/newrelic/limits/limits.go index 1315349b9..cc306dd91 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 + MaxSpanEvents = 10000 MaxErrors = 20 MaxSlowSQLs = 10 MaxRegularTraces = 1 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_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/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/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/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/external/curl_exec/test_dt_correct_span_is_external.php b/tests/integration/external/curl_exec/test_dt_correct_span_is_external.php index bdb84ba0d..c87513404 100644 --- a/tests/integration/external/curl_exec/test_dt_correct_span_is_external.php +++ b/tests/integration/external/curl_exec/test_dt_correct_span_is_external.php @@ -26,7 +26,7 @@ [ "?? agent run id", { - "reservoir_size": 1000, + "reservoir_size": 10000, "events_seen": 2 }, [ diff --git a/tests/integration/external/curl_exec/test_dt_span_customrequest.php b/tests/integration/external/curl_exec/test_dt_span_customrequest.php index b1bf5b926..90e92eeca 100644 --- a/tests/integration/external/curl_exec/test_dt_span_customrequest.php +++ b/tests/integration/external/curl_exec/test_dt_span_customrequest.php @@ -30,7 +30,7 @@ [ "?? agent run id", { - "reservoir_size": 1000, + "reservoir_size": 10000, "events_seen": 2 }, [ 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_multi_exec/test_span_sets_method.php b/tests/integration/external/curl_multi_exec/test_span_sets_method.php index 342e865db..d67850f07 100644 --- a/tests/integration/external/curl_multi_exec/test_span_sets_method.php +++ b/tests/integration/external/curl_multi_exec/test_span_sets_method.php @@ -25,7 +25,7 @@ [ "?? agent run id", { - "reservoir_size": 1000, + "reservoir_size": 10000, "events_seen": 5 }, [ diff --git a/tests/integration/external/file_get_contents/test_spans_are_created_correctly.php b/tests/integration/external/file_get_contents/test_spans_are_created_correctly.php index 68ac3dfe3..90adf6891 100644 --- a/tests/integration/external/file_get_contents/test_spans_are_created_correctly.php +++ b/tests/integration/external/file_get_contents/test_spans_are_created_correctly.php @@ -18,7 +18,7 @@ [ "?? agent run id", { - "reservoir_size": 1000, + "reservoir_size": 10000, "events_seen": 3 }, [ diff --git a/tests/integration/external/guzzle5/test_spans_external.php b/tests/integration/external/guzzle5/test_spans_external.php index 268bedc4c..58b4813a5 100644 --- a/tests/integration/external/guzzle5/test_spans_external.php +++ b/tests/integration/external/guzzle5/test_spans_external.php @@ -32,7 +32,7 @@ [ "?? agent run id", { - "reservoir_size": 1000, + "reservoir_size": 10000, "events_seen": 4 }, [ diff --git a/tests/integration/external/guzzle6/test_spans_are_created_correctly.php b/tests/integration/external/guzzle6/test_spans_are_created_correctly.php index 092b545fd..033151c0e 100644 --- a/tests/integration/external/guzzle6/test_spans_are_created_correctly.php +++ b/tests/integration/external/guzzle6/test_spans_are_created_correctly.php @@ -32,7 +32,7 @@ [ "?? agent run id", { - "reservoir_size": 1000, + "reservoir_size": 10000, "events_seen": 3 }, [ diff --git a/tests/integration/span_events/test_span_events_are_created_from_segments.php b/tests/integration/span_events/test_span_events_are_created_from_segments.php index 99cd22ccb..43bbc0aa4 100644 --- a/tests/integration/span_events/test_span_events_are_created_from_segments.php +++ b/tests/integration/span_events/test_span_events_are_created_from_segments.php @@ -19,7 +19,7 @@ [ "?? agent run id", { - "reservoir_size": 1000, + "reservoir_size": 10000, "events_seen": 3 }, [ diff --git a/tests/integration/span_events/test_span_events_are_created_upon_caught_error.php b/tests/integration/span_events/test_span_events_are_created_upon_caught_error.php index 232af6016..188a44642 100644 --- a/tests/integration/span_events/test_span_events_are_created_upon_caught_error.php +++ b/tests/integration/span_events/test_span_events_are_created_upon_caught_error.php @@ -22,7 +22,7 @@ [ "?? agent run id", { - "reservoir_size": 1000, + "reservoir_size": 10000, "events_seen": 4 }, [ diff --git a/tests/integration/span_events/test_span_events_are_created_upon_caught_exception.php b/tests/integration/span_events/test_span_events_are_created_upon_caught_exception.php index d3ca5524e..a83747a66 100644 --- a/tests/integration/span_events/test_span_events_are_created_upon_caught_exception.php +++ b/tests/integration/span_events/test_span_events_are_created_upon_caught_exception.php @@ -24,7 +24,7 @@ [ "?? agent run id", { - "reservoir_size": 1000, + "reservoir_size": 10000, "events_seen": 4 }, [ diff --git a/tests/integration/span_events/test_span_events_are_created_upon_exit.php b/tests/integration/span_events/test_span_events_are_created_upon_exit.php index 14aab9bc8..30c291f72 100644 --- a/tests/integration/span_events/test_span_events_are_created_upon_exit.php +++ b/tests/integration/span_events/test_span_events_are_created_upon_exit.php @@ -20,7 +20,7 @@ [ "?? agent run id", { - "reservoir_size": 1000, + "reservoir_size": 10000, "events_seen": 3 }, [ diff --git a/tests/integration/span_events/test_span_events_are_created_upon_uncaught_error.php b/tests/integration/span_events/test_span_events_are_created_upon_uncaught_error.php index 5cf799c54..dc1b4f90c 100644 --- a/tests/integration/span_events/test_span_events_are_created_upon_uncaught_error.php +++ b/tests/integration/span_events/test_span_events_are_created_upon_uncaught_error.php @@ -22,7 +22,7 @@ [ "?? agent run id", { - "reservoir_size": 1000, + "reservoir_size": 10000, "events_seen": 3 }, [ diff --git a/tests/integration/span_events/test_span_events_are_created_upon_uncaught_exception.php b/tests/integration/span_events/test_span_events_are_created_upon_uncaught_exception.php index 974fdacc3..1427a8f3f 100644 --- a/tests/integration/span_events/test_span_events_are_created_upon_uncaught_exception.php +++ b/tests/integration/span_events/test_span_events_are_created_upon_uncaught_exception.php @@ -22,7 +22,7 @@ [ "?? agent run id", { - "reservoir_size": 1000, + "reservoir_size": 10000, "events_seen": 3 }, [ diff --git a/tests/integration/span_events/test_span_events_error_collector_disabled.php b/tests/integration/span_events/test_span_events_error_collector_disabled.php index 8a1450b76..e9cc70123 100644 --- a/tests/integration/span_events/test_span_events_error_collector_disabled.php +++ b/tests/integration/span_events/test_span_events_error_collector_disabled.php @@ -21,7 +21,7 @@ [ "?? agent run id", { - "reservoir_size": 1000, + "reservoir_size": 10000, "events_seen": 3 }, [ diff --git a/tests/integration/span_events/test_span_events_exception_caught_nested.php b/tests/integration/span_events/test_span_events_exception_caught_nested.php index 41cb97b0e..a1a68019a 100644 --- a/tests/integration/span_events/test_span_events_exception_caught_nested.php +++ b/tests/integration/span_events/test_span_events_exception_caught_nested.php @@ -23,7 +23,7 @@ [ "?? agent run id", { - "reservoir_size": 1000, + "reservoir_size": 10000, "events_seen": 6 }, [ diff --git a/tests/integration/span_events/test_span_events_exception_caught_nested_rethrown.php b/tests/integration/span_events/test_span_events_exception_caught_nested_rethrown.php index 7352da72e..2a89323bd 100644 --- a/tests/integration/span_events/test_span_events_exception_caught_nested_rethrown.php +++ b/tests/integration/span_events/test_span_events_exception_caught_nested_rethrown.php @@ -50,7 +50,7 @@ [ "?? agent run id", { - "reservoir_size": 1000, + "reservoir_size": 10000, "events_seen": 4 }, [ diff --git a/tests/integration/span_events/test_span_events_exception_caught_notice_error.php b/tests/integration/span_events/test_span_events_exception_caught_notice_error.php index feca9e3e4..6c2e569c4 100644 --- a/tests/integration/span_events/test_span_events_exception_caught_notice_error.php +++ b/tests/integration/span_events/test_span_events_exception_caught_notice_error.php @@ -50,7 +50,7 @@ [ "?? agent run id", { - "reservoir_size": 1000, + "reservoir_size": 10000, "events_seen": 3 }, [ diff --git a/tests/integration/span_events/test_span_events_exception_caught_notice_error_nested.php b/tests/integration/span_events/test_span_events_exception_caught_notice_error_nested.php index 7a0081e04..029b5d946 100644 --- a/tests/integration/span_events/test_span_events_exception_caught_notice_error_nested.php +++ b/tests/integration/span_events/test_span_events_exception_caught_notice_error_nested.php @@ -50,7 +50,7 @@ [ "?? agent run id", { - "reservoir_size": 1000, + "reservoir_size": 10000, "events_seen": 6 }, [ diff --git a/tests/integration/span_events/test_span_events_exception_caught_same_span.php b/tests/integration/span_events/test_span_events_exception_caught_same_span.php index f7e04a042..c054eb746 100644 --- a/tests/integration/span_events/test_span_events_exception_caught_same_span.php +++ b/tests/integration/span_events/test_span_events_exception_caught_same_span.php @@ -23,7 +23,7 @@ [ "?? agent run id", { - "reservoir_size": 1000, + "reservoir_size": 10000, "events_seen": 3 }, [ diff --git a/tests/integration/span_events/test_span_events_exception_uncaught_nested.php b/tests/integration/span_events/test_span_events_exception_uncaught_nested.php index 236656d59..d920264c8 100644 --- a/tests/integration/span_events/test_span_events_exception_uncaught_nested.php +++ b/tests/integration/span_events/test_span_events_exception_uncaught_nested.php @@ -52,7 +52,7 @@ [ "?? agent run id", { - "reservoir_size": 1000, + "reservoir_size": 10000, "events_seen": 5 }, [ diff --git a/tests/integration/span_events/test_span_events_exist_when_no_segments.php b/tests/integration/span_events/test_span_events_exist_when_no_segments.php index 877f77e34..7fb7b462d 100644 --- a/tests/integration/span_events/test_span_events_exist_when_no_segments.php +++ b/tests/integration/span_events/test_span_events_exist_when_no_segments.php @@ -19,7 +19,7 @@ [ "?? agent run id", { - "reservoir_size": 1000, + "reservoir_size": 10000, "events_seen": 1 }, [ diff --git a/tests/integration/span_events/test_span_events_hsm_error.php b/tests/integration/span_events/test_span_events_hsm_error.php index 3fdef0736..1f722886b 100644 --- a/tests/integration/span_events/test_span_events_hsm_error.php +++ b/tests/integration/span_events/test_span_events_hsm_error.php @@ -52,7 +52,7 @@ [ "?? agent run id", { - "reservoir_size": 1000, + "reservoir_size": 10000, "events_seen": 2 }, [ diff --git a/tests/integration/span_events/test_span_events_notice_error.php b/tests/integration/span_events/test_span_events_notice_error.php index 196e93584..d276bb9ec 100644 --- a/tests/integration/span_events/test_span_events_notice_error.php +++ b/tests/integration/span_events/test_span_events_notice_error.php @@ -49,7 +49,7 @@ [ "?? agent run id", { - "reservoir_size": 1000, + "reservoir_size": 10000, "events_seen": 3 }, [ diff --git a/tests/integration/span_events/test_span_events_on_dt_on.php b/tests/integration/span_events/test_span_events_on_dt_on.php index 106b89b3f..a5f123227 100644 --- a/tests/integration/span_events/test_span_events_on_dt_on.php +++ b/tests/integration/span_events/test_span_events_on_dt_on.php @@ -18,7 +18,7 @@ [ "?? agent run id", { - "reservoir_size": 1000, + "reservoir_size": 10000, "events_seen": 2 }, [ diff --git a/tests/integration/span_events/test_span_events_root_parent.php b/tests/integration/span_events/test_span_events_root_parent.php index 6c23edcfb..d9955d4a3 100644 --- a/tests/integration/span_events/test_span_events_root_parent.php +++ b/tests/integration/span_events/test_span_events_root_parent.php @@ -27,7 +27,7 @@ [ "?? agent run id", { - "reservoir_size": 1000, + "reservoir_size": 10000, "events_seen": 2 }, [ diff --git a/tests/integration/span_events/test_span_events_special_max_10.php b/tests/integration/span_events/test_span_events_special_max_10.php index a6cc168e0..3c6881d05 100644 --- a/tests/integration/span_events/test_span_events_special_max_10.php +++ b/tests/integration/span_events/test_span_events_special_max_10.php @@ -12,14 +12,14 @@ newrelic.distributed_tracing_enabled = 1 newrelic.transaction_tracer.threshold = 0 newrelic.cross_application_tracer.enabled = false -newrelic.special.max_span_events = 10 +newrelic.span_events.max_samples_stored = 10 */ /*EXPECT_SPAN_EVENTS [ "?? agent run id", { - "reservoir_size": 1000, + "reservoir_size": 10000, "events_seen": 10 }, "??" diff --git a/tests/integration/span_events/test_span_events_special_max_disabled.php b/tests/integration/span_events/test_span_events_special_max_disabled.php index 7eed66cf0..f450a7e4a 100644 --- a/tests/integration/span_events/test_span_events_special_max_disabled.php +++ b/tests/integration/span_events/test_span_events_special_max_disabled.php @@ -11,22 +11,22 @@ newrelic.distributed_tracing_enabled = 1 newrelic.transaction_tracer.threshold = 0 newrelic.cross_application_tracer.enabled = false -newrelic.special.max_span_events = 0 +newrelic.span_events.max_samples_stored = 0 */ /*EXPECT_SPAN_EVENTS [ "?? agent run id", { - "reservoir_size": 1000, - "events_seen": 1000 + "reservoir_size": 10000, + "events_seen": 2000 }, "??" ] */ -$NEWRELIC_SPAN_EVENTS_MAX = 1000; // The agent internal maximum of span events - // per transaction. +$NEWRELIC_SPAN_EVENTS_MAX = 3000; // The number of span events to send per transaction. + //The agent internal maximum is 10000. newrelic_add_custom_tracer('main'); function main() From 9189de06abe8187162d13e6c12ad6fe16ffacb0c Mon Sep 17 00:00:00 2001 From: Michael Fulbright <89205663+mfulb@users.noreply.github.com> Date: Wed, 16 Mar 2022 15:27:44 -0400 Subject: [PATCH 02/12] Bump version to 9.21.0 and codename to "buttercup" (#385) --- VERSION | 2 +- axiom/nr_version.c | 3 ++- 2 files changed, 3 insertions(+), 2 deletions(-) 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/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); From e251c8ef56813bcb694684b3c2418e7f62ddf531 Mon Sep 17 00:00:00 2001 From: Amber Sistla Date: Wed, 23 Mar 2022 07:18:19 -0700 Subject: [PATCH 03/12] fix(agent/scripts): Fix detecting Linux distribution Use `/etc/os-release` instead of `/etc/dpkg` to detect if running on Debian-based distribution. Using `/etc/dpkg` may cause issues if `dpkg` package is installed on non-Debian distribution (like Alpine). This can happen when working with php Docker images based alpine distribution (e.g. php:cli-alpine) and $PHPIZE_DEPS (autoconf dpkg-dev dpkg file g++ gcc libc-dev make pkgconf re2c) deps are installed. Co-authored-by: Michal Nowacki --- agent/newrelic-install.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/agent/newrelic-install.sh b/agent/newrelic-install.sh index 890ff8e82..62ddd250e 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 From 8639dde36f298095314627c8068223a13f661841 Mon Sep 17 00:00:00 2001 From: Michael Fulbright <89205663+mfulb@users.noreply.github.com> Date: Tue, 29 Mar 2022 14:48:24 -0400 Subject: [PATCH 04/12] feat(integration): Improve dockerization of integration tests (#390) * Add container defs for memcached and mongodb * Fix python-yaml dependency and install PHP extensions for Redis and memcached * Changes for mysql server running on another machine and predis home config * Adds extensions required by integration tests Install composer which is required by predis extension. Install mysqli, pdo_mysql, redis, prder, memcache, memcached, uopz extensions. Write configuration for uopz to honor exit() and die(). * Changes needed to run pgsql integration tests using Docker * Update dockerized environment to run agent and services in containers Fix predis extension installation to /usr/src/vendor/predis/predis and update environment variable PREDIS_HOME to reflect location. Sync mysql credentials and settings used in mysqldb container to those used in agent container when connected to mysql server. Pin mysql to version 5.6 which is required for existing integration tests in the pdo and mysqli directories. Change New Relic license env vars to NEW_RELIC_COLLECTOR_HOST and NEW_RELIC_LICENSE KEY to be consistent with other usages in scripts. --- docker-compose.yaml | 48 ++++++++++--- files/Dockerfile | 72 ++++++++++++++++--- .../pgsql/test_pg_execute_mixed_use.php | 5 +- 3 files changed, 104 insertions(+), 21 deletions(-) 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/tests/integration/pgsql/test_pg_execute_mixed_use.php b/tests/integration/pgsql/test_pg_execute_mixed_use.php index 0bdc6162e..ee7e76bf9 100644 --- a/tests/integration/pgsql/test_pg_execute_mixed_use.php +++ b/tests/integration/pgsql/test_pg_execute_mixed_use.php @@ -8,8 +8,9 @@ The agent should report Datastore metrics for Postgres prepared statements. */ -/*XFAIL */ - +/*XFAIL tests that our agent currently doesn't handle mix-and-matching default vs. passed + connections between pg_prepare and pg_execute */ + /*SKIPIF Date: Wed, 30 Mar 2022 07:41:53 -0700 Subject: [PATCH 05/12] span_event_max_samples_stored test cases (#388) * Tests to exercise valid/invalid and boundary conditions. * Changed the ini file handling logic to account for correct values and setting the default sooner rather than later. * Piped in a way to communicate the requested number of spans to the daemon (this still needs to actually be sent to the daemon). --- agent/php_nrini.c | 62 +++++++++++++++---- agent/php_txn.c | 13 ++-- axiom/cmd_appinfo_transmit.c | 9 ++- axiom/nr_app.c | 2 + axiom/nr_app.h | 5 +- axiom/nr_commands_private.h | 3 +- axiom/tests/test_cmd_appinfo.c | 23 ++++--- .../test_span_events_max_samples_stored1.php | 39 ++++++++++++ .../test_span_events_max_samples_stored2.php | 39 ++++++++++++ .../test_span_events_max_samples_stored3.php | 42 +++++++++++++ .../test_span_events_max_samples_stored4.php | 42 +++++++++++++ .../test_span_events_max_samples_stored5.php | 45 ++++++++++++++ .../test_span_events_max_samples_stored6.php | 42 +++++++++++++ .../test_span_events_max_samples_stored7.php | 43 +++++++++++++ .../test_span_events_max_samples_stored8.php | 43 +++++++++++++ ...pan_events_max_samples_stored_invalid1.php | 42 +++++++++++++ ...pan_events_max_samples_stored_invalid2.php | 40 ++++++++++++ 17 files changed, 503 insertions(+), 31 deletions(-) create mode 100644 tests/integration/span_events/test_span_events_max_samples_stored1.php create mode 100644 tests/integration/span_events/test_span_events_max_samples_stored2.php create mode 100644 tests/integration/span_events/test_span_events_max_samples_stored3.php create mode 100644 tests/integration/span_events/test_span_events_max_samples_stored4.php create mode 100644 tests/integration/span_events/test_span_events_max_samples_stored5.php create mode 100644 tests/integration/span_events/test_span_events_max_samples_stored6.php create mode 100644 tests/integration/span_events/test_span_events_max_samples_stored7.php create mode 100644 tests/integration/span_events/test_span_events_max_samples_stored8.php create mode 100644 tests/integration/span_events/test_span_events_max_samples_stored_invalid1.php create mode 100644 tests/integration/span_events/test_span_events_max_samples_stored_invalid2.php diff --git a/agent/php_nrini.c b/agent/php_nrini.c index 07fdaa41e..2ed8e0f56 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 * @@ -1303,6 +1303,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 +1809,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) @@ -2587,9 +2625,9 @@ STD_PHP_INI_ENTRY_EX("newrelic.span_events_enabled", 0) STD_PHP_INI_ENTRY_EX("newrelic.span_events.max_samples_stored", - "0", + NR_STR2(NR_DEFAULT_SPAN_EVENTS_MAX_SAMPLES_STORED), NR_PHP_REQUEST, - nr_unsigned_int_mh, + nr_span_events_max_samples_stored_mh, span_events_max_samples_stored, zend_newrelic_globals, newrelic_globals, @@ -2918,7 +2956,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 dcf2754ef..e6199f850 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. */ @@ -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, @@ -868,9 +869,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/axiom/cmd_appinfo_transmit.c b/axiom/cmd_appinfo_transmit.c index 8d6999aa8..abbaa9f9f 100644 --- a/axiom/cmd_appinfo_transmit.c +++ b/axiom/cmd_appinfo_transmit.c @@ -369,7 +369,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 +380,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); @@ -397,7 +398,9 @@ void nr_cmd_appinfo_process_event_harvest_config(const nrobj_t* config, 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_DEFAULT_SPAN_EVENTS_MAX_SAMPLES_STORED); + 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..f28e2914e 100644 --- a/axiom/nr_commands_private.h +++ b/axiom/nr_commands_private.h @@ -186,7 +186,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/tests/test_cmd_appinfo.c b/axiom/tests/test_cmd_appinfo.c index a30c9b028..8ebebe64a 100644 --- a/axiom/tests/test_cmd_appinfo.c +++ b/axiom/tests/test_cmd_appinfo.c @@ -632,13 +632,14 @@ 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_DEFAULT_SPAN_EVENTS_MAX_SAMPLES_STORED, + tlib_pass_if_int_equal(__func__, NR_MAX_SPAN_EVENTS_MAX_SAMPLES_STORED, app.limits.span_events); /* @@ -941,33 +942,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/tests/integration/span_events/test_span_events_max_samples_stored1.php b/tests/integration/span_events/test_span_events_max_samples_stored1.php new file mode 100644 index 000000000..93807d478 --- /dev/null +++ b/tests/integration/span_events/test_span_events_max_samples_stored1.php @@ -0,0 +1,39 @@ + 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 @@ + Date: Wed, 30 Mar 2022 16:02:39 -0600 Subject: [PATCH 06/12] test(integration): Add test for large error inbox (#393) --- .../errors/test_large_error_message.php | 61 +++++++++++++++++++ 1 file changed, 61 insertions(+) create mode 100644 tests/integration/errors/test_large_error_message.php 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..0cff7d87d --- /dev/null +++ b/tests/integration/errors/test_large_error_message.php @@ -0,0 +1,61 @@ + Date: Thu, 31 Mar 2022 07:01:25 -0700 Subject: [PATCH 07/12] Suppress output (#400) * Suppress output --- Makefile | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) 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) From b4962cb965c2634a9e79235e348b516506fead2b Mon Sep 17 00:00:00 2001 From: Michal Nowacki Date: Thu, 31 Mar 2022 11:23:17 -0400 Subject: [PATCH 08/12] feat(agent): Enable distributed tracing by default (#386) * feat(agent): Enable distributed tracing by default * test(agent): Update unit tests Test api_metadata with distributed tracing disabled and enabled. * test(integration): Disable distributed tracing in cross application tracing integration tests Explicitly disable distributed tracing in cross application tracing (CAT) integration tests. Enabled distributed tracing disables cross application tracing (legacy method of tracing). * test(integration): Update integration tests expectations Distributed tracing generates additional attributes in events and traces, and additional metrics. With distributed tracing being enabled by default, integration tests' EXPECT_* directives (Expected Harvest Data) need to be updated to account for additional harvest data generated by distributed tracing. * test(integration): Improve mock external service Use value of `newrelic.distributed_tracing_enabled` from test's `/*INI` directive in integration_runner's mock external service to correctly handle tests expectations. With distributed tracing enabled by default, integration_runner's mock external service had distributed tracing enabled regardless of the value set in test's `/*INI` directive and didn't handle CAT headers. With this change it is possible to control distributed tracing setting in mock external service and it gets disabled if integration test demands it by explicit setting in `/*INI` directive. Mock external service honors all possible values ("true", "false"), and returns an error if it is not valid in hope to raise awareness of the test writer. Closes #363 --- agent/Makefile.frag | 3 +- agent/php_nrini.c | 2 +- agent/scripts/newrelic.ini.template | 11 +- ...data.c => test_api_metadata_dt_disabled.c} | 11 +- agent/tests/test_api_metadata_dt_enabled.c | 103 ++++++++++++++++++ src/integration_runner/main.go | 9 ++ tests/include/config.php | 12 +- .../add_custom_parameter/test_bad_input.php | 6 +- .../test_key_conversions.php | 6 +- .../test_value_conversions.php | 6 +- .../api/add_custom_tracer/test_happy.php | 4 + .../test_not_user_function.php | 4 + .../add_custom_tracer/test_short_segments.php | 10 +- .../api/custom_metric/test_bad_input.php | 4 + .../api/custom_metric/test_bad_input.php8.php | 4 + .../api/custom_metric/test_happy.php | 4 + .../test_all_parameters_no_children.php | 10 +- .../datastore/test_all_parameters_nosql.php | 10 +- .../test_all_parameters_sql_no_query.php | 10 +- .../test_all_parameters_sql_obfuscated.php | 10 +- .../datastore/test_all_parameters_sql_raw.php | 10 +- .../integration/api/datastore/test_basic.php | 10 +- .../notice_error/test_errors_not_filtered.php | 7 +- .../test_exceptions_not_filtered.php | 7 +- .../api/notice_error/test_last_error_wins.php | 7 +- .../api/notice_error/test_prioritize_api.php | 7 +- .../api/notice_error/test_priority.php | 7 +- .../test_uncaught_is_ultimate.php | 7 +- .../api/other/test_end_transaction_nested.php | 6 +- .../api/other/test_ignore_apdex.php | 4 + .../other/test_set_user_attributes_happy.php | 8 +- .../other/test_start_and_end_transaction.php | 6 +- .../api/set_appname/test_already_ended.php | 4 + .../api/set_appname/test_appname_license.php | 4 + .../test_appname_switch_license.php | 4 + .../test_appname_switch_license_lasp.php | 4 + .../api/set_appname/test_bad_params.php | 8 ++ .../api/set_appname/test_bad_params.php8.php | 4 + .../api/set_appname/test_no_license.php | 4 + .../api/set_appname/test_transmit_false.php | 4 + .../api/set_appname/test_transmit_int.php | 4 + .../api/set_appname/test_transmit_true.php | 4 + .../integration/attributes/test_disabled.php | 6 +- .../attributes/test_disabled_all.php | 6 +- .../attributes/test_disabled_old.php | 6 +- .../attributes/test_empty_request.php | 7 +- tests/integration/attributes/test_enabled.php | 6 +- .../attributes/test_precedence.php | 6 +- .../attributes/test_response_headers.php | 13 ++- .../attributes/test_response_ini.php | 13 ++- .../attributes/test_response_ini_set.php | 13 ++- .../attributes/test_response_whitespace.php | 13 ++- .../test_transaction_background.php | 13 ++- .../basic/test_call_user_func_array_0.php | 4 + tests/integration/basic/test_dl.php | 8 ++ .../basic/test_internal_function.php | 6 +- .../integration/basic/test_output_buffer.php | 4 + .../newrelic/test_error_intrinsic.php | 6 +- .../newrelic/test_error_intrinsic_error.php | 6 +- .../test_error_intrinsic_exception.php | 6 +- .../test_intrinsics_notset_errors.php | 13 ++- .../newrelic/test_intrinsics_notset_txns.php | 12 +- .../w3c/test_insert_dt_headers_nonref.php | 8 ++ .../test_insert_dt_headers_wrong_arg_type.php | 8 ++ ..._insert_dt_headers_wrong_arg_type.php8.php | 8 ++ .../errors/test_E_COMPILE_ERROR.zend.php | 7 +- .../errors/test_E_COMPILE_WARNING.php | 7 +- .../errors/test_E_COMPILE_WARNING.php8.php | 7 +- .../errors/test_E_DEPRECATED_2.php5.php | 7 +- .../errors/test_E_DEPRECATED_2.php7.php | 7 +- .../errors/test_E_DEPRECATED_2.php8.php | 7 +- .../errors/test_E_DEPRECATED_2.php81.php | 7 +- .../errors/test_E_DEPRECATED_payload1.php | 7 +- .../errors/test_E_DEPRECATED_payload2.php | 7 +- .../errors/test_E_DEPRECATED_payload3.php | 7 +- .../integration/errors/test_E_ERROR.php5.php | 7 +- .../errors/test_E_ERROR.php7.0.0.php | 7 +- .../errors/test_E_ERROR.php7.0.1.php | 7 +- .../errors/test_E_ERROR.php7.4.php | 7 +- .../integration/errors/test_E_PARSE.zend.php | 7 +- .../errors/test_E_PARSE.zend.php8.php | 7 +- .../errors/test_E_RECOVERABLE.php5.php | 7 +- .../errors/test_E_RECOVERABLE.php7.4.php | 7 +- .../errors/test_E_RECOVERABLE.php7.php | 7 +- .../integration/errors/test_E_STRICT.php5.php | 7 +- .../integration/errors/test_E_STRICT.php7.php | 7 +- .../errors/test_E_USER_DEPRECATED.php | 7 +- .../integration/errors/test_E_USER_ERROR.php | 7 +- .../errors/test_E_USER_WARNING.php | 7 +- .../errors/test_E_WARNING.php5.php | 7 +- .../errors/test_E_WARNING.php7.php | 7 +- .../errors/test_E_WARNING.php8.php | 7 +- tests/integration/errors/test_exception.php | 7 +- .../test_ignore_all_except_E_WARNING.php5.php | 7 +- .../test_ignore_all_except_E_WARNING.php7.php | 7 +- .../test_ignore_all_except_E_WARNING.php8.php | 7 +- ..._top_level_exception_internal_function.php | 7 +- .../test_top_level_exception_closure.php | 4 + .../test_top_level_exception_function.php | 4 + ...st_top_level_exception_instance_method.php | 4 + .../test_top_level_exception_restore.php | 4 + ...test_top_level_exception_static_method.php | 4 + .../test_top_level_exception_tracer.php | 4 + .../events/test_database_duration.php | 6 +- tests/integration/events/test_empty.php | 6 +- .../test_cat_and_synthetics_disabled.php | 1 + .../external/curl_exec/test_cat_disabled.php | 1 + .../test_cat_request_headers_empty_array.php | 4 + .../test_cat_request_headers_present.php | 4 + ...test_cat_request_headers_present_array.php | 4 + ...t_cat_request_headers_referenced_array.php | 4 + .../test_cat_response_header_anonymous.php | 4 + .../test_cat_response_header_function.php | 4 + .../test_cat_response_header_returned.php | 4 + .../test_cat_response_header_to_stdout.php | 4 + .../external/curl_exec/test_cat_simple.php | 4 + .../external/curl_exec/test_file_proto.php | 4 + .../external/curl_exec/test_http.php | 7 ++ .../external/curl_exec/test_malformed_url.php | 7 ++ .../curl_exec/test_missing_handle.php | 8 ++ .../external/curl_exec/test_synthetics.php | 4 + .../curl_exec/test_synthetics_disabled.php | 1 + .../external/curl_exec/test_type_mismatch.php | 8 ++ .../curl_multi_exec/test_cat_simple.php | 4 + .../external/curl_multi_exec/test_http.php | 7 ++ .../curl_multi_exec/test_malformed_url.php | 4 + .../curl_multi_exec/test_missing_arg.php | 8 ++ .../curl_multi_exec/test_txn_restart.php | 1 + .../curl_multi_exec/test_txn_stop.php | 1 + .../curl_multi_exec/test_type_mismatch.php | 8 ++ .../test_cat_and_synthetics_disabled.php | 1 + .../test_cat_context_provided.php | 4 + .../test_cat_default_context.php | 4 + .../file_get_contents/test_cat_disabled.php | 1 + .../file_get_contents/test_cat_no_context.php | 4 + .../file_get_contents/test_dt_disabled.php | 4 + .../test_http_response_header_cv.php | 4 + .../test_synthetics_context_provided.php | 4 + .../test_synthetics_default_context.php | 4 + .../test_synthetics_disabled.php | 5 +- .../test_synthetics_no_context.php | 4 + .../integration/external/guzzle5/test_cat.php | 4 + .../external/guzzle5/test_no_cat_no_dt.php | 1 + .../integration/external/guzzle6/test_cat.php | 4 + .../external/guzzle6/test_no_cat_no_dt.php | 1 + .../integration/external/http/test_v1_cat.php | 4 + .../test_v1_cat_and_synthetics_disabled.php | 1 + .../external/http/test_v1_cat_disabled.php | 1 + .../external/http/test_v1_synthetics.php | 4 + .../http/test_v1_synthetics_disabled.php | 1 + .../test_v1_synthetics_with_cat_disabled.php | 1 + .../integration/external/http/test_v2_cat.php | 4 + .../test_curl_multi_add_remove_handles.php | 4 + .../frameworks/laravel/test_artisan_name.php | 4 + .../laravel/test_artisan_name_non_input.php | 4 + .../laravel/test_artisan_name_non_string.php | 4 + .../frameworks/magento/test_temp_tables.php | 4 + .../frameworks/silex/test_basic.php | 4 + .../silex/test_invalid_attributes.php | 4 + .../frameworks/silex/test_invalid_request.php | 4 + .../wordpress/test_site_specific_tables.php | 4 + .../ini/test_force_framework_0.php | 4 + .../ini/test_force_framework_1.php | 4 + .../ini/test_force_framework_2.php | 4 + .../ini/test_force_framework_6.php | 4 + .../ini/test_host_display_name.php | 6 +- tests/integration/ini/test_ini_001.php | 4 + tests/integration/ini/test_ini_002.php | 4 + tests/integration/ini/test_ini_003.php | 4 + tests/integration/ini/test_ini_004.php | 4 + .../lang/test_generator_5.6-7.0.php | 4 + tests/integration/lang/test_generator_7.1.php | 4 + tests/integration/memcache/test_add.php | 4 + tests/integration/memcache/test_incr_decr.php | 4 + .../memcache/test_memcache_add.php | 4 + .../memcache/test_memcache_incr_decr.php | 4 + .../memcache/test_memcache_replace.php | 4 + .../memcache/test_memcache_set.php | 4 + tests/integration/memcache/test_replace.php | 4 + tests/integration/memcache/test_set.php | 4 + tests/integration/memcached/test_basic.php | 4 + tests/integration/memcached/test_by_key.php | 4 + tests/integration/memcached/test_cas.php5.php | 4 + .../memcached/test_cas_by_key.php5.php | 4 + tests/integration/memcached/test_concat.php | 4 + .../memcached/test_concat_by_key.php | 4 + tests/integration/memcached/test_multi.php | 4 + .../memcached/test_multi_by_key.php | 4 + tests/integration/mongo/test_execute.php | 4 + tests/integration/mongo/test_find.php | 4 + tests/integration/mysql/test_db_query.php | 4 + .../integration/mysql/test_db_query_error.php | 8 ++ tests/integration/mysql/test_query.php | 4 + tests/integration/mysql/test_query_error.php | 8 ++ .../mysql/test_unbuffered_query.php | 4 + .../mysqli/test_bind_param_object_oo.php | 4 + .../integration/mysqli/test_bind_param_oo.php | 4 + .../mysqli/test_bind_param_proc.php | 4 + .../mysqli/test_explain_connect.php | 4 + .../mysqli/test_explain_construct.php | 4 + .../mysqli/test_explain_database_no_user.php | 4 + .../mysqli/test_explain_init_oo.php | 4 + .../test_explain_init_oo_persistent.php | 4 + .../mysqli/test_explain_init_proc.php | 4 + .../test_explain_leading_whitespace.php | 4 + .../mysqli/test_explain_options_garbage.php | 8 ++ .../test_explain_real_connect_garbage.php | 8 ++ .../mysqli/test_explain_reused_id.php | 4 + .../mysqli/test_explain_select_db_oo.php | 4 + .../mysqli/test_explain_select_db_proc.php | 4 + .../mysqli/test_multi_query_oo.php | 4 + .../mysqli/test_multi_query_proc.php | 4 + .../mysqli/test_mysqli_query_1.php | 4 + tests/integration/mysqli/test_prepare_oo.php | 4 + .../integration/mysqli/test_prepare_proc.php | 4 + tests/integration/mysqli/test_query_oo.php | 4 + tests/integration/mysqli/test_query_proc.php | 4 + .../integration/mysqli/test_real_query_oo.php | 4 + .../mysqli/test_real_query_proc.php | 4 + .../mysqli/test_stmt_prepare_oo.php | 4 + .../mysqli/test_stmt_prepare_proc.php | 4 + tests/integration/mysqli/test_subclassing.php | 4 + .../mysqli/test_subclassing.php81.php | 4 + tests/integration/pdo/test_bad_input_1.php | 1 + tests/integration/pdo/test_query_1.php | 4 + tests/integration/pdo/test_query_1.php81.php | 4 + tests/integration/pdo/test_query_2.php | 4 + tests/integration/pdo/test_query_3.php | 4 + tests/integration/pdo/test_query_4.php | 4 + tests/integration/queue/test_basic.php | 4 + tests/integration/queue/test_capitalized.php | 4 + tests/integration/queue/test_malformed.php | 4 + tests/integration/queue/test_with_prefix.php | 4 + tests/integration/redis/test_basic.php | 4 + tests/integration/redis/test_decr.php | 4 + tests/integration/redis/test_hash.php | 4 + tests/integration/redis/test_incr.php | 4 + tests/integration/redis/test_list.php | 4 + tests/integration/redis/test_list.php8.php | 8 ++ tests/integration/redis/test_setex.php | 4 + .../test_span_events_on_dt_off_cat_off.php | 1 + .../test_span_events_on_dt_off_cat_on.php | 1 + .../integration/sqlite3/test_bad_input_1.php | 8 ++ .../integration/sqlite3/test_bad_input_2.php | 8 ++ .../integration/sqlite3/test_bad_input_3.php | 8 ++ .../integration/sqlite3/test_bad_input_4.php | 8 ++ .../integration/sqlite3/test_bad_input_5.php | 8 ++ tests/integration/sqlite3/test_bad_sql_1.php | 8 ++ tests/integration/sqlite3/test_bad_sql_2.php | 8 ++ tests/integration/sqlite3/test_query.php | 4 + .../sqlite3/test_querysingle_1.php | 4 + .../sqlite3/test_querysingle_2.php | 4 + .../synthetics/test_bad_header.php | 12 +- .../integration/synthetics/test_disabled.php | 12 +- .../synthetics/test_happy_path.php | 8 ++ .../synthetics/test_happy_path_with_cat.php | 1 + .../test_custom_parameter_on.php | 6 +- .../suite-least-secure/test_errors_off.php | 7 +- .../suite-least-secure/test_errors_on.php | 7 +- .../lasp/suite-least-secure/test_sql_none.php | 6 +- .../test_sql_obfuscated.php | 6 +- .../lasp/suite-least-secure/test_sql_raw.php | 6 +- .../test_custom_parameter_off.php | 6 +- .../test_custom_parameter_on.php | 6 +- .../suite-most-secure/test_errors_off.php | 7 +- .../lasp/suite-most-secure/test_errors_on.php | 7 +- .../lasp/suite-most-secure/test_sql_none.php | 6 +- .../suite-most-secure/test_sql_obfuscated.php | 6 +- tests/lasp/suite-most-secure/test_sql_raw.php | 6 +- tests/lasp/suite-random-1/test_errors_on.php | 7 +- .../suite-random-1/test_sql_obfuscated.php | 6 +- .../test_custom_parameter_off.php | 6 +- tests/lasp/suite-random-2/test_errors_off.php | 7 +- tests/lasp/suite-random-2/test_errors_on.php | 7 +- tests/lasp/suite-random-2/test_sql_none.php | 6 +- tests/lasp/suite-random-2/test_sql_raw.php | 6 +- .../test_custom_parameter_off.php | 6 +- .../test_custom_parameter_on.php | 6 +- tests/lasp/suite-random-3/test_errors_on.php | 7 +- .../suite-random-3/test_sql_obfuscated.php | 6 +- tests/lasp/suite-random-3/test_sql_raw.php | 6 +- .../test_php_579_get_content_type.php | 4 + 282 files changed, 1508 insertions(+), 123 deletions(-) rename agent/tests/{test_api_metadata.c => test_api_metadata_dt_disabled.c} (88%) create mode 100644 agent/tests/test_api_metadata_dt_enabled.c 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/php_nrini.c b/agent/php_nrini.c index 2ed8e0f56..4fd5d4957 100644 --- a/agent/php_nrini.c +++ b/agent/php_nrini.c @@ -2585,7 +2585,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, diff --git a/agent/scripts/newrelic.ini.template b/agent/scripts/newrelic.ini.template index c2e5c97cd..ec25520c7 100644 --- a/agent/scripts/newrelic.ini.template +++ b/agent/scripts/newrelic.ini.template @@ -864,14 +864,15 @@ newrelic.daemon.logfile = "/var/log/newrelic/newrelic-daemon.log" ; 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 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/src/integration_runner/main.go b/src/integration_runner/main.go index 332e780f8..85acb5365 100644 --- a/src/integration_runner/main.go +++ b/src/integration_runner/main.go @@ -170,6 +170,7 @@ 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"); if "" == catFile { http.Error(w, "cat failure: no file provided", http.StatusBadRequest) return @@ -178,6 +179,14 @@ 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 + } tx, err := integration.CgiTx(integration.ScriptFile(catFile), env, settings, r.Header, ctx) if nil != err { diff --git a/tests/include/config.php b/tests/include/config.php index 202fe0ec1..313b58184 100644 --- a/tests/include/config.php +++ b/tests/include/config.php @@ -51,11 +51,21 @@ 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_tracing_url($file) { global $EXTERNAL_TRACING_URL; - return $EXTERNAL_TRACING_URL . '?file=' . $file; + return $EXTERNAL_TRACING_URL . '?file=' . $file . + '&' . make_dt_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_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_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/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/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/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_restore_top_level_exception_internal_function.php b/tests/integration/errors/test_restore_top_level_exception_internal_function.php index 59ab33ccc..afe8e5a8c 100644 --- a/tests/integration/errors/test_restore_top_level_exception_internal_function.php +++ b/tests/integration/errors/test_restore_top_level_exception_internal_function.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_top_level_exception_closure.php b/tests/integration/errors/test_top_level_exception_closure.php index 7428713e0..0a2f4f47a 100644 --- a/tests/integration/errors/test_top_level_exception_closure.php +++ b/tests/integration/errors/test_top_level_exception_closure.php @@ -9,6 +9,10 @@ are handled by a closure. */ +/*INI +newrelic.distributed_tracing_enabled=0 +*/ + /*EXPECT In exception handler */ diff --git a/tests/integration/errors/test_top_level_exception_function.php b/tests/integration/errors/test_top_level_exception_function.php index c98e8f698..85dfef1ef 100644 --- a/tests/integration/errors/test_top_level_exception_function.php +++ b/tests/integration/errors/test_top_level_exception_function.php @@ -9,6 +9,10 @@ are handled by a named function. */ +/*INI +newrelic.distributed_tracing_enabled=0 +*/ + /*EXPECT In exception handler */ diff --git a/tests/integration/errors/test_top_level_exception_instance_method.php b/tests/integration/errors/test_top_level_exception_instance_method.php index 5967b5286..bfaa80130 100644 --- a/tests/integration/errors/test_top_level_exception_instance_method.php +++ b/tests/integration/errors/test_top_level_exception_instance_method.php @@ -9,6 +9,10 @@ are handled by an instance method. */ +/*INI +newrelic.distributed_tracing_enabled=0 +*/ + /*EXPECT In exception handler */ diff --git a/tests/integration/errors/test_top_level_exception_restore.php b/tests/integration/errors/test_top_level_exception_restore.php index fc50b81f0..5a00aa7c7 100644 --- a/tests/integration/errors/test_top_level_exception_restore.php +++ b/tests/integration/errors/test_top_level_exception_restore.php @@ -10,6 +10,10 @@ called. */ +/*INI +newrelic.distributed_tracing_enabled=0 +*/ + /*EXPECT In first exception handler In second exception handler diff --git a/tests/integration/errors/test_top_level_exception_static_method.php b/tests/integration/errors/test_top_level_exception_static_method.php index 0c08d77e5..8178fbc6a 100644 --- a/tests/integration/errors/test_top_level_exception_static_method.php +++ b/tests/integration/errors/test_top_level_exception_static_method.php @@ -9,6 +9,10 @@ are handled by a static method. */ +/*INI +newrelic.distributed_tracing_enabled=0 +*/ + /*EXPECT In exception handler */ diff --git a/tests/integration/errors/test_top_level_exception_tracer.php b/tests/integration/errors/test_top_level_exception_tracer.php index 80ab57d29..2833456d4 100644 --- a/tests/integration/errors/test_top_level_exception_tracer.php +++ b/tests/integration/errors/test_top_level_exception_tracer.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/events/test_database_duration.php b/tests/integration/events/test_database_duration.php index 97a949499..a9c242dac 100644 --- a/tests/integration/events/test_database_duration.php +++ b/tests/integration/events/test_database_duration.php @@ -27,7 +27,11 @@ "totalTime": "??", "databaseDuration": "??", "databaseCallCount": 1, - "error": false + "error": false, + "guid": "??", + "sampled": true, + "priority": "??", + "traceId": "??" }, { }, diff --git a/tests/integration/events/test_empty.php b/tests/integration/events/test_empty.php index 70d0e41da..48c138c44 100644 --- a/tests/integration/events/test_empty.php +++ b/tests/integration/events/test_empty.php @@ -20,7 +20,11 @@ "timestamp": "??", "duration": "??", "totalTime": "??", - "error": false + "error": false, + "guid": "??", + "sampled": true, + "priority": "??", + "traceId": "??" }, { }, diff --git a/tests/integration/external/curl_exec/test_cat_and_synthetics_disabled.php b/tests/integration/external/curl_exec/test_cat_and_synthetics_disabled.php index ab0d64c20..b36a9240c 100644 --- a/tests/integration/external/curl_exec/test_cat_and_synthetics_disabled.php +++ b/tests/integration/external/curl_exec/test_cat_and_synthetics_disabled.php @@ -14,6 +14,7 @@ /*INI newrelic.cross_application_tracer.enabled = false newrelic.synthetics.enabled = false +newrelic.distributed_tracing_enabled = false */ /* diff --git a/tests/integration/external/curl_exec/test_cat_disabled.php b/tests/integration/external/curl_exec/test_cat_disabled.php index 80d616bb4..945436df4 100644 --- a/tests/integration/external/curl_exec/test_cat_disabled.php +++ b/tests/integration/external/curl_exec/test_cat_disabled.php @@ -11,6 +11,7 @@ /*INI newrelic.cross_application_tracer.enabled = false +newrelic.distributed_tracing_enabled = false */ /*EXPECT diff --git a/tests/integration/external/curl_exec/test_cat_request_headers_empty_array.php b/tests/integration/external/curl_exec/test_cat_request_headers_empty_array.php index 3a200076e..6a3dbcbf3 100644 --- a/tests/integration/external/curl_exec/test_cat_request_headers_empty_array.php +++ b/tests/integration/external/curl_exec/test_cat_request_headers_empty_array.php @@ -20,6 +20,10 @@ } */ +/*INI +newrelic.distributed_tracing_enabled=0 +*/ + /*EXPECT tracing endpoint reached ok - tracing successful diff --git a/tests/integration/external/curl_exec/test_cat_request_headers_present.php b/tests/integration/external/curl_exec/test_cat_request_headers_present.php index c2d1712ab..fc3964381 100644 --- a/tests/integration/external/curl_exec/test_cat_request_headers_present.php +++ b/tests/integration/external/curl_exec/test_cat_request_headers_present.php @@ -20,6 +20,10 @@ } */ +/*INI +newrelic.distributed_tracing_enabled=0 +*/ + /*EXPECT tracing endpoint reached ok - tracing successful diff --git a/tests/integration/external/curl_exec/test_cat_request_headers_present_array.php b/tests/integration/external/curl_exec/test_cat_request_headers_present_array.php index a032eafa7..e90ab7ac1 100644 --- a/tests/integration/external/curl_exec/test_cat_request_headers_present_array.php +++ b/tests/integration/external/curl_exec/test_cat_request_headers_present_array.php @@ -20,6 +20,10 @@ } */ +/*INI +newrelic.distributed_tracing_enabled=0 +*/ + /*EXPECT tracing endpoint reached ok - tracing successful diff --git a/tests/integration/external/curl_exec/test_cat_request_headers_referenced_array.php b/tests/integration/external/curl_exec/test_cat_request_headers_referenced_array.php index 271c65662..82bdc2af6 100644 --- a/tests/integration/external/curl_exec/test_cat_request_headers_referenced_array.php +++ b/tests/integration/external/curl_exec/test_cat_request_headers_referenced_array.php @@ -20,6 +20,10 @@ } */ +/*INI +newrelic.distributed_tracing_enabled=0 +*/ + /*EXPECT Customer-Header=found tracing endpoint reached ok - tracing successful diff --git a/tests/integration/external/curl_exec/test_cat_response_header_anonymous.php b/tests/integration/external/curl_exec/test_cat_response_header_anonymous.php index 15a5f41c8..6b02af990 100644 --- a/tests/integration/external/curl_exec/test_cat_response_header_anonymous.php +++ b/tests/integration/external/curl_exec/test_cat_response_header_anonymous.php @@ -16,6 +16,10 @@ } */ +/*INI +newrelic.distributed_tracing_enabled=0 +*/ + /*EXPECT tracing endpoint reached ok - tracing successful diff --git a/tests/integration/external/curl_exec/test_cat_response_header_function.php b/tests/integration/external/curl_exec/test_cat_response_header_function.php index 5c5b5ad7b..72fbe0dc3 100644 --- a/tests/integration/external/curl_exec/test_cat_response_header_function.php +++ b/tests/integration/external/curl_exec/test_cat_response_header_function.php @@ -20,6 +20,10 @@ } */ +/*INI +newrelic.distributed_tracing_enabled=0 +*/ + /*EXPECT tracing endpoint reached ok - tracing successful diff --git a/tests/integration/external/curl_exec/test_cat_response_header_returned.php b/tests/integration/external/curl_exec/test_cat_response_header_returned.php index 02843c98c..319ec7313 100644 --- a/tests/integration/external/curl_exec/test_cat_response_header_returned.php +++ b/tests/integration/external/curl_exec/test_cat_response_header_returned.php @@ -19,6 +19,10 @@ } */ +/*INI +newrelic.distributed_tracing_enabled=0 +*/ + /*EXPECT_REGEX tracing endpoint reached */ diff --git a/tests/integration/external/curl_exec/test_cat_response_header_to_stdout.php b/tests/integration/external/curl_exec/test_cat_response_header_to_stdout.php index d47e3719f..54f3d75c3 100644 --- a/tests/integration/external/curl_exec/test_cat_response_header_to_stdout.php +++ b/tests/integration/external/curl_exec/test_cat_response_header_to_stdout.php @@ -19,6 +19,10 @@ } */ +/*INI +newrelic.distributed_tracing_enabled=0 +*/ + /*EXPECT_REGEX tracing endpoint reached */ diff --git a/tests/integration/external/curl_exec/test_cat_simple.php b/tests/integration/external/curl_exec/test_cat_simple.php index 64dafba62..05c6b819c 100644 --- a/tests/integration/external/curl_exec/test_cat_simple.php +++ b/tests/integration/external/curl_exec/test_cat_simple.php @@ -19,6 +19,10 @@ } */ +/*INI +newrelic.distributed_tracing_enabled=0 +*/ + /*EXPECT tracing endpoint reached ok - simple cat request diff --git a/tests/integration/external/curl_exec/test_file_proto.php b/tests/integration/external/curl_exec/test_file_proto.php index 7117c909b..250357836 100644 --- a/tests/integration/external/curl_exec/test_file_proto.php +++ b/tests/integration/external/curl_exec/test_file_proto.php @@ -9,6 +9,10 @@ protocol is used. */ +/*INI +newrelic.distributed_tracing_enabled=0 +*/ + /*SKIPIF /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_synthetics.php b/tests/integration/external/curl_exec/test_synthetics.php index 6388a3307..58351c6a8 100644 --- a/tests/integration/external/curl_exec/test_synthetics.php +++ b/tests/integration/external/curl_exec/test_synthetics.php @@ -27,6 +27,10 @@ * ] */ +/*INI +newrelic.distributed_tracing_enabled=0 +*/ + /*HEADERS X-NewRelic-Synthetics=ENV[SYNTHETICS_HEADER_supportability] */ diff --git a/tests/integration/external/curl_exec/test_synthetics_disabled.php b/tests/integration/external/curl_exec/test_synthetics_disabled.php index 2520c3896..c1bb1c601 100644 --- a/tests/integration/external/curl_exec/test_synthetics_disabled.php +++ b/tests/integration/external/curl_exec/test_synthetics_disabled.php @@ -17,6 +17,7 @@ */ /*INI +newrelic.distributed_tracing_enabled=0 newrelic.synthetics.enabled = false */ 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..750335701 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,10 @@ } */ +/*INI +newrelic.distributed_tracing_enabled=0 +*/ + /*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 Leave me alone!"} */ From 2bfb49dedfc96713759a4b036d9297354db3b6e6 Mon Sep 17 00:00:00 2001 From: Michael Fulbright <89205663+mfulb@users.noreply.github.com> Date: Tue, 5 Apr 2022 16:32:36 -0400 Subject: [PATCH 09/12] feat(agent): Deprecate CAT (#401) * Sets CAT off by default in newrelic.ini template * Sets CAT OFF by default in agent source - Sets compile time initialization of CAT to OFF - Sets compile time initialization of DT to ON - Marks cross_process_enabled field of structs as deprecated in comments - Adds a modify handler for CAT ini parameter which outputs a deprecation warning to log agent file if CAT is detected as enabled. * Applies clang-format to modified files * tests(integration): Propagate CAT setting to mock external service * Added 'cat_enabled' parameter for the mock external service following same mechanism as used for the 'dt_enabled' previously. Required now CAT is disable by default to be able to tell mock service what state CAT should be for test. * tests(integration): Adds tests to confirm default DT and CAT settings Adds two tests which verify CAT is off if DT is disabled and that DT is enabled by default if no other configuration is given. * tests(integration): Fixes tests to work when CAT is disabled by default Now that distributed tracing is enabled by default and CAT is disabled by default some tests which assumed CAT was enabled by default will fail. This corrects these tests to enabled CAT for the duration of the test. * tests(integration): Additional fixes for tests to work when CAT is disabled by default * tests(integration): Fixes http tests to work with CAT off by default * tests(integration): Fixes additonal tests to work with CAT off by default --- agent/php_newrelic.h | 8 +- agent/php_nrini.c | 52 +++++++++++-- agent/scripts/newrelic.ini.template | 5 +- axiom/nr_txn.h | 3 +- src/integration_runner/main.go | 10 +++ tests/include/config.php | 11 ++- .../test_get_request_metadata_cat.php | 2 +- .../errors/test_large_error_message.php | 7 +- .../test_cat_disabled_by_default.php | 67 +++++++++++++++++ .../test_cat_request_headers_empty_array.php | 1 + .../test_cat_request_headers_present.php | 1 + ...test_cat_request_headers_present_array.php | 1 + ...t_cat_request_headers_referenced_array.php | 1 + .../test_cat_response_header_anonymous.php | 1 + .../test_cat_response_header_function.php | 1 + .../test_cat_response_header_returned.php | 1 + .../test_cat_response_header_to_stdout.php | 1 + .../external/curl_exec/test_cat_simple.php | 1 + .../external/curl_exec/test_synthetics.php | 3 +- .../curl_exec/test_synthetics_disabled.php | 1 + .../curl_multi_exec/test_cat_simple.php | 1 + .../test_cat_context_provided.php | 1 + .../test_cat_default_context.php | 1 + .../file_get_contents/test_cat_no_context.php | 1 + .../file_get_contents/test_dt_disabled.php | 1 + .../test_http_response_header_cv.php | 1 + .../test_synthetics_context_provided.php | 1 + .../test_synthetics_default_context.php | 1 + .../test_synthetics_disabled.php | 1 + .../test_synthetics_no_context.php | 1 + .../integration/external/guzzle5/test_cat.php | 1 + .../integration/external/guzzle6/test_cat.php | 1 + .../integration/external/http/test_v1_cat.php | 1 + .../external/http/test_v1_synthetics.php | 1 + .../integration/external/http/test_v2_cat.php | 1 + .../ini/test_dt_enabled_default.php | 75 +++++++++++++++++++ tests/integration/memcached/test_cas.php7.php | 4 + .../memcached/test_cas_by_key.php7.php | 4 + .../pgsql/test_pg_execute_with_resource.php | 4 + .../test_pg_execute_without_resource.php | 4 + .../test_pg_query_params_with_resource.php | 4 + .../test_pg_query_params_without_resource.php | 4 + .../pgsql/test_pg_query_with_resource.php | 4 + .../pgsql/test_pg_query_without_resource.php | 4 + tests/integration/predis/test_basic.php | 2 + .../predis/test_cross_transaction.php | 2 + tests/integration/predis/test_pipeline.php | 2 + .../predis/test_pipeline_atomic.php | 2 + .../predis/test_pipeline_fire_and_forget.php | 2 + 49 files changed, 293 insertions(+), 17 deletions(-) create mode 100644 tests/integration/external/curl_exec/test_cat_disabled_by_default.php create mode 100644 tests/integration/ini/test_dt_enabled_default.php diff --git a/agent/php_newrelic.h b/agent/php_newrelic.h index 0cee7e1fc..3ee0670e3 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 span_events_max_samples_stored; /* newrelic.span_events.max_samples_stored */ +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 diff --git a/agent/php_nrini.c b/agent/php_nrini.c index 4fd5d4957..5d2f5c180 100644 --- a/agent/php_nrini.c +++ b/agent/php_nrini.c @@ -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; @@ -2018,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, @@ -2892,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(); diff --git a/agent/scripts/newrelic.ini.template b/agent/scripts/newrelic.ini.template index ec25520c7..b0b127c58 100644 --- a/agent/scripts/newrelic.ini.template +++ b/agent/scripts/newrelic.ini.template @@ -856,10 +856,11 @@ 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 diff --git a/axiom/nr_txn.h b/axiom/nr_txn.h index 5e8da2e55..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 diff --git a/src/integration_runner/main.go b/src/integration_runner/main.go index 85acb5365..99b50282e 100644 --- a/src/integration_runner/main.go +++ b/src/integration_runner/main.go @@ -171,6 +171,7 @@ 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 @@ -188,6 +189,15 @@ func catRequest(w http.ResponseWriter, r *http.Request) { 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 { http.Error(w, "cat failure: "+err.Error(), http.StatusInternalServerError) diff --git a/tests/include/config.php b/tests/include/config.php index 313b58184..8f29f3faf 100644 --- a/tests/include/config.php +++ b/tests/include/config.php @@ -60,12 +60,21 @@ function make_dt_enabled_param() 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 . - '&' . make_dt_enabled_param(); + '&' . make_dt_enabled_param() . '&' . make_cat_enabled_param(); } $PG_USER = isset_or('PG_USER', 'postgres'); 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/errors/test_large_error_message.php b/tests/integration/errors/test_large_error_message.php index 0cff7d87d..a734119cf 100644 --- a/tests/integration/errors/test_large_error_message.php +++ b/tests/integration/errors/test_large_error_message.php @@ -45,7 +45,12 @@ "error.message": "Uncaught exception 'Exception' with message 'this is a very large error message that will extend beyond a 256 character limit by rambling about the size of the error, as well as inserting random characters. ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz It will also repeat... this is a very large error message that will extend beyond a 256 character limit by rambling about the size of the error, as well as inserting random characters. ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz It will also repeat...this is a very large error message that will extend beyond a 256 character limit by rambling about the size of the error, as well as inserting random characters. ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz It will also repeat... this is a very large error message that will extend beyond a 256 character limit by rambling about the size of the error, as well as inserting random characters. ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz It will also repeat...this is a very large error message that will extend beyond a 256 character limit by rambling about the size of the error, as well as inserting random characters. ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz It will also repeat... this is a very large error message that will extend beyond a 256 character limit by rambling about the size of the error, as well as inserting random characters. ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz It will also repeat...' in __FILE__:??", "transactionName": "OtherTransaction\/php__FILE__", "duration": "??", - "nr.transactionGuid": "??" + "nr.transactionGuid": "??", + "guid": "??", + "sampled": true, + "priority": "??", + "traceId": "??", + "spanId": "??" }, {}, {} diff --git a/tests/integration/external/curl_exec/test_cat_disabled_by_default.php b/tests/integration/external/curl_exec/test_cat_disabled_by_default.php new file mode 100644 index 000000000..84fa3a0a1 --- /dev/null +++ b/tests/integration/external/curl_exec/test_cat_disabled_by_default.php @@ -0,0 +1,67 @@ + Date: Thu, 7 Apr 2022 14:28:41 -0400 Subject: [PATCH 10/12] feat(install): Only allow installer to run on supported arches and OSes (#403) * feat(install): Only allow installer to run on supported arches * Prevent install script from running on Darwin Darwin-based operating systems (Mac OS X, OS X, macOS) are no longer supported, and install script must not attempt any action. * Remove dead code that set arch on Darwin * Prevent install script from running on Solaris Solaris-based operating systems are no longer supported, and install script must not attempt any action. * Add arm64 to list of recognized architectures Explicitly recognize `arm64` pattern as aarch64 architecture to avoid possiblity of being treated as x86_x64 architecture after matching `*64*` pattern. Co-authored-by: Michal Nowacki --- agent/newrelic-install.sh | 42 +++++++++++++++++++++++++++++++-------- 1 file changed, 34 insertions(+), 8 deletions(-) diff --git a/agent/newrelic-install.sh b/agent/newrelic-install.sh index 62ddd250e..3af52b5e7 100755 --- a/agent/newrelic-install.sh +++ b/agent/newrelic-install.sh @@ -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: From 1b9108eb7aeaa9f0244c106e046eda360eff2aa0 Mon Sep 17 00:00:00 2001 From: Amber Sistla Date: Thu, 14 Apr 2022 09:18:32 -0700 Subject: [PATCH 11/12] PHP: update daemon to accept and accommodate additional info from agent and collector (#404) * When compiling the flatbuffers, it changed the format for bool from byte to bool. * Test cases to exercise span event limit communication between agent and daemon and span event limit communication between daemon and collector. * Changes needed to pass the value to the new flatbuffer field. * Modified flatbuffer to accept new variable to pass on to the daemon. After compiling the flatbuffer, copied the new App.go over. * New structs/functions to allow the daemon receive agent max_samples_stored, to receive the new collector span_event_harvest_limit communication, and to have the daemon pick the lowest of the values between agent limits, daemon default limits, and collector limits. --- agent/php_newrelic.h | 3 +- axiom/cmd_appinfo_transmit.c | 2 + axiom/nr_commands_private.h | 3 +- axiom/tests/test_cmd_appinfo.c | 8 + protocol/flatbuffers/protocol.fbs | 33 ++-- src/flatbuffersdata/data.go | 4 +- src/flatbuffersdata/data_test.go | 4 +- src/integration_runner/main.go | 2 +- src/newrelic/app.go | 28 +++- src/newrelic/app_harvest_test.go | 2 +- src/newrelic/app_test.go | 191 +++++++++++++--------- src/newrelic/collector/event_data.go | 109 +++++++++++- src/newrelic/collector/event_data_test.go | 148 +++++++++++++++-- src/newrelic/commands.go | 9 +- src/newrelic/harvest_test.go | 22 +-- src/newrelic/harvest_trigger.go | 2 +- src/newrelic/limits/limits.go | 3 +- src/newrelic/processor.go | 3 +- src/newrelic/processor_test.go | 105 +++++++++++- src/newrelic/protocol/App.go | 40 ++++- 20 files changed, 564 insertions(+), 157 deletions(-) diff --git a/agent/php_newrelic.h b/agent/php_newrelic.h index 3ee0670e3..827fd21d0 100644 --- a/agent/php_newrelic.h +++ b/agent/php_newrelic.h @@ -455,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/axiom/cmd_appinfo_transmit.c b/axiom/cmd_appinfo_transmit.c index abbaa9f9f..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, diff --git a/axiom/nr_commands_private.h b/axiom/nr_commands_private.h index f28e2914e..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 */ diff --git a/axiom/tests/test_cmd_appinfo.c b/axiom/tests/test_cmd_appinfo.c index 8ebebe64a..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); 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 b22e8b2a7..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") diff --git a/src/integration_runner/main.go b/src/integration_runner/main.go index 99b50282e..6971462b0 100644 --- a/src/integration_runner/main.go +++ b/src/integration_runner/main.go @@ -600,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 1754e9efd..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":10000}}` + - `}` + - `]` - - 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":10000}}` + - `}` + - `]` - - 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 cc306dd91..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 = 10000 + 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() } From 90d876061fe39b7f7cc628e9a9f56427c9e881c5 Mon Sep 17 00:00:00 2001 From: Amber Sistla Date: Thu, 21 Apr 2022 09:16:49 -0700 Subject: [PATCH 12/12] PHP: Laravel 8+ updates (#419) * Updated Laravel detection. * Updated type for opcache resource offset. * Updated preload behavior for php 8.1+ --- agent/fw_laravel.c | 34 +++++++++++++++++----------------- agent/php_execute.c | 8 +++++--- agent/php_globals.h | 9 ++++++++- agent/php_txn.c | 7 +++++++ agent/php_vm.c | 1 + 5 files changed, 38 insertions(+), 21 deletions(-) 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/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_txn.c b/agent/php_txn.c index e6199f850..e35630d61 100644 --- a/agent/php_txn.c +++ b/agent/php_txn.c @@ -848,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; } 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