DataDog / datadog-agent

Main repository for Datadog Agent
https://docs.datadoghq.com/
Apache License 2.0
2.73k stars 1.17k forks source link

[SVLS-5001] Add tmp_used and tmp_max enhanced lambda metrics #27161

Open TalUsvyatsky opened 4 days ago

TalUsvyatsky commented 4 days ago

What does this PR do?

This PR introduces two new enhanced lambda metrics. Both of the metrics are emitted once per invocation and represent space used and space available in the /tmp directory.

The two new metrics are:

Motivation

Additional Notes

Possible Drawbacks / Trade-offs

Describe how to test/QA your changes

pr-commenter[bot] commented 4 days ago

Regression Detector

Regression Detector Results

Run ID: 8c900ff9-35dd-4f84-8e5b-d37d5a84e2a5 Metrics dashboard Target profiles

Baseline: f747174e7d4a547277a046aedb161cc1651a915e Comparison: 5582e4c1a7f1e4cb0f0b74397cc83cb2d957092e

Performance changes are noted in the perf column of each table:

No significant changes in experiment optimization goals

Confidence level: 90.00% Effect size tolerance: |Δ mean %| ≥ 5.00%

There were no significant changes in experiment optimization goals at this confidence level and effect size tolerance.

Fine details of change detection per experiment

