datadog-agent icon indicating copy to clipboard operation
datadog-agent copied to clipboard

Remove pkg/util/containers/metrics dependency from serverless build

Open pgimalac opened this issue 1 year ago • 2 comments

What does this PR do?

Remove pkg/util/containers/metrics packages from the serverless build.

Motivation

Remove unused dependencies from serverless agent, in order to reduce init time duration and reduce binary size.

Additional Notes

There should be no functional change.

Possible Drawbacks / Trade-offs

Describe how to test/QA your changes

pgimalac avatar Feb 26 '24 10:02 pgimalac

Go Package Import Differences

Baseline: a939f454e4893fab18fe2397eb52c3f1271cbff8 Comparison: 88137416669f128abb16e3d504fff02b16759b41

binaryosarchchange
serverlesslinuxamd64
+0, -7
-github.com/DataDog/datadog-agent/pkg/util/containers/metrics
-github.com/DataDog/datadog-agent/pkg/util/containers/metrics/containerd
-github.com/DataDog/datadog-agent/pkg/util/containers/metrics/cri
-github.com/DataDog/datadog-agent/pkg/util/containers/metrics/docker
-github.com/DataDog/datadog-agent/pkg/util/containers/metrics/ecsfargate
-github.com/DataDog/datadog-agent/pkg/util/containers/metrics/kubelet
-github.com/DataDog/datadog-agent/pkg/util/containers/metrics/system
serverlesslinuxarm64
+0, -7
-github.com/DataDog/datadog-agent/pkg/util/containers/metrics
-github.com/DataDog/datadog-agent/pkg/util/containers/metrics/containerd
-github.com/DataDog/datadog-agent/pkg/util/containers/metrics/cri
-github.com/DataDog/datadog-agent/pkg/util/containers/metrics/docker
-github.com/DataDog/datadog-agent/pkg/util/containers/metrics/ecsfargate
-github.com/DataDog/datadog-agent/pkg/util/containers/metrics/kubelet
-github.com/DataDog/datadog-agent/pkg/util/containers/metrics/system

cit-pr-commenter[bot] avatar Feb 26 '24 10:02 cit-pr-commenter[bot]

Bloop Bleep... Dogbot Here

Regression Detector Results

Run ID: 724549c5-23aa-43bc-95d0-42e5c41d91f7 Baseline: 08ffe66297a50132d1d00738b8bb241444ca00de Comparison: b1ee8d5773407d2d1f390e111b3d244ef6fa5be8 Total CPUs: 7

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

  • ✅ = significantly better comparison variant performance
  • ❌ = significantly worse comparison variant performance
  • ➖ = no significant change in performance

Experiments with missing or malformed data

  • basic_py_check

Usually, this warning means that there is no usable optimization goal data for that experiment, which could be a result of misconfiguration.

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.

Experiments ignored for regressions

Regressions in experiments with settings containing erratic: true are ignored.

perf experiment goal Δ mean % Δ mean % CI
file_to_blackhole % cpu utilization +1.28 [-5.36, +7.91]

Fine details of change detection per experiment

perf experiment goal Δ mean % Δ mean % CI
file_to_blackhole % cpu utilization +1.28 [-5.36, +7.91]
uds_dogstatsd_to_api_cpu % cpu utilization +0.73 [-0.71, +2.16]
process_agent_standard_check memory utilization +0.12 [+0.06, +0.17]
process_agent_standard_check_with_stats memory utilization +0.09 [+0.05, +0.14]
idle memory utilization +0.04 [-0.02, +0.09]
trace_agent_msgpack ingress throughput +0.02 [+0.01, +0.03]
tcp_dd_logs_filter_exclude ingress throughput +0.00 [-0.00, +0.00]
uds_dogstatsd_to_api ingress throughput +0.00 [-0.00, +0.00]
trace_agent_json ingress throughput -0.01 [-0.04, +0.01]
otel_to_otel_logs ingress throughput -0.05 [-0.69, +0.59]
tcp_syslog_to_blackhole ingress throughput -0.19 [-0.25, -0.14]
file_tree memory utilization -0.30 [-0.40, -0.21]
process_agent_real_time_mode memory utilization -0.52 [-0.57, -0.47]

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] avatar Feb 27 '24 19:02 pr-commenter[bot]

Serverless Benchmark Results

