Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

test all services clean exit #31331

Closed
wants to merge 19 commits into from

Conversation

jack0x2
Copy link
Contributor

@jack0x2 jack0x2 commented Nov 21, 2024

What does this PR do?

Adds tests to test what happens when you manually start services that are configured to be disabled. Updates security-agent to output an informational event on clean exit on start.

Motivation

https://datadoghq.atlassian.net/browse/WINA-1192
Remove unnecessary errors from event logs and better tests on service behaviors.

Describe how to test/QA your changes

Adds tests to service-tests to test everything

Possible Drawbacks / Trade-offs

Additional Notes

@jack0x2 jack0x2 added the qa/done QA done before merge and regressions are covered by tests label Nov 21, 2024
@github-actions github-actions bot added the medium review PR review might take time label Nov 21, 2024
@jack0x2 jack0x2 closed this Nov 21, 2024
@github-actions github-actions bot added component/system-probe long review PR is complex, plan time to review it and removed medium review PR review might take time labels Nov 21, 2024
@jack0x2 jack0x2 deleted the jack.phillips/cleanexit-test-all-services branch November 21, 2024 16:51
Copy link
Contributor

⚠️🚨 Warning, this pull request increases the binary size of serverless extension by 387680 bytes. Each MB of binary size increase means about 10ms of additional cold start time, so this pull request would increase cold start time by 3ms.

Debug info

If you have questions, we are happy to help, come visit us in the #serverless slack channel and provide a link to this comment.

These dependencies were added to the serverless extension by this pull request:

golang.org/x/net/http2

View dependency graphs for each added dependency in the artifacts section of the github action.

We suggest you consider adding the !serverless build tag to remove any new dependencies not needed in the serverless extension.

Copy link
Contributor

Serverless Benchmark Results

BenchmarkStartEndInvocation comparison between 9dbee93 and ce13759.

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                            84.49µ ± 4%   84.38µ ± 3%       ~ (p=0.971 n=10)
api-gateway-kong-appsec.json                       65.91µ ± 2%   65.24µ ± 2%       ~ (p=0.089 n=10)
api-gateway-kong.json                              63.80µ ± 3%   62.63µ ± 2%  -1.83% (p=0.009 n=10)
api-gateway-non-proxy-async.json                   98.04µ ± 1%   98.78µ ± 1%  +0.76% (p=0.011 n=10)
api-gateway-non-proxy.json                         97.92µ ± 1%   97.61µ ± 1%       ~ (p=0.796 n=10)
api-gateway-websocket-connect.json                 63.97µ ± 1%   65.14µ ± 1%  +1.83% (p=0.004 n=10)
api-gateway-websocket-default.json                 57.60µ ± 2%   57.29µ ± 1%       ~ (p=0.631 n=10)
api-gateway-websocket-disconnect.json              58.05µ ± 2%   57.76µ ± 2%       ~ (p=0.529 n=10)
api-gateway.json                                   105.6µ ± 2%   109.6µ ± 2%  +3.82% (p=0.000 n=10)
application-load-balancer.json                     56.98µ ± 2%   57.91µ ± 1%  +1.63% (p=0.015 n=10)
cloudfront.json                                    43.27µ ± 6%   44.01µ ± 1%       ~ (p=0.393 n=10)
cloudwatch-events.json                             35.36µ ± 2%   36.59µ ± 3%  +3.46% (p=0.001 n=10)
cloudwatch-logs.json                               56.36µ ± 2%   59.27µ ± 4%  +5.17% (p=0.000 n=10)
custom.json                                        28.13µ ± 1%   30.06µ ± 4%  +6.85% (p=0.000 n=10)
dynamodb.json                                      86.02µ ± 2%   88.35µ ± 2%  +2.71% (p=0.000 n=10)
empty.json                                         27.17µ ± 2%   28.04µ ± 3%  +3.21% (p=0.000 n=10)
eventbridge-custom.json                            43.63µ ± 2%   44.85µ ± 1%  +2.79% (p=0.003 n=10)
eventbridge-no-bus.json                            43.65µ ± 3%   43.53µ ± 1%       ~ (p=0.853 n=10)
eventbridge-no-timestamp.json                      44.19µ ± 3%   43.83µ ± 1%       ~ (p=0.796 n=10)
eventbridgesns.json                                60.08µ ± 1%   60.08µ ± 1%       ~ (p=0.853 n=10)
eventbridgesqs.json                                67.39µ ± 1%   66.22µ ± 1%  -1.73% (p=0.007 n=10)
http-api.json                                      67.15µ ± 1%   66.03µ ± 1%  -1.67% (p=0.001 n=10)
kinesis-batch.json                                 67.17µ ± 2%   66.36µ ± 1%       ~ (p=0.165 n=10)
kinesis.json                                       51.85µ ± 1%   52.15µ ± 2%       ~ (p=0.393 n=10)
s3.json                                            56.13µ ± 1%   57.00µ ± 1%  +1.56% (p=0.003 n=10)
sns-batch.json                                     87.11µ ± 1%   87.16µ ± 1%       ~ (p=0.796 n=10)
sns.json                                           64.51µ ± 2%   64.77µ ± 1%       ~ (p=0.684 n=10)
snssqs.json                                        111.0µ ± 2%   110.3µ ± 1%       ~ (p=0.218 n=10)
snssqs_no_dd_context.json                         100.91µ ± 2%   98.01µ ± 1%  -2.88% (p=0.001 n=10)
sqs-aws-header.json                                56.25µ ± 1%   54.85µ ± 2%  -2.48% (p=0.002 n=10)
sqs-batch.json                                     89.67µ ± 2%   89.42µ ± 1%       ~ (p=0.280 n=10)
sqs.json                                           67.52µ ± 2%   66.95µ ± 1%       ~ (p=0.280 n=10)
sqs_no_dd_context.json                             63.19µ ± 1%   62.79µ ± 2%       ~ (p=0.579 n=10)
stepfunction.json                                  43.27µ ± 1%   44.05µ ± 4%       ~ (p=0.143 n=10)
geomean                                            61.47µ        61.83µ       +0.58%

                                      │ baseline/benchmark.log │        current/benchmark.log        │
                                      │          B/op          │     B/op      vs base               │
