diff --git a/appsec/tests/extension/client_init_record_span_tags.phpt b/appsec/tests/extension/client_init_record_span_tags.phpt index 8a86280ff4..5455aeafd6 100644 --- a/appsec/tests/extension/client_init_record_span_tags.phpt +++ b/appsec/tests/extension/client_init_record_span_tags.phpt @@ -109,4 +109,6 @@ Array [_dd.agent_psr] => 1 [_sampling_priority_v1] => 1 [php.compilation.total_time_ms] => %f + [php.memory.peak_usage_bytes] => %f + [php.memory.peak_real_usage_bytes] => %f ) diff --git a/appsec/tests/extension/rinit_record_span_tags.phpt b/appsec/tests/extension/rinit_record_span_tags.phpt index 981f0ade01..3ffe1d1f79 100644 --- a/appsec/tests/extension/rinit_record_span_tags.phpt +++ b/appsec/tests/extension/rinit_record_span_tags.phpt @@ -102,4 +102,6 @@ Array [_dd.agent_psr] => 1 [_sampling_priority_v1] => 1 [php.compilation.total_time_ms] => %f + [php.memory.peak_usage_bytes] => %f + [php.memory.peak_real_usage_bytes] => %f ) diff --git a/appsec/tests/extension/root_span_add_tag.phpt b/appsec/tests/extension/root_span_add_tag.phpt index fbb7086f03..46b3375cf5 100644 --- a/appsec/tests/extension/root_span_add_tag.phpt +++ b/appsec/tests/extension/root_span_add_tag.phpt @@ -56,7 +56,7 @@ array(1) { string(16) "%s" } ["metrics"]=> - array(4) { + array(6) { [%s"]=> float(%d) ["_dd.agent_psr"]=> @@ -65,6 +65,10 @@ array(1) { float(1) ["php.compilation.total_time_ms"]=> float(%s) + ["php.memory.peak_usage_bytes"]=> + float(%f) + ["php.memory.peak_real_usage_bytes"]=> + float(%f) } } } diff --git a/appsec/tests/extension/root_span_add_tag_with_intermediate_spans.phpt b/appsec/tests/extension/root_span_add_tag_with_intermediate_spans.phpt index fe8b0b9b3f..1a6f89f10c 100644 --- a/appsec/tests/extension/root_span_add_tag_with_intermediate_spans.phpt +++ b/appsec/tests/extension/root_span_add_tag_with_intermediate_spans.phpt @@ -84,4 +84,6 @@ Array [_dd.agent_psr] => 1 [_sampling_priority_v1] => 1 [php.compilation.total_time_ms] => %s + [php.memory.peak_usage_bytes] => %f + [php.memory.peak_real_usage_bytes] => %f ) diff --git a/docker-compose.yml b/docker-compose.yml index 77916a295f..d5e4d00842 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -224,7 +224,7 @@ services: - DD_DISABLE_ERROR_RESPONSES=true - SNAPSHOTS_DIR=/snapshots - SNAPSHOT_CI=0 - - SNAPSHOT_REMOVED_ATTRS=start,duration,metrics.php.compilation.total_time_ms,metrics.process_id + - SNAPSHOT_REMOVED_ATTRS=start,duration,metrics.php.compilation.total_time_ms,metrics.php.memory.peak_usage_bytes,metrics.php.memory.peak_real_usage_bytes,metrics.process_id - ENABLED_CHECKS=trace_stall,trace_peer_service,trace_dd_service diff --git a/ext/configuration.h b/ext/configuration.h index 4a8b051fea..2c4bd325de 100644 --- a/ext/configuration.h +++ b/ext/configuration.h @@ -115,6 +115,7 @@ enum ddtrace_sampling_rules_format { CONFIG(BOOL, DD_TRACE_AUTO_FLUSH_ENABLED, "false") \ CONFIG(BOOL, DD_TRACE_CLI_ENABLED, "false") \ CONFIG(BOOL, DD_TRACE_MEASURE_COMPILE_TIME, "true") \ + CONFIG(BOOL, DD_TRACE_MEASURE_PEAK_MEMORY_USAGE, "true") \ CONFIG(BOOL, DD_TRACE_DEBUG, "false", .ini_change = ddtrace_alter_dd_trace_debug) \ CONFIG(BOOL, DD_TRACE_ENABLED, "true", .ini_change = ddtrace_alter_dd_trace_disabled_config, \ .env_config_fallback = ddtrace_conf_otel_traces_exporter) \ diff --git a/ext/serializer.c b/ext/serializer.c index 7f97e61d38..8e521512fb 100644 --- a/ext/serializer.c +++ b/ext/serializer.c @@ -1847,8 +1847,14 @@ void ddtrace_serialize_span_to_array(ddtrace_span_data *span, zval *array) { } } - if (ddtrace_span_is_entrypoint_root(span) && get_DD_TRACE_MEASURE_COMPILE_TIME()) { - add_assoc_double(&metrics_zv, "php.compilation.total_time_ms", ddtrace_compile_time_get() / 1000.); + if (ddtrace_span_is_entrypoint_root(span)) { + if (get_DD_TRACE_MEASURE_COMPILE_TIME()) { + add_assoc_double(&metrics_zv, "php.compilation.total_time_ms", ddtrace_compile_time_get() / 1000.); + } + if (get_DD_TRACE_MEASURE_PEAK_MEMORY_USAGE()) { + add_assoc_double(&metrics_zv, "php.memory.peak_usage_bytes", zend_memory_peak_usage(false)); + add_assoc_double(&metrics_zv, "php.memory.peak_real_usage_bytes", zend_memory_peak_usage(true)); + } } LOGEV(SPAN, { diff --git a/github-actions-helpers/Build.Github.cs b/github-actions-helpers/Build.Github.cs index 87b4978907..37a0377f96 100644 --- a/github-actions-helpers/Build.Github.cs +++ b/github-actions-helpers/Build.Github.cs @@ -164,7 +164,7 @@ string CleanValue(string value) char[] charsToTrim = { ' ', ',' }; string cleaned = value.TrimStart('-', '+').Trim(charsToTrim); - string[] keysToReplace = { "start", "duration", "php.compilation.total_time_ms", "process_id" }; + string[] keysToReplace = { "start", "duration", "php.compilation.total_time_ms", "metrics.php.memory.peak_usage_bytes", "metrics.php.memory.peak_real_usage_bytes", "process_id" }; foreach (var key in keysToReplace) { if (cleaned.Contains(key)) diff --git a/tests/Common/SnapshotTestTrait.php b/tests/Common/SnapshotTestTrait.php index b825e35085..49a5de1be1 100644 --- a/tests/Common/SnapshotTestTrait.php +++ b/tests/Common/SnapshotTestTrait.php @@ -123,7 +123,7 @@ private function waitForTraces(string $token, int $numExpectedTraces = 0) */ private function stopAndCompareSnapshotSession( string $token, - array $fieldsToIgnore = ['metrics.php.compilation.total_time_ms', 'meta.error.stack', 'meta._dd.p.tid'], + array $fieldsToIgnore = ['metrics.php.compilation.total_time_ms', 'metrics.php.memory.peak_usage_bytes', 'metrics.php.memory.peak_real_usage_bytes', 'meta.error.stack', 'meta._dd.p.tid'], int $numExpectedTraces = 1, bool $snapshotMetrics = false, array $fieldsToIgnoreMetrics = ['openai.request.duration'], @@ -290,7 +290,7 @@ private function filterMetrics($metrics, $fieldsToIgnore) public function tracesFromWebRequestSnapshot( $fn, - $fieldsToIgnore = ['metrics.php.compilation.total_time_ms', 'meta.error.stack', 'meta._dd.p.tid', 'start', 'duration'], + $fieldsToIgnore = ['metrics.php.compilation.total_time_ms', 'metrics.php.memory.peak_usage_bytes', 'metrics.php.memory.peak_real_usage_bytes', 'meta.error.stack', 'meta._dd.p.tid', 'start', 'duration'], $numExpectedTraces = 1, $tracer = null ) { @@ -317,7 +317,7 @@ public function tracesFromWebRequestSnapshot( public function isolateTracerSnapshot( $fn, - $fieldsToIgnore = ['metrics.php.compilation.total_time_ms', 'meta.error.stack', 'meta._dd.p.tid'], + $fieldsToIgnore = ['metrics.php.compilation.total_time_ms', 'metrics.php.memory.peak_usage_bytes', 'metrics.php.memory.peak_real_usage_bytes', 'meta.error.stack', 'meta._dd.p.tid'], $numExpectedTraces = 1, $tracer = null, $config = [], @@ -370,7 +370,7 @@ public function isolateTracerSnapshot( public function snapshotFromTraces( $traces, - $fieldsToIgnore = ['metrics.php.compilation.total_time_ms', 'meta.error.stack', 'meta._dd.p.tid'], + $fieldsToIgnore = ['metrics.php.compilation.total_time_ms', 'metrics.php.memory.peak_usage_bytes', 'metrics.php.memory.peak_real_usage_bytes', 'meta.error.stack', 'meta._dd.p.tid'], $tokenSubstitute = null, $ignoreSampledAway = false ) { diff --git a/tests/Common/SpanChecker.php b/tests/Common/SpanChecker.php index 3153a8551b..a8c473ad84 100644 --- a/tests/Common/SpanChecker.php +++ b/tests/Common/SpanChecker.php @@ -87,6 +87,8 @@ public static function dumpSpansGraph(array $spansGraph, int $indent = 0) } if (isset($span['metrics'])) { unset($span['metrics']['php.compilation.total_time_ms']); + unset($span['metrics']['php.memory.peak_usage_bytes']); + unset($span['metrics']['php.memory.peak_real_usage_bytes']); unset($span['metrics']['process_id']); foreach ($span['metrics'] as $k => $v) { $out .= str_repeat(' ', $indent) . ' ' . $k . ' => ' . $v . "\n"; @@ -524,6 +526,12 @@ function ($key) use ($pattern) { if (!isset($metrics['php.compilation.total_time_ms'])) { unset($spanMetrics['php.compilation.total_time_ms']); } + if (!isset($metrics['php.memory.peak_usage_bytes'])) { + unset($spanMetrics['php.memory.peak_usage_bytes']); + } + if (!isset($metrics['php.memory.peak_real_usage_bytes'])) { + unset($spanMetrics['php.memory.peak_real_usage_bytes']); + } if (isset($metrics['process_id'])) { unset($metrics['process_id']); } diff --git a/tests/Integrations/Custom/Autoloaded/CompileTimeDisabledTest.php b/tests/Integrations/Custom/Autoloaded/CompileTimeDisabledTest.php index 75d9ca48e6..90a5b07460 100644 --- a/tests/Integrations/Custom/Autoloaded/CompileTimeDisabledTest.php +++ b/tests/Integrations/Custom/Autoloaded/CompileTimeDisabledTest.php @@ -16,6 +16,7 @@ protected static function getEnvs() { return array_merge(parent::getEnvs(), [ 'DD_TRACE_MEASURE_COMPILE_TIME' => '0', + 'DD_TRACE_MEASURE_PEAK_MEMORY_USAGE' => '0', ]); } @@ -26,12 +27,14 @@ protected function ddSetUp() * For the compile-time metrics specifically, this goofs things up, so let's disable. */ self::putenv('DD_TRACE_MEASURE_COMPILE_TIME=0'); + self::putenv('DD_TRACE_MEASURE_PEAK_MEMORY_USAGE=0'); \dd_trace_internal_fn('ddtrace_reload_config'); } protected function ddTearDown() { self::putenv('DD_TRACE_MEASURE_COMPILE_TIME'); + self::putenv('DD_TRACE_MEASURE_PEAK_MEMORY_USAGE'); dd_trace_internal_fn('ddtrace_reload_config'); parent::ddTearDown(); } @@ -44,5 +47,7 @@ public function testScenario() }); self::assertFalse(isset($traces[0][0]['metrics']['php.compilation.total_time_ms'])); + self::assertFalse(isset($traces[0][0]['metrics']['php.memory.peak_usage_bytes'])); + self::assertFalse(isset($traces[0][0]['metrics']['php.memory.peak_real_usage_bytes'])); } } diff --git a/tests/Integrations/Custom/Autoloaded/CompileTimeEnabledTest.php b/tests/Integrations/Custom/Autoloaded/CompileTimeEnabledTest.php index 98de286e2e..32bd515bff 100644 --- a/tests/Integrations/Custom/Autoloaded/CompileTimeEnabledTest.php +++ b/tests/Integrations/Custom/Autoloaded/CompileTimeEnabledTest.php @@ -16,6 +16,7 @@ protected static function getEnvs() { return array_merge(parent::getEnvs(), [ 'DD_TRACE_MEASURE_COMPILE_TIME' => '1', + 'DD_TRACE_MEASURE_PEAK_MEMORY_USAGE' => '1', ]); } @@ -26,12 +27,14 @@ protected function ddSetUp() * For the compile-time metrics specifically, this goofs things up, so let's disable. */ self::putenv('DD_TRACE_MEASURE_COMPILE_TIME=0'); + self::putenv('DD_TRACE_MEASURE_PEAK_MEMORY_USAGE=0'); \dd_trace_internal_fn('ddtrace_reload_config'); } protected function ddTearDown() { self::putenv('DD_TRACE_MEASURE_COMPILE_TIME'); + self::putenv('DD_TRACE_MEASURE_PEAK_MEMORY_USAGE'); dd_trace_internal_fn('ddtrace_reload_config'); parent::ddTearDown(); } @@ -44,5 +47,7 @@ public function testScenario() }); self::assertTrue(isset($traces[0][0]['metrics']['php.compilation.total_time_ms'])); + self::assertTrue(isset($traces[0][0]['metrics']['php.memory.peak_usage_bytes'])); + self::assertTrue(isset($traces[0][0]['metrics']['php.memory.peak_real_usage_bytes'])); } } diff --git a/tests/Integrations/Guzzle/V6/GuzzleIntegrationTest.php b/tests/Integrations/Guzzle/V6/GuzzleIntegrationTest.php index 46604cc87f..3626216180 100644 --- a/tests/Integrations/Guzzle/V6/GuzzleIntegrationTest.php +++ b/tests/Integrations/Guzzle/V6/GuzzleIntegrationTest.php @@ -516,6 +516,8 @@ public function testMultiExec() }, [ 'start', 'metrics.php.compilation.total_time_ms', + 'metrics.php.memory.peak_usage_bytes', + 'metrics.php.memory.peak_real_usage_bytes', 'meta.error.stack', 'meta._dd.p.tid', 'meta.curl.appconnect_time_us', diff --git a/tests/Integrations/Guzzle/V7/GuzzleIntegrationTest.php b/tests/Integrations/Guzzle/V7/GuzzleIntegrationTest.php index 87086fe707..4d6a93c09c 100644 --- a/tests/Integrations/Guzzle/V7/GuzzleIntegrationTest.php +++ b/tests/Integrations/Guzzle/V7/GuzzleIntegrationTest.php @@ -84,6 +84,8 @@ public function testMultiExec() }, [ 'start', 'metrics.php.compilation.total_time_ms', + 'metrics.php.memory.peak_usage_bytes', + 'metrics.php.memory.peak_real_usage_bytes', 'meta.error.stack', 'meta._dd.p.tid', 'meta.curl.appconnect_time_us', diff --git a/tests/Integrations/Symfony/V4_4/MessengerTest.php b/tests/Integrations/Symfony/V4_4/MessengerTest.php index dc387c2169..cc58c62907 100644 --- a/tests/Integrations/Symfony/V4_4/MessengerTest.php +++ b/tests/Integrations/Symfony/V4_4/MessengerTest.php @@ -10,6 +10,8 @@ class MessengerTest extends WebFrameworkTestCase { const FIELDS_TO_IGNORE = [ 'metrics.php.compilation.total_time_ms', + 'metrics.php.memory.peak_usage_bytes', + 'metrics.php.memory.peak_real_usage_bytes', 'meta.error.stack', 'meta._dd..tid', 'meta.messaging.message_id', diff --git a/tests/Integrations/Symfony/V5_2/MessengerTest.php b/tests/Integrations/Symfony/V5_2/MessengerTest.php index 814be69070..3bf22a2327 100644 --- a/tests/Integrations/Symfony/V5_2/MessengerTest.php +++ b/tests/Integrations/Symfony/V5_2/MessengerTest.php @@ -10,6 +10,8 @@ class MessengerTest extends WebFrameworkTestCase { const FIELDS_TO_IGNORE = [ 'metrics.php.compilation.total_time_ms', + 'metrics.php.memory.peak_usage_bytes', + 'metrics.php.memory.peak_real_usage_bytes', 'meta.error.stack', 'meta._dd..tid', 'meta.messaging.message_id', diff --git a/tests/Integrations/Symfony/V6_2/MessengerTest.php b/tests/Integrations/Symfony/V6_2/MessengerTest.php index bc801867ec..c3c2adffc3 100644 --- a/tests/Integrations/Symfony/V6_2/MessengerTest.php +++ b/tests/Integrations/Symfony/V6_2/MessengerTest.php @@ -10,6 +10,8 @@ class MessengerTest extends WebFrameworkTestCase { const FIELDS_TO_IGNORE = [ 'metrics.php.compilation.total_time_ms', + 'metrics.php.memory.peak_usage_bytes', + 'metrics.php.memory.peak_real_usage_bytes', 'meta.error.stack', 'meta._dd..tid', 'meta.messaging.message_id', diff --git a/tests/Integrations/Symfony/V7_0/MessengerTest.php b/tests/Integrations/Symfony/V7_0/MessengerTest.php index 839c2339e5..cf729fb468 100644 --- a/tests/Integrations/Symfony/V7_0/MessengerTest.php +++ b/tests/Integrations/Symfony/V7_0/MessengerTest.php @@ -10,6 +10,8 @@ class MessengerTest extends WebFrameworkTestCase { const FIELDS_TO_IGNORE = [ 'metrics.php.compilation.total_time_ms', + 'metrics.php.memory.peak_usage_bytes', + 'metrics.php.memory.peak_real_usage_bytes', 'meta.error.stack', 'meta._dd.p.tid', 'meta.messaging.message_id', diff --git a/tests/ext/close_spans_until.phpt b/tests/ext/close_spans_until.phpt index 33f5209ba1..f362895631 100644 --- a/tests/ext/close_spans_until.phpt +++ b/tests/ext/close_spans_until.phpt @@ -48,7 +48,7 @@ int(2) [ddtrace] [span] Switching to different SpanStack: %d int(1) int(0) -[ddtrace] [span] Encoding span %d: trace_id=%s, name='close_spans_until.php', service='close_spans_until.php', resource: 'close_spans_until.php', type 'cli' with tags: runtime-id='%s', _dd.p.dm='-0', _dd.p.tid='%s'; and metrics: process_id='%d', _dd.agent_psr='1', _sampling_priority_v1='1', php.compilation.total_time_ms='%f' +[ddtrace] [span] Encoding span %d: trace_id=%s, name='close_spans_until.php', service='close_spans_until.php', resource: 'close_spans_until.php', type 'cli' with tags: runtime-id='%s', _dd.p.dm='-0', _dd.p.tid='%s'; and metrics: process_id='%d', _dd.agent_psr='1', _sampling_priority_v1='1', php.compilation.total_time_ms='%f', php.memory.peak_usage_bytes='%f', php.memory.peak_real_usage_bytes='%f' [ddtrace] [span] Encoding span %d: trace_id=%s, name='traced', service='close_spans_until.php', resource: 'traced', type 'cli' with tags: -; and metrics: - [ddtrace] [span] Encoding span %d: trace_id=%s, name='', service='close_spans_until.php', resource: '', type 'cli' with tags: -; and metrics: - [ddtrace] [span] Encoding span %d: trace_id=%s, name='', service='close_spans_until.php', resource: '', type 'cli' with tags: -; and metrics: - diff --git a/tests/ext/distributed_tracing/distributed_trace_bogus_ids.phpt b/tests/ext/distributed_tracing/distributed_trace_bogus_ids.phpt index 7621e5e154..95d2fe36bf 100644 --- a/tests/ext/distributed_tracing/distributed_trace_bogus_ids.phpt +++ b/tests/ext/distributed_tracing/distributed_trace_bogus_ids.phpt @@ -47,7 +47,7 @@ array(1) { string(16) "%s" } ["metrics"]=> - array(4) { + array(6) { ["process_id"]=> float(%f) ["_dd.agent_psr"]=> @@ -56,6 +56,10 @@ array(1) { float(1) ["php.compilation.total_time_ms"]=> float(%f) + ["php.memory.peak_usage_bytes"]=> + float(%f) + ["php.memory.peak_real_usage_bytes"]=> + float(%f) } } } diff --git a/tests/ext/distributed_tracing/distributed_trace_inherit.phpt b/tests/ext/distributed_tracing/distributed_trace_inherit.phpt index eec5fb4034..f559599153 100644 --- a/tests/ext/distributed_tracing/distributed_trace_inherit.phpt +++ b/tests/ext/distributed_tracing/distributed_trace_inherit.phpt @@ -59,13 +59,17 @@ array(2) { string(7) "datadog" } ["metrics"]=> - array(3) { + array(5) { ["process_id"]=> float(%f) ["_sampling_priority_v1"]=> float(3) ["php.compilation.total_time_ms"]=> float(%f) + ["php.memory.peak_usage_bytes"]=> + float(%f) + ["php.memory.peak_real_usage_bytes"]=> + float(%f) } } [1]=> diff --git a/tests/ext/integrations/source_code/commit_sha_env_var.phpt b/tests/ext/integrations/source_code/commit_sha_env_var.phpt index 4cfa334504..d158be18a1 100644 --- a/tests/ext/integrations/source_code/commit_sha_env_var.phpt +++ b/tests/ext/integrations/source_code/commit_sha_env_var.phpt @@ -49,7 +49,7 @@ array(2) { string(16) "%s" } ["metrics"]=> - array(4) { + array(6) { ["process_id"]=> float(%f) ["_dd.agent_psr"]=> @@ -58,6 +58,10 @@ array(2) { float(1) ["php.compilation.total_time_ms"]=> float(%f) + ["php.memory.peak_usage_bytes"]=> + float(%f) + ["php.memory.peak_real_usage_bytes"]=> + float(%f) } } [1]=> diff --git a/tests/ext/integrations/source_code/git_metadata_injection_from_env.phpt b/tests/ext/integrations/source_code/git_metadata_injection_from_env.phpt index 46f1bec83a..31c2d5013f 100644 --- a/tests/ext/integrations/source_code/git_metadata_injection_from_env.phpt +++ b/tests/ext/integrations/source_code/git_metadata_injection_from_env.phpt @@ -52,7 +52,7 @@ array(2) { string(16) "%s" } ["metrics"]=> - array(4) { + array(6) { ["process_id"]=> float(%d) ["_dd.agent_psr"]=> @@ -61,6 +61,10 @@ array(2) { float(1) ["php.compilation.total_time_ms"]=> float(%f) + ["php.memory.peak_usage_bytes"]=> + float(%f) + ["php.memory.peak_real_usage_bytes"]=> + float(%f) } } [1]=> diff --git a/tests/ext/integrations/source_code/git_metadata_injection_from_global_tags.phpt b/tests/ext/integrations/source_code/git_metadata_injection_from_global_tags.phpt index 2201f2e9fa..56059b30e5 100644 --- a/tests/ext/integrations/source_code/git_metadata_injection_from_global_tags.phpt +++ b/tests/ext/integrations/source_code/git_metadata_injection_from_global_tags.phpt @@ -55,7 +55,7 @@ array(2) { string(16) "%s" } ["metrics"]=> - array(4) { + array(6) { ["process_id"]=> float(%d) ["_dd.agent_psr"]=> @@ -64,6 +64,10 @@ array(2) { float(1) ["php.compilation.total_time_ms"]=> float(%f) + ["php.memory.peak_usage_bytes"]=> + float(%f) + ["php.memory.peak_real_usage_bytes"]=> + float(%f) } } [1]=> diff --git a/tests/ext/integrations/source_code/git_metadata_injection_remove_credentials_from_env.phpt b/tests/ext/integrations/source_code/git_metadata_injection_remove_credentials_from_env.phpt index b2ab4e940c..e90a2a8e7e 100644 --- a/tests/ext/integrations/source_code/git_metadata_injection_remove_credentials_from_env.phpt +++ b/tests/ext/integrations/source_code/git_metadata_injection_remove_credentials_from_env.phpt @@ -52,7 +52,7 @@ array(2) { string(16) "%s" } ["metrics"]=> - array(4) { + array(6) { ["process_id"]=> float(%d) ["_dd.agent_psr"]=> @@ -61,6 +61,10 @@ array(2) { float(1) ["php.compilation.total_time_ms"]=> float(%f) + ["php.memory.peak_usage_bytes"]=> + float(%f) + ["php.memory.peak_real_usage_bytes"]=> + float(%f) } } [1]=> diff --git a/tests/ext/integrations/source_code/repository_url_env_var.phpt b/tests/ext/integrations/source_code/repository_url_env_var.phpt index 12a04d6b11..db27df5267 100644 --- a/tests/ext/integrations/source_code/repository_url_env_var.phpt +++ b/tests/ext/integrations/source_code/repository_url_env_var.phpt @@ -49,7 +49,7 @@ array(2) { string(16) "%s" } ["metrics"]=> - array(4) { + array(6) { ["process_id"]=> float(%d) ["_dd.agent_psr"]=> @@ -58,6 +58,10 @@ array(2) { float(1) ["php.compilation.total_time_ms"]=> float(%f) + ["php.memory.peak_usage_bytes"]=> + float(%f) + ["php.memory.peak_real_usage_bytes"]=> + float(%f) } } [1]=> diff --git a/tests/ext/sandbox-prehook/dd_trace_method.phpt b/tests/ext/sandbox-prehook/dd_trace_method.phpt index 5b09b27dd5..1e3aeb855d 100644 --- a/tests/ext/sandbox-prehook/dd_trace_method.phpt +++ b/tests/ext/sandbox-prehook/dd_trace_method.phpt @@ -121,7 +121,7 @@ array(3) { string(16) "%s" } ["metrics"]=> - array(6) { + array(8) { ["process_id"]=> float(%f) ["foo"]=> @@ -134,6 +134,10 @@ array(3) { float(1) ["php.compilation.total_time_ms"]=> float(%f) + ["php.memory.peak_usage_bytes"]=> + float(%f) + ["php.memory.peak_real_usage_bytes"]=> + float(%f) } } [1]=> @@ -190,7 +194,7 @@ array(3) { string(16) "%s" } ["metrics"]=> - array(4) { + array(6) { ["process_id"]=> float(%f) ["_dd.agent_psr"]=> @@ -199,6 +203,10 @@ array(3) { float(1) ["php.compilation.total_time_ms"]=> float(%f) + ["php.memory.peak_usage_bytes"]=> + float(%f) + ["php.memory.peak_real_usage_bytes"]=> + float(%f) } } } diff --git a/tests/ext/sandbox/dd_trace_function_complex.phpt b/tests/ext/sandbox/dd_trace_function_complex.phpt index 0394cb5023..2409725bac 100644 --- a/tests/ext/sandbox/dd_trace_function_complex.phpt +++ b/tests/ext/sandbox/dd_trace_function_complex.phpt @@ -128,7 +128,7 @@ array(5) { string(16) "%s" } ["metrics"]=> - array(6) { + array(8) { ["process_id"]=> float(%f) ["foo"]=> @@ -141,6 +141,10 @@ array(5) { float(1) ["php.compilation.total_time_ms"]=> float(%f) + ["php.memory.peak_usage_bytes"]=> + float(%f) + ["php.memory.peak_real_usage_bytes"]=> + float(%f) } } [1]=> @@ -223,7 +227,7 @@ array(5) { string(16) "%s" } ["metrics"]=> - array(4) { + array(6) { ["process_id"]=> float(%f) ["_dd.agent_psr"]=> @@ -232,6 +236,10 @@ array(5) { float(1) ["php.compilation.total_time_ms"]=> float(%f) + ["php.memory.peak_usage_bytes"]=> + float(%f) + ["php.memory.peak_real_usage_bytes"]=> + float(%f) } } [4]=> @@ -262,7 +270,7 @@ array(5) { string(16) "%s" } ["metrics"]=> - array(4) { + array(6) { ["process_id"]=> float(%f) ["_dd.agent_psr"]=> @@ -271,6 +279,10 @@ array(5) { float(1) ["php.compilation.total_time_ms"]=> float(%f) + ["php.memory.peak_usage_bytes"]=> + float(%f) + ["php.memory.peak_real_usage_bytes"]=> + float(%f) } } } diff --git a/tests/ext/sandbox/dd_trace_function_internal.phpt b/tests/ext/sandbox/dd_trace_function_internal.phpt index fc1acb3d62..8e94373a98 100644 --- a/tests/ext/sandbox/dd_trace_function_internal.phpt +++ b/tests/ext/sandbox/dd_trace_function_internal.phpt @@ -51,7 +51,7 @@ array(1) { string(16) "%s" } ["metrics"]=> - array(4) { + array(6) { ["process_id"]=> float(%f) ["_dd.agent_psr"]=> @@ -60,6 +60,10 @@ array(1) { float(1) ["php.compilation.total_time_ms"]=> float(%f) + ["php.memory.peak_usage_bytes"]=> + float(%f) + ["php.memory.peak_real_usage_bytes"]=> + float(%f) } } } diff --git a/tests/ext/sandbox/dd_trace_method.phpt b/tests/ext/sandbox/dd_trace_method.phpt index 5274ed6e67..33705ad6ea 100644 --- a/tests/ext/sandbox/dd_trace_method.phpt +++ b/tests/ext/sandbox/dd_trace_method.phpt @@ -136,7 +136,7 @@ array(3) { string(16) "%s" } ["metrics"]=> - array(6) { + array(8) { ["process_id"]=> float(%f) ["foo"]=> @@ -149,6 +149,10 @@ array(3) { float(1) ["php.compilation.total_time_ms"]=> float(%f) + ["php.memory.peak_usage_bytes"]=> + float(%f) + ["php.memory.peak_real_usage_bytes"]=> + float(%f) } } [1]=> @@ -209,7 +213,7 @@ array(3) { string(16) "%s" } ["metrics"]=> - array(4) { + array(6) { ["process_id"]=> float(%f) ["_dd.agent_psr"]=> @@ -218,6 +222,10 @@ array(3) { float(1) ["php.compilation.total_time_ms"]=> float(%f) + ["php.memory.peak_usage_bytes"]=> + float(%f) + ["php.memory.peak_real_usage_bytes"]=> + float(%f) } } } diff --git a/tests/ext/sandbox/die_in_sandbox.phpt b/tests/ext/sandbox/die_in_sandbox.phpt index 988f595585..d70f85d96b 100644 --- a/tests/ext/sandbox/die_in_sandbox.phpt +++ b/tests/ext/sandbox/die_in_sandbox.phpt @@ -16,6 +16,6 @@ x(); ?> --EXPECTF-- [ddtrace] [warning] UnwindExit thrown in ddtrace's closure defined at %s:%d for x(): -[ddtrace] [span] Encoding span %d: trace_id=%s, name='die_in_sandbox.php', service='die_in_sandbox.php', resource: 'die_in_sandbox.php', type 'cli' with tags: runtime-id='%s', _dd.p.dm='-0', _dd.p.tid='%s'; and metrics: process_id='%d', _dd.agent_psr='1', _sampling_priority_v1='1', php.compilation.total_time_ms='%f' +[ddtrace] [span] Encoding span %d: trace_id=%s, name='die_in_sandbox.php', service='die_in_sandbox.php', resource: 'die_in_sandbox.php', type 'cli' with tags: runtime-id='%s', _dd.p.dm='-0', _dd.p.tid='%s'; and metrics: process_id='%d', _dd.agent_psr='1', _sampling_priority_v1='1', php.compilation.total_time_ms='%f', php.memory.peak_usage_bytes='%f', php.memory.peak_real_usage_bytes='%f' [ddtrace] [span] Encoding span %d: trace_id=%s, name='x', service='die_in_sandbox.php', resource: 'x', type 'cli' with tags: -; and metrics: - [ddtrace] [info] Flushing trace of size 2 to send-queue for %s diff --git a/tests/ext/sandbox/errors_are_flagged_from_userland.phpt b/tests/ext/sandbox/errors_are_flagged_from_userland.phpt index 2214480f58..244ac1ce2c 100644 --- a/tests/ext/sandbox/errors_are_flagged_from_userland.phpt +++ b/tests/ext/sandbox/errors_are_flagged_from_userland.phpt @@ -55,7 +55,7 @@ array(1) { string(16) "%s" } ["metrics"]=> - array(4) { + array(6) { ["process_id"]=> float(%f) ["_dd.agent_psr"]=> @@ -64,6 +64,10 @@ array(1) { float(1) ["php.compilation.total_time_ms"]=> float(%f) + ["php.memory.peak_usage_bytes"]=> + float(%f) + ["php.memory.peak_real_usage_bytes"]=> + float(%f) } } } diff --git a/tests/ext/sandbox/span_clone.phpt b/tests/ext/sandbox/span_clone.phpt index 34fe3f3604..1961a50873 100644 --- a/tests/ext/sandbox/span_clone.phpt +++ b/tests/ext/sandbox/span_clone.phpt @@ -240,7 +240,7 @@ array(1) { string(16) "%s" } ["metrics"]=> - array(4) { + array(6) { ["process_id"]=> float(%f) ["_dd.agent_psr"]=> @@ -249,6 +249,10 @@ array(1) { float(1) ["php.compilation.total_time_ms"]=> float(%f) + ["php.memory.peak_usage_bytes"]=> + float(%f) + ["php.memory.peak_real_usage_bytes"]=> + float(%f) } } } diff --git a/tests/ext/span_with_removed_exception.phpt b/tests/ext/span_with_removed_exception.phpt index 0231ce6469..b34267c41b 100644 --- a/tests/ext/span_with_removed_exception.phpt +++ b/tests/ext/span_with_removed_exception.phpt @@ -77,7 +77,7 @@ array(1) { string(16) "%s" } ["metrics"]=> - array(4) { + array(6) { ["process_id"]=> float(%f) ["_dd.agent_psr"]=> @@ -86,6 +86,10 @@ array(1) { float(1) ["php.compilation.total_time_ms"]=> float(%f) + ["php.memory.peak_usage_bytes"]=> + float(%f) + ["php.memory.peak_real_usage_bytes"]=> + float(%f) } } } @@ -118,7 +122,7 @@ array(1) { string(16) "%s" } ["metrics"]=> - array(4) { + array(6) { ["process_id"]=> float(%f) ["_dd.agent_psr"]=> @@ -127,6 +131,10 @@ array(1) { float(1) ["php.compilation.total_time_ms"]=> float(%f) + ["php.memory.peak_usage_bytes"]=> + float(%f) + ["php.memory.peak_real_usage_bytes"]=> + float(%f) } } } @@ -159,7 +167,7 @@ array(1) { string(16) "%s" } ["metrics"]=> - array(4) { + array(6) { ["process_id"]=> float(%f) ["_dd.agent_psr"]=> @@ -168,6 +176,10 @@ array(1) { float(1) ["php.compilation.total_time_ms"]=> float(%f) + ["php.memory.peak_usage_bytes"]=> + float(%f) + ["php.memory.peak_real_usage_bytes"]=> + float(%f) } } } diff --git a/tests/ext/start_span_with_all_properties.phpt b/tests/ext/start_span_with_all_properties.phpt index 6bf0c725ff..28a6701904 100644 --- a/tests/ext/start_span_with_all_properties.phpt +++ b/tests/ext/start_span_with_all_properties.phpt @@ -82,7 +82,7 @@ array(2) { string(16) "%s" } ["metrics"]=> - array(4) { + array(6) { ["process_id"]=> float(%f) ["_dd.agent_psr"]=> @@ -91,6 +91,10 @@ array(2) { float(1) ["php.compilation.total_time_ms"]=> float(%f) + ["php.memory.peak_usage_bytes"]=> + float(%f) + ["php.memory.peak_real_usage_bytes"]=> + float(%f) } } [1]=> @@ -123,7 +127,7 @@ array(2) { string(16) "%s" } ["metrics"]=> - array(5) { + array(7) { ["process_id"]=> float(%f) ["cc"]=> @@ -134,6 +138,10 @@ array(2) { float(1) ["php.compilation.total_time_ms"]=> float(%f) + ["php.memory.peak_usage_bytes"]=> + float(%f) + ["php.memory.peak_real_usage_bytes"]=> + float(%f) } } } diff --git a/tests/ext/start_span_without_closing.phpt b/tests/ext/start_span_without_closing.phpt index a3af7e2bab..9eaa55a6bf 100644 --- a/tests/ext/start_span_without_closing.phpt +++ b/tests/ext/start_span_without_closing.phpt @@ -54,7 +54,7 @@ array(1) { string(16) "%s" } ["metrics"]=> - array(4) { + array(6) { ["process_id"]=> float(%f) ["_dd.agent_psr"]=> @@ -63,6 +63,10 @@ array(1) { float(1) ["php.compilation.total_time_ms"]=> float(%f) + ["php.memory.peak_usage_bytes"]=> + float(%f) + ["php.memory.peak_real_usage_bytes"]=> + float(%f) } } }