| perf | experiment | goal | Δ mean % | Δ mean % CI | links | |------|----------------------------|--------------------|----------|------------------|----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------| | ➖ | file_tree | memory utilization | +1.95 | [+1.85, +2.04] | [Logs](https://app.datadoghq.com/logs?query=experiment%3Afile_tree%20run_id%3A8c900ff9-35dd-4f84-8e5b-d37d5a84e2a5&agg_m=count&agg_m_source=base&agg_q=%40span.url&agg_q_source=base&agg_t=count&fromUser=true&index=single-machine-performance-target-logs&messageDisplay=inline&refresh_mode=paused&storage=hot&stream_sort=time%2Cdesc&top_n=100&top_o=top&viz=stream&x_missing=true&from_ts=1719945808000&to_ts=1719957208000&live=false) | | ➖ | otel_to_otel_logs | ingress throughput | +0.65 | [-0.16, +1.47] | [Logs](https://app.datadoghq.com/logs?query=experiment%3Aotel_to_otel_logs%20run_id%3A8c900ff9-35dd-4f84-8e5b-d37d5a84e2a5&agg_m=count&agg_m_source=base&agg_q=%40span.url&agg_q_source=base&agg_t=count&fromUser=true&index=single-machine-performance-target-logs&messageDisplay=inline&refresh_mode=paused&storage=hot&stream_sort=time%2Cdesc&top_n=100&top_o=top&viz=stream&x_missing=true&from_ts=1719945808000&to_ts=1719957208000&live=false) | | ➖ | uds_dogstatsd_to_api_cpu | % cpu utilization | +0.55 | [-0.34, +1.44] | [Logs](https://app.datadoghq.com/logs?query=experiment%3Auds_dogstatsd_to_api_cpu%20run_id%3A8c900ff9-35dd-4f84-8e5b-d37d5a84e2a5&agg_m=count&agg_m_source=base&agg_q=%40span.url&agg_q_source=base&agg_t=count&fromUser=true&index=single-machine-performance-target-logs&messageDisplay=inline&refresh_mode=paused&storage=hot&stream_sort=time%2Cdesc&top_n=100&top_o=top&viz=stream&x_missing=true&from_ts=1719945808000&to_ts=1719957208000&live=false) | | ➖ | basic_py_check | % cpu utilization | +0.47 | [-2.15, +3.09] | [Logs](https://app.datadoghq.com/logs?query=experiment%3Abasic_py_check%20run_id%3A8c900ff9-35dd-4f84-8e5b-d37d5a84e2a5&agg_m=count&agg_m_source=base&agg_q=%40span.url&agg_q_source=base&agg_t=count&fromUser=true&index=single-machine-performance-target-logs&messageDisplay=inline&refresh_mode=paused&storage=hot&stream_sort=time%2Cdesc&top_n=100&top_o=top&viz=stream&x_missing=true&from_ts=1719945808000&to_ts=1719957208000&live=false) | | ➖ | idle | memory utilization | +0.38 | [+0.34, +0.42] | [Logs](https://app.datadoghq.com/logs?query=experiment%3Aidle%20run_id%3A8c900ff9-35dd-4f84-8e5b-d37d5a84e2a5&agg_m=count&agg_m_source=base&agg_q=%40span.url&agg_q_source=base&agg_t=count&fromUser=true&index=single-machine-performance-target-logs&messageDisplay=inline&refresh_mode=paused&storage=hot&stream_sort=time%2Cdesc&top_n=100&top_o=top&viz=stream&x_missing=true&from_ts=1719945808000&to_ts=1719957208000&live=false) | | ➖ | uds_dogstatsd_to_api | ingress throughput | -0.00 | [-0.00, +0.00] | [Logs](https://app.datadoghq.com/logs?query=experiment%3Auds_dogstatsd_to_api%20run_id%3A8c900ff9-35dd-4f84-8e5b-d37d5a84e2a5&agg_m=count&agg_m_source=base&agg_q=%40span.url&agg_q_source=base&agg_t=count&fromUser=true&index=single-machine-performance-target-logs&messageDisplay=inline&refresh_mode=paused&storage=hot&stream_sort=time%2Cdesc&top_n=100&top_o=top&viz=stream&x_missing=true&from_ts=1719945808000&to_ts=1719957208000&live=false) | | ➖ | tcp_dd_logs_filter_exclude | ingress throughput | -0.00 | [-0.01, +0.01] | [Logs](https://app.datadoghq.com/logs?query=experiment%3Atcp_dd_logs_filter_exclude%20run_id%3A8c900ff9-35dd-4f84-8e5b-d37d5a84e2a5&agg_m=count&agg_m_source=base&agg_q=%40span.url&agg_q_source=base&agg_t=count&fromUser=true&index=single-machine-performance-target-logs&messageDisplay=inline&refresh_mode=paused&storage=hot&stream_sort=time%2Cdesc&top_n=100&top_o=top&viz=stream&x_missing=true&from_ts=1719945808000&to_ts=1719957208000&live=false) | | ➖ | tcp_syslog_to_blackhole | ingress throughput | -0.61 | [-13.71, +12.48] | [Logs](https://app.datadoghq.com/logs?query=experiment%3Atcp_syslog_to_blackhole%20run_id%3A8c900ff9-35dd-4f84-8e5b-d37d5a84e2a5&agg_m=count&agg_m_source=base&agg_q=%40span.url&agg_q_source=base&agg_t=count&fromUser=true&index=single-machine-performance-target-logs&messageDisplay=inline&refresh_mode=paused&storage=hot&stream_sort=time%2Cdesc&top_n=100&top_o=top&viz=stream&x_missing=true&from_ts=1719945808000&to_ts=1719957208000&live=false) | | ➖ | pycheck_1000_100byte_tags | % cpu utilization | -1.39 | [-6.18, +3.40] | [Logs](https://app.datadoghq.com/logs?query=experiment%3Apycheck_1000_100byte_tags%20run_id%3A8c900ff9-35dd-4f84-8e5b-d37d5a84e2a5&agg_m=count&agg_m_source=base&agg_q=%40span.url&agg_q_source=base&agg_t=count&fromUser=true&index=single-machine-performance-target-logs&messageDisplay=inline&refresh_mode=paused&storage=hot&stream_sort=time%2Cdesc&top_n=100&top_o=top&viz=stream&x_missing=true&from_ts=1719945808000&to_ts=1719957208000&live=false) |

Explanation

A regression test is an A/B test of target performance in a repeatable rig, where "performance" is measured as "comparison variant minus baseline variant" for an optimization goal (e.g., ingress throughput). Due to intrinsic variability in measuring that goal, we can only estimate its mean value for each experiment; we report uncertainty in that value as a 90.00% confidence interval denoted "Δ mean % CI". For each experiment, we decide whether a change in performance is a "regression" -- a change worth investigating further -- if all of the following criteria are true: 1. Its estimated |Δ mean %| ≥ 5.00%, indicating the change is big enough to merit a closer look. 2. Its 90.00% confidence interval "Δ mean % CI" does not contain zero, indicating that *if our statistical model is accurate*, there is at least a 90.00% chance there is a difference in performance between baseline and comparison variants. 3. Its configuration does not mark it "erratic".
pr-commenter[bot] commented 1 day ago

Test changes on VM

Use this command from test-infra-definitions to manually test this PR changes on a VM:

inv create-vm --pipeline-id=38194784 --os-family=ubuntu

Note: This applies to commit 5582e4c1

github-actions[bot] commented 18 hours ago

Serverless Benchmark Results

BenchmarkStartEndInvocation comparison between f747174e7d4a547277a046aedb161cc1651a915e and b07e3954aef7b87cfaecab77b4df9ab7aed8f301.

tl;dr Use these benchmarks as an insight tool during development. 1. Skim down the `vs base` column in each chart. If there is a `~`, then there was no statistically significant change to the benchmark. Otherwise, ensure the estimated percent change is either negative or very small. 2. The last row of each chart is the `geomean`. Ensure this percentage is either negative or very small.
What is this benchmarking? The [`BenchmarkStartEndInvocation`](https://github.com/DataDog/datadog-agent/blob/main/pkg/serverless/daemon/routes_test.go) compares the amount of time it takes to call the `start-invocation` and `end-invocation` endpoints. For universal instrumentation languages (Dotnet, Golang, Java, Ruby), this represents the majority of the duration overhead added by our tracing layer. The benchmark is run using a large variety of lambda request payloads. In the charts below, there is one row for each event payload type.
How do I interpret these charts? The charts below comes from [`benchstat`](https://pkg.go.dev/golang.org/x/perf/cmd/benchstat). They represent the statistical change in _duration (sec/op)_, _memory overhead (B/op)_, and _allocations (allocs/op)_. The benchstat docs explain how to interpret these charts. > Before the comparison table, we see common file-level configuration. If there are benchmarks with different configuration (for example, from different packages), benchstat will print separate tables for each configuration. > > The table then compares the two input files for each benchmark. It shows the median and 95% confidence interval summaries for each benchmark before and after the change, and an A/B comparison under "vs base". ... The p-value measures how likely it is that any differences were due to random chance (i.e., noise). The "~" means benchstat did not detect a statistically significant difference between the two inputs. ... > > Note that "statistically significant" is not the same as "large": with enough low-noise data, even very small changes can be distinguished from noise and considered statistically significant. It is, of course, generally easier to distinguish large changes from noise. > > Finally, the last row of the table shows the geometric mean of each column, giving an overall picture of how the benchmarks changed. Proportional changes in the geomean reflect proportional changes in the benchmarks. For example, given n benchmarks, if sec/op for one of them increases by a factor of 2, then the sec/op geomean will increase by a factor of ⁿ√2.
I need more help First off, do not worry if the benchmarks are failing. They are not tests. The intention is for them to be a tool for you to use during development. If you would like a hand interpreting the results come chat with us in `#serverless-agent` in the internal DataDog slack or in `#serverless` in the [public DataDog slack](https://chat.datadoghq.com/). We're happy to help!
Benchmark stats ``` goos: linux goarch: amd64 pkg: github.com/DataDog/datadog-agent/pkg/serverless/daemon cpu: AMD EPYC 7763 64-Core Processor │ baseline/benchmark.log │ current/benchmark.log │ │ sec/op │ sec/op vs base │ api-gateway-appsec.json 85.25µ ± 3% 83.08µ ± 4% -2.55% (p=0.019 n=10) api-gateway-kong-appsec.json 66.71µ ± 1% 65.31µ ± 7% -2.09% (p=0.023 n=10) api-gateway-kong.json 65.13µ ± 2% 63.59µ ± 2% -2.37% (p=0.000 n=10) api-gateway-non-proxy-async.json 103.3µ ± 2% 101.9µ ± 2% ~ (p=0.105 n=10) api-gateway-non-proxy.json 104.1µ ± 1% 104.2µ ± 2% ~ (p=1.000 n=10) api-gateway-websocket-connect.json 69.33µ ± 2% 68.06µ ± 1% -1.83% (p=0.002 n=10) api-gateway-websocket-default.json 61.73µ ± 1% 61.87µ ± 1% ~ (p=0.481 n=10) api-gateway-websocket-disconnect.json 62.24µ ± 1% 62.94µ ± 1% +1.12% (p=0.011 n=10) api-gateway.json 115.4µ ± 1% 115.1µ ± 1% ~ (p=0.393 n=10) application-load-balancer.json 62.75µ ± 1% 61.93µ ± 2% ~ (p=0.165 n=10) cloudfront.json 47.25µ ± 2% 46.02µ ± 3% -2.59% (p=0.029 n=10) cloudwatch-events.json 37.95µ ± 1% 37.00µ ± 1% -2.52% (p=0.000 n=10) cloudwatch-logs.json 66.16µ ± 2% 64.01µ ± 1% -3.24% (p=0.000 n=10) custom.json 30.47µ ± 2% 29.91µ ± 2% -1.85% (p=0.000 n=10) dynamodb.json 93.50µ ± 2% 91.83µ ± 1% -1.78% (p=0.007 n=10) empty.json 29.07µ ± 2% 28.71µ ± 2% -1.22% (p=0.046 n=10) eventbridge-custom.json 41.57µ ± 2% 41.19µ ± 2% -0.91% (p=0.023 n=10) http-api.json 71.86µ ± 1% 72.03µ ± 1% ~ (p=1.000 n=10) kinesis-batch.json 70.06µ ± 1% 70.33µ ± 2% ~ (p=0.796 n=10) kinesis.json 53.63µ ± 1% 53.06µ ± 2% ~ (p=0.143 n=10) s3.json 60.01µ ± 3% 59.00µ ± 2% ~ (p=0.218 n=10) sns-batch.json 88.85µ ± 1% 88.20µ ± 1% ~ (p=0.190 n=10) sns.json 64.21µ ± 1% 63.95µ ± 2% ~ (p=0.481 n=10) snssqs.json 111.1µ ± 1% 111.7µ ± 1% ~ (p=0.165 n=10) snssqs_no_dd_context.json 97.04µ ± 1% 99.05µ ± 2% +2.07% (p=0.035 n=10) sqs-aws-header.json 55.09µ ± 1% 54.92µ ± 2% ~ (p=0.529 n=10) sqs-batch.json 94.09µ ± 2% 93.96µ ± 1% ~ (p=0.853 n=10) sqs.json 69.83µ ± 3% 70.00µ ± 3% ~ (p=0.579 n=10) sqs_no_dd_context.json 63.27µ ± 3% 63.56µ ± 2% ~ (p=0.529 n=10) geomean 66.46µ 65.89µ -0.86% │ baseline/benchmark.log │ current/benchmark.log │ │ B/op │ B/op vs base │ api-gateway-appsec.json 37.26Ki ± 0% 37.25Ki ± 0% ~ (p=0.541 n=10) api-gateway-kong-appsec.json 26.92Ki ± 0% 26.92Ki ± 0% ~ (p=0.566 n=10) api-gateway-kong.json 24.42Ki ± 0% 24.41Ki ± 0% ~ (p=0.195 n=10) api-gateway-non-proxy-async.json 48.01Ki ± 0% 48.01Ki ± 0% ~ (p=0.314 n=10) api-gateway-non-proxy.json 47.23Ki ± 0% 47.23Ki ± 0% ~ (p=0.897 n=10) api-gateway-websocket-connect.json 25.45Ki ± 0% 25.45Ki ± 0% ~ (p=0.361 n=10) api-gateway-websocket-default.json 21.35Ki ± 0% 21.35Ki ± 0% ~ (p=0.323 n=10) api-gateway-websocket-disconnect.json 21.14Ki ± 0% 21.14Ki ± 0% ~ (p=0.362 n=10) api-gateway.json 49.54Ki ± 0% 49.54Ki ± 0% ~ (p=0.197 n=10) application-load-balancer.json 22.32Ki ± 0% 22.31Ki ± 0% ~ (p=0.382 n=10) cloudfront.json 17.65Ki ± 0% 17.64Ki ± 0% ~ (p=0.138 n=10) cloudwatch-events.json 11.68Ki ± 0% 11.67Ki ± 0% ~ (p=0.084 n=10) cloudwatch-logs.json 53.37Ki ± 0% 53.36Ki ± 0% ~ (p=0.224 n=10) custom.json 9.715Ki ± 0% 9.712Ki ± 0% ~ (p=0.446 n=10) dynamodb.json 40.68Ki ± 0% 40.65Ki ± 0% ~ (p=0.075 n=10) empty.json 9.284Ki ± 0% 9.255Ki ± 1% ~ (p=0.137 n=10) eventbridge-custom.json 13.41Ki ± 0% 13.40Ki ± 0% ~ (p=0.247 n=10) http-api.json 23.72Ki ± 0% 23.70Ki ± 0% ~ (p=0.288 n=10) kinesis-batch.json 27.00Ki ± 0% 27.02Ki ± 0% ~ (p=0.271 n=10) kinesis.json 17.79Ki ± 0% 17.77Ki ± 0% ~ (p=0.382 n=10) s3.json 20.32Ki ± 0% 20.33Ki ± 0% ~ (p=0.579 n=10) sns-batch.json 38.61Ki ± 0% 38.63Ki ± 0% ~ (p=0.363 n=10) sns.json 24.00Ki ± 0% 23.98Ki ± 0% ~ (p=0.481 n=10) snssqs.json 50.74Ki ± 0% 50.73Ki ± 0% ~ (p=0.579 n=10) snssqs_no_dd_context.json 44.79Ki ± 0% 44.81Ki ± 0% ~ (p=0.542 n=10) sqs-aws-header.json 18.84Ki ± 0% 18.82Ki ± 0% ~ (p=0.353 n=10) sqs-batch.json 41.61Ki ± 0% 41.61Ki ± 0% ~ (p=0.971 n=10) sqs.json 25.59Ki ± 1% 25.59Ki ± 1% ~ (p=0.971 n=10) sqs_no_dd_context.json 20.69Ki ± 1% 20.69Ki ± 0% ~ (p=0.928 n=10) geomean 25.70Ki 25.69Ki -0.03% │ baseline/benchmark.log │ current/benchmark.log │ │ allocs/op │ allocs/op vs base │ api-gateway-appsec.json 629.5 ± 0% 629.0 ± 0% ~ (p=1.000 n=10) api-gateway-kong-appsec.json 488.0 ± 0% 488.0 ± 0% ~ (p=1.000 n=10) api-gateway-kong.json 466.0 ± 0% 466.0 ± 0% ~ (p=1.000 n=10) ¹ api-gateway-non-proxy-async.json 726.0 ± 0% 726.0 ± 0% ~ (p=1.000 n=10) api-gateway-non-proxy.json 716.0 ± 0% 716.0 ± 0% ~ (p=1.000 n=10) ¹ api-gateway-websocket-connect.json 453.0 ± 0% 453.0 ± 0% ~ (p=1.000 n=10) ¹ api-gateway-websocket-default.json 379.0 ± 0% 379.0 ± 0% ~ (p=1.000 n=10) ¹ api-gateway-websocket-disconnect.json 370.0 ± 0% 370.0 ± 0% ~ (p=1.000 n=10) api-gateway.json 791.0 ± 0% 791.0 ± 0% ~ (p=0.087 n=10) application-load-balancer.json 352.0 ± 0% 352.0 ± 0% ~ (p=1.000 n=10) ¹ cloudfront.json 284.0 ± 0% 284.0 ± 0% ~ (p=0.087 n=10) cloudwatch-events.json 220.0 ± 0% 220.0 ± 0% ~ (p=1.000 n=10) ¹ cloudwatch-logs.json 215.0 ± 0% 215.0 ± 0% ~ (p=1.000 n=10) custom.json 168.0 ± 0% 168.0 ± 0% ~ (p=1.000 n=10) dynamodb.json 589.0 ± 0% 588.5 ± 0% ~ (p=0.084 n=10) empty.json 160.0 ± 1% 159.0 ± 1% ~ (p=0.179 n=10) eventbridge-custom.json 254.0 ± 0% 254.0 ± 0% ~ (p=0.628 n=10) http-api.json 433.0 ± 0% 432.0 ± 0% ~ (p=0.370 n=10) kinesis-batch.json 390.0 ± 0% 391.0 ± 0% ~ (p=0.370 n=10) kinesis.json 285.0 ± 0% 285.0 ± 0% ~ (p=0.628 n=10) s3.json 358.0 ± 0% 358.0 ± 0% ~ (p=1.000 n=10) sns-batch.json 454.5 ± 0% 455.0 ± 0% ~ (p=0.714 n=10) sns.json 323.0 ± 0% 323.0 ± 0% ~ (p=1.000 n=10) snssqs.json 450.0 ± 0% 450.0 ± 0% ~ (p=0.684 n=10) snssqs_no_dd_context.json 399.0 ± 0% 399.5 ± 0% ~ (p=0.719 n=10) sqs-aws-header.json 274.0 ± 0% 274.0 ± 0% ~ (p=0.487 n=10) sqs-batch.json 503.0 ± 0% 503.0 ± 0% ~ (p=0.650 n=10) sqs.json 351.5 ± 1% 351.5 ± 1% ~ (p=0.771 n=10) sqs_no_dd_context.json 325.0 ± 1% 325.0 ± 1% ~ (p=0.874 n=10) geomean 376.8 376.7 -0.02% ¹ all samples are equal ```