api-gateway-appsec.json                           37.26Ki ± 0%   37.26Ki ± 0%       ~ (p=0.753 n=10)
api-gateway-kong-appsec.json                      26.90Ki ± 0%   26.90Ki ± 0%       ~ (p=0.252 n=10)
api-gateway-kong.json                             24.37Ki ± 0%   24.36Ki ± 0%  -0.03% (p=0.007 n=10)
api-gateway-non-proxy-async.json                  47.93Ki ± 0%   47.94Ki ± 0%       ~ (p=0.158 n=10)
api-gateway-non-proxy.json                        47.11Ki ± 0%   47.11Ki ± 0%  -0.01% (p=0.019 n=10)
api-gateway-websocket-connect.json                25.34Ki ± 0%   25.33Ki ± 0%       ~ (p=0.179 n=10)
api-gateway-websocket-default.json                21.23Ki ± 0%   21.23Ki ± 0%       ~ (p=0.616 n=10)
api-gateway-websocket-disconnect.json             20.99Ki ± 0%   20.99Ki ± 0%  -0.01% (p=0.047 n=10)
api-gateway.json                                  49.26Ki ± 0%   49.26Ki ± 0%       ~ (p=0.751 n=10)
application-load-balancer.json                    22.12Ki ± 0%   22.12Ki ± 0%       ~ (p=0.305 n=10)
cloudfront.json                                   17.43Ki ± 0%   17.43Ki ± 0%       ~ (p=0.364 n=10)
cloudwatch-events.json                            11.49Ki ± 0%   11.49Ki ± 0%       ~ (p=0.707 n=10)
cloudwatch-logs.json                              53.05Ki ± 0%   53.04Ki ± 0%       ~ (p=0.143 n=10)
custom.json                                       9.527Ki ± 0%   9.528Ki ± 0%  +0.01% (p=0.020 n=10)
dynamodb.json                                     40.30Ki ± 0%   40.30Ki ± 0%       ~ (p=0.806 n=10)
empty.json                                        9.065Ki ± 0%   9.066Ki ± 0%  +0.01% (p=0.033 n=10)
eventbridge-custom.json                           14.67Ki ± 0%   14.67Ki ± 0%       ~ (p=0.338 n=10)
eventbridge-no-bus.json                           13.63Ki ± 0%   13.63Ki ± 0%       ~ (p=0.875 n=10)
eventbridge-no-timestamp.json                     13.63Ki ± 0%   13.63Ki ± 0%       ~ (p=0.485 n=10)
eventbridgesns.json                               20.43Ki ± 0%   20.43Ki ± 0%       ~ (p=0.444 n=10)
eventbridgesqs.json                               24.56Ki ± 0%   24.56Ki ± 0%       ~ (p=0.409 n=10)
http-api.json                                     23.25Ki ± 0%   23.25Ki ± 0%       ~ (p=0.897 n=10)
kinesis-batch.json                                26.49Ki ± 0%   26.49Ki ± 0%  +0.01% (p=0.015 n=10)
kinesis.json                                      17.37Ki ± 0%   17.38Ki ± 0%  +0.02% (p=0.015 n=10)
s3.json                                           19.87Ki ± 0%   19.87Ki ± 0%       ~ (p=0.344 n=10)
sns-batch.json                                    39.08Ki ± 0%   39.08Ki ± 0%       ~ (p=1.000 n=10)
sns.json                                          24.49Ki ± 0%   24.49Ki ± 0%       ~ (p=0.371 n=10)
snssqs.json                                       52.68Ki ± 0%   52.68Ki ± 0%       ~ (p=0.490 n=10)
snssqs_no_dd_context.json                         46.44Ki ± 0%   46.44Ki ± 0%       ~ (p=0.537 n=10)
sqs-aws-header.json                               18.78Ki ± 0%   18.78Ki ± 0%       ~ (p=0.927 n=10)
sqs-batch.json                                    41.26Ki ± 0%   41.26Ki ± 0%       ~ (p=0.353 n=10)
sqs.json                                          25.39Ki ± 0%   25.39Ki ± 0%       ~ (p=0.732 n=10)
sqs_no_dd_context.json                            21.01Ki ± 0%   21.01Ki ± 0%       ~ (p=0.911 n=10)
stepfunction.json                                 13.51Ki ± 0%   13.51Ki ± 0%       ~ (p=0.138 n=10)
geomean                                           24.08Ki        24.08Ki       +0.00%

                                      │ baseline/benchmark.log │        current/benchmark.log        │
                                      │       allocs/op        │ allocs/op   vs base                 │