BenchmarkStartEndInvocation comparison between a939f454e4893fab18fe2397eb52c3f1271cbff8 and 2856c8694c13833e27da59fd90fdaacaa9de46ae.

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 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. 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. 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                            83.41µ ± 3%    88.56µ ± 4%  +6.17% (p=0.000 n=10)
api-gateway-kong-appsec.json                       65.03µ ± 2%    67.21µ ± 1%  +3.36% (p=0.002 n=10)
api-gateway-kong.json                              62.82µ ± 2%    65.06µ ± 1%  +3.57% (p=0.000 n=10)
api-gateway-non-proxy-async.json                   100.8µ ± 1%    104.8µ ± 2%  +4.02% (p=0.000 n=10)
api-gateway-non-proxy.json                         100.2µ ± 1%    104.7µ ± 1%  +4.55% (p=0.000 n=10)
api-gateway-websocket-connect.json                 66.69µ ± 1%    69.54µ ± 1%  +4.28% (p=0.000 n=10)
api-gateway-websocket-default.json                 59.39µ ± 1%    62.32µ ± 1%  +4.94% (p=0.000 n=10)
api-gateway-websocket-disconnect.json              59.37µ ± 3%    62.39µ ± 2%  +5.09% (p=0.000 n=10)
api-gateway.json                                   110.7µ ± 1%    115.2µ ± 2%  +4.01% (p=0.000 n=10)
application-load-balancer.json                     60.24µ ± 1%    62.99µ ± 2%  +4.56% (p=0.000 n=10)
cloudfront.json                                    45.74µ ± 3%    47.54µ ± 1%  +3.94% (p=0.001 n=10)
cloudwatch-events.json                             37.36µ ± 4%    38.10µ ± 2%       ~ (p=0.218 n=10)
cloudwatch-logs.json                               65.12µ ± 2%    65.68µ ± 1%       ~ (p=0.105 n=10)
custom.json                                        29.45µ ± 2%    29.86µ ± 1%       ~ (p=0.165 n=10)
dynamodb.json                                      91.94µ ± 1%    95.23µ ± 1%  +3.58% (p=0.000 n=10)
empty.json                                         27.74µ ± 2%    28.89µ ± 2%  +4.14% (p=0.001 n=10)
eventbridge-custom.json                            40.59µ ± 2%    41.69µ ± 1%  +2.71% (p=0.000 n=10)
http-api.json                                      71.88µ ± 1%    74.51µ ± 2%  +3.66% (p=0.000 n=10)
kinesis-batch.json                                 70.07µ ± 1%    72.64µ ± 2%  +3.68% (p=0.000 n=10)
kinesis.json                                       52.81µ ± 2%    53.81µ ± 2%       ~ (p=0.052 n=10)
s3.json                                            57.80µ ± 1%    59.73µ ± 2%  +3.35% (p=0.000 n=10)
sns-batch.json                                     87.96µ ± 1%    92.62µ ± 2%  +5.29% (p=0.000 n=10)
sns.json                                           62.99µ ± 1%    64.89µ ± 2%  +3.01% (p=0.000 n=10)
snssqs.json                                        109.5µ ± 2%    114.2µ ± 1%  +4.26% (p=0.000 n=10)
snssqs_no_dd_context.json                          97.85µ ± 2%   100.82µ ± 1%  +3.04% (p=0.000 n=10)
sqs-aws-header.json                                54.37µ ± 1%    55.17µ ± 2%       ~ (p=0.105 n=10)
sqs-batch.json                                     92.48µ ± 1%    97.08µ ± 2%  +4.98% (p=0.000 n=10)
sqs.json                                           67.03µ ± 2%    69.48µ ± 2%  +3.65% (p=0.000 n=10)
sqs_no_dd_context.json                             60.79µ ± 3%    61.10µ ± 2%       ~ (p=0.796 n=10)
geomean                                            64.79µ         67.07µ       +3.51%

                                      │ baseline/benchmark.log │        current/benchmark.log        │
                                      │          B/op          │     B/op      vs base               │