api-gateway-appsec.json                             630.0 ± 0%   630.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                    723.0 ± 0%   723.0 ± 0%       ~ (p=1.000 n=10) ¹
api-gateway-non-proxy.json                          713.0 ± 0%   713.0 ± 0%       ~ (p=1.000 n=10) ¹
api-gateway-websocket-connect.json                  451.0 ± 0%   451.0 ± 0%       ~ (p=0.582 n=10)
api-gateway-websocket-default.json                  376.0 ± 0%   376.0 ± 0%       ~ (p=1.000 n=10) ¹
api-gateway-websocket-disconnect.json               366.0 ± 0%   366.0 ± 0%       ~ (p=1.000 n=10) ¹
api-gateway.json                                    785.0 ± 0%   785.0 ± 0%       ~ (p=1.000 n=10) ¹
application-load-balancer.json                      348.0 ± 0%   348.0 ± 0%       ~ (p=1.000 n=10) ¹
cloudfront.json                                     281.0 ± 0%   281.0 ± 0%       ~ (p=1.000 n=10) ¹
cloudwatch-events.json                              218.0 ± 0%   218.0 ± 0%       ~ (p=1.000 n=10) ¹
cloudwatch-logs.json                                211.0 ± 0%   211.0 ± 0%       ~ (p=1.000 n=10) ¹
custom.json                                         166.0 ± 0%   166.0 ± 0%       ~ (p=1.000 n=10) ¹
dynamodb.json                                       582.0 ± 0%   582.0 ± 0%       ~ (p=1.000 n=10) ¹
empty.json                                          157.0 ± 0%   157.0 ± 0%       ~ (p=1.000 n=10) ¹
eventbridge-custom.json                             261.0 ± 0%   261.0 ± 0%       ~ (p=1.000 n=10) ¹
eventbridge-no-bus.json                             252.0 ± 0%   252.0 ± 0%       ~ (p=1.000 n=10) ¹
eventbridge-no-timestamp.json                       252.0 ± 0%   252.0 ± 0%       ~ (p=1.000 n=10) ¹
eventbridgesns.json                                 318.0 ± 0%   318.0 ± 0%       ~ (p=1.000 n=10) ¹
eventbridgesqs.json                                 358.0 ± 0%   358.0 ± 0%       ~ (p=1.000 n=10) ¹
http-api.json                                       424.0 ± 0%   424.0 ± 0%       ~ (p=1.000 n=10) ¹
kinesis-batch.json                                  383.0 ± 0%   383.0 ± 0%       ~ (p=1.000 n=10) ¹
kinesis.json                                        279.0 ± 0%   279.0 ± 0%       ~ (p=1.000 n=10) ¹
s3.json                                             351.0 ± 0%   351.0 ± 0%       ~ (p=1.000 n=10) ¹
sns-batch.json                                      465.0 ± 0%   465.0 ± 0%       ~ (p=1.000 n=10) ¹
sns.json                                            336.0 ± 0%   336.0 ± 0%       ~ (p=1.000 n=10) ¹
snssqs.json                                         460.0 ± 0%   460.0 ± 0%       ~ (p=1.000 n=10) ¹
snssqs_no_dd_context.json                           420.0 ± 0%   420.0 ± 0%       ~ (p=1.000 n=10) ¹
sqs-aws-header.json                                 276.0 ± 0%   276.0 ± 0%       ~ (p=1.000 n=10) ¹
sqs-batch.json                                      500.0 ± 0%   500.0 ± 0%       ~ (p=1.000 n=10) ¹
sqs.json                                            351.0 ± 0%   351.0 ± 0%       ~ (p=1.000 n=10) ¹
sqs_no_dd_context.json                              337.0 ± 0%   337.0 ± 0%       ~ (p=1.000 n=10) ¹
stepfunction.json                                   226.0 ± 0%   226.0 ± 0%       ~ (p=1.000 n=10) ¹
geomean                                             360.0        360.0       +0.00%
¹ all samples are equal

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
component/system-probe long review PR is complex, plan time to review it qa/done QA done before merge and regressions are covered by tests
Projects
None yet
Development

Successfully merging this pull request may close these issues.