api-gateway-appsec.json                           37.19Ki ± 0%   37.20Ki ± 0%       ~ (p=0.446 n=10)
api-gateway-kong-appsec.json                      26.79Ki ± 0%   26.80Ki ± 0%       ~ (p=0.287 n=10)
api-gateway-kong.json                             24.28Ki ± 0%   24.29Ki ± 0%       ~ (p=0.446 n=10)
api-gateway-non-proxy-async.json                  47.99Ki ± 0%   48.00Ki ± 0%       ~ (p=0.101 n=10)
api-gateway-non-proxy.json                        47.19Ki ± 0%   47.20Ki ± 0%       ~ (p=0.469 n=10)
api-gateway-websocket-connect.json                25.40Ki ± 0%   25.40Ki ± 0%       ~ (p=0.254 n=10)
api-gateway-websocket-default.json                21.29Ki ± 0%   21.30Ki ± 0%       ~ (p=0.255 n=10)
api-gateway-websocket-disconnect.json             21.08Ki ± 0%   21.09Ki ± 0%  +0.04% (p=0.024 n=10)
api-gateway.json                                  49.44Ki ± 0%   49.46Ki ± 0%       ~ (p=0.224 n=10)
application-load-balancer.json                    23.16Ki ± 0%   23.17Ki ± 0%  +0.03% (p=0.012 n=10)
cloudfront.json                                   17.56Ki ± 0%   17.58Ki ± 0%  +0.09% (p=0.005 n=10)
cloudwatch-events.json                            11.65Ki ± 0%   11.65Ki ± 0%       ~ (p=0.643 n=10)
cloudwatch-logs.json                              53.28Ki ± 0%   53.27Ki ± 0%       ~ (p=0.898 n=10)
custom.json                                       9.653Ki ± 0%   9.675Ki ± 0%       ~ (p=0.055 n=10)
dynamodb.json                                     40.61Ki ± 0%   40.61Ki ± 0%       ~ (p=1.000 n=10)
empty.json                                        9.208Ki ± 0%   9.215Ki ± 0%       ~ (p=0.271 n=10)
eventbridge-custom.json                           13.34Ki ± 0%   13.38Ki ± 0%  +0.29% (p=0.003 n=10)
http-api.json                                     23.69Ki ± 0%   23.70Ki ± 0%       ~ (p=0.325 n=10)
kinesis-batch.json                                26.95Ki ± 0%   26.96Ki ± 0%       ~ (p=0.254 n=10)
kinesis.json                                      17.73Ki ± 0%   17.77Ki ± 0%  +0.17% (p=0.006 n=10)
s3.json                                           20.26Ki ± 0%   20.30Ki ± 0%       ~ (p=0.218 n=10)
sns-batch.json                                    38.53Ki ± 0%   38.58Ki ± 0%  +0.13% (p=0.001 n=10)
sns.json                                          23.89Ki ± 0%   23.89Ki ± 0%       ~ (p=0.436 n=10)
snssqs.json                                       50.56Ki ± 0%   50.62Ki ± 0%       ~ (p=0.105 n=10)
snssqs_no_dd_context.json                         44.76Ki ± 0%   44.79Ki ± 0%       ~ (p=0.123 n=10)
sqs-aws-header.json                               18.78Ki ± 0%   18.80Ki ± 0%       ~ (p=0.838 n=10)
sqs-batch.json                                    41.53Ki ± 0%   41.62Ki ± 0%  +0.21% (p=0.043 n=10)
sqs.json                                          25.43Ki ± 0%   25.50Ki ± 0%  +0.31% (p=0.019 n=10)
sqs_no_dd_context.json                            20.64Ki ± 1%   20.64Ki ± 1%       ~ (p=0.382 n=10)
geomean                                           25.66Ki        25.68Ki       +0.08%

                                      │ baseline/benchmark.log │        current/benchmark.log        │
                                      │       allocs/op        │ allocs/op   vs base                 │
api-gateway-appsec.json                             629.5 ± 0%   629.5 ± 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                    725.0 ± 0%   725.0 ± 0%       ~ (p=1.000 n=10)
api-gateway-non-proxy.json                          715.5 ± 0%   716.0 ± 0%       ~ (p=0.650 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               369.0 ± 0%   369.0 ± 0%       ~ (p=1.000 n=10)
api-gateway.json                                    790.0 ± 0%   790.0 ± 0%       ~ (p=1.000 n=10)
application-load-balancer.json                      352.0 ± 0%   352.0 ± 0%       ~ (p=0.474 n=10)
cloudfront.json                                     283.0 ± 0%   283.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                                       588.5 ± 0%   588.5 ± 0%       ~ (p=1.000 n=10)
empty.json                                          159.0 ± 0%   159.0 ± 1%       ~ (p=0.303 n=10)
eventbridge-custom.json                             253.0 ± 0%   254.0 ± 0%  +0.40% (p=0.035 n=10)
http-api.json                                       432.0 ± 0%   432.0 ± 0%       ~ (p=0.768 n=10)
kinesis-batch.json                                  390.0 ± 0%   390.0 ± 0%       ~ (p=0.628 n=10)
kinesis.json                                        284.5 ± 0%   285.0 ± 0%  +0.18% (p=0.033 n=10)
s3.json                                             357.0 ± 0%   358.0 ± 0%       ~ (p=0.561 n=10)
sns-batch.json                                      454.0 ± 0%   455.0 ± 0%  +0.22% (p=0.003 n=10)
sns.json                                            322.5 ± 0%   323.0 ± 0%       ~ (p=0.618 n=10)
snssqs.json                                         445.0 ± 0%   446.0 ± 0%       ~ (p=0.053 n=10)
snssqs_no_dd_context.json                           399.0 ± 0%   399.0 ± 0%       ~ (p=0.406 n=10)
sqs-aws-header.json                                 273.0 ± 0%   274.0 ± 0%       ~ (p=0.465 n=10)
sqs-batch.json                                      503.0 ± 0%   504.0 ± 0%       ~ (p=0.098 n=10)
sqs.json                                            350.0 ± 0%   351.0 ± 0%  +0.29% (p=0.040 n=10)
sqs_no_dd_context.json                              324.5 ± 1%   324.5 ± 1%       ~ (p=0.463 n=10)
geomean                                             376.1        376.4       +0.08%
¹ all samples are equal

github-actions[bot] avatar May 02 '24 12:05 github-actions[bot]

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=33427319 --os-family=ubuntu

pr-commenter[bot] avatar May 02 '24 13:05 pr-commenter[bot]

Regression Detector

Regression Detector Results

Run ID: d7281e52-50a5-4597-9b2f-04a110afcb6a Baseline: a939f454e4893fab18fe2397eb52c3f1271cbff8 Comparison: 88137416669f128abb16e3d504fff02b16759b41

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

  • ✅ = significantly better comparison variant performance
  • ❌ = significantly worse comparison variant performance
  • ➖ = no significant change in performance

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.

Experiments ignored for regressions

Regressions in experiments with settings containing erratic: true are ignored.

perf experiment goal Δ mean % Δ mean % CI
file_to_blackhole % cpu utilization -34.86 [-40.32, -29.39]

Fine details of change detection per experiment

perf experiment goal Δ mean % Δ mean % CI
tcp_syslog_to_blackhole ingress throughput +4.01 [-18.08, +26.09]
basic_py_check % cpu utilization +1.69 [-0.83, +4.21]
pycheck_1000_100byte_tags % cpu utilization +1.21 [-3.66, +6.08]
process_agent_real_time_mode memory utilization +0.29 [+0.23, +0.34]
process_agent_standard_check memory utilization +0.20 [+0.14, +0.25]
otel_to_otel_logs ingress throughput +0.03 [-0.33, +0.38]
uds_dogstatsd_to_api ingress throughput +0.00 [-0.20, +0.20]
trace_agent_json ingress throughput -0.00 [-0.01, +0.01]
trace_agent_msgpack ingress throughput -0.00 [-0.01, +0.00]
tcp_dd_logs_filter_exclude ingress throughput -0.04 [-0.08, +0.00]
process_agent_standard_check_with_stats memory utilization -0.13 [-0.19, -0.07]
idle memory utilization -0.35 [-0.39, -0.31]
file_tree memory utilization -0.81 [-0.91, -0.71]
uds_dogstatsd_to_api_cpu % cpu utilization -1.13 [-3.99, +1.73]
file_to_blackhole % cpu utilization -34.86 [-40.32, -29.39]

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] avatar May 02 '24 13:05 pr-commenter[bot]

/merge

pgimalac avatar May 06 '24 08:05 pgimalac

:steam_locomotive: MergeQueue

Pull request added to the queue.

There are 6 builds ahead! (estimated merge in less than 3h)

Use /merge -c to cancel this operation!

dd-devflow[bot] avatar May 06 '24 08:05 dd-devflow[bot]