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

usm: Refactor monitors to use common uprobe attacher #28241

Draft
wants to merge 17 commits into
base: main
Choose a base branch
from

Conversation

gjulianm
Copy link
Contributor

@gjulianm gjulianm commented Aug 6, 2024

What does this PR do?

This PR applies the new uprobe attacher introduced in #27663 to the existing USM monitors, unifying features and behavior.

Motivation

Additional Notes

Possible Drawbacks / Trade-offs

Describe how to test/QA your changes

Several tests were performed in the load-test environment, using the manual QA checklist as a reference. The base version was the agent release 7.55. The commit under test for this branch was d87ae5175511826d94b6f623798ed8a1e33fcc3e, tests will be repeated before merge with the latest available commit of this branch.

soak_test - openssl

Dashboard

Accuracy base

Screenshot 2024-08-09 at 15 08 57

Accuracy of this branch

Screenshot 2024-08-09 at 15 09 23

soak_test - gotls

Dashboard

Accuracy base

Screenshot 2024-08-12 at 10 14 06

Accuracy of this branch

Screenshot 2024-08-12 at 10 14 19
soak_test - istio

Dashboard

Accuracy base

Screenshot 2024-08-12 at 11 32 07

Accuracy of this branch

Screenshot 2024-08-12 at 11 32 25
soak_test - nodejs

Dashboard

Accuracy base

Screenshot 2024-08-21 at 15 25 37

Accuracy of this branch

Screenshot 2024-08-21 at 15 25 44

Additionally, tests were performed with the process-load-test configuration to better test the performance impact of the changes, which should be more clear with a higher load of processes being created/stopped. The differences in CPU and memory usages were not significant. The profiling comparisons were also checked and the CPU usage was similar in the changed code. Details:

process-test - openssl

Dashboard and profiling comparison

Screenshot 2024-08-23 at 13 13 26

process-test - go-tls

Dashboard and profiling comparison

Screenshot 2024-08-23 at 13 34 33

process-test - nodejs

Dashboard and profiling comparison

Screenshot 2024-08-23 at 14 21 21

process-test - istio

Dashboard and profiling comparison

Screenshot 2024-08-23 at 14 40 35

Copy link

cit-pr-commenter bot commented Aug 6, 2024

Go Package Import Differences

Baseline: e7715df
Comparison: eba45f5

binaryosarchchange
system-probelinuxamd64
+4, -0
+github.com/DataDog/datadog-agent/pkg/ebpf/uprobes
+github.com/DataDog/datadog-agent/pkg/network/protocols/http/testutil
+github.com/lorenzosaino/go-sysctl
+golang.org/x/net/netutil
system-probelinuxarm64
+4, -0
+github.com/DataDog/datadog-agent/pkg/ebpf/uprobes
+github.com/DataDog/datadog-agent/pkg/network/protocols/http/testutil
+github.com/lorenzosaino/go-sysctl
+golang.org/x/net/netutil

@pr-commenter
Copy link

pr-commenter bot commented Aug 6, 2024

Regression Detector

Regression Detector Results

Run ID: 91280807-246a-4dfd-9217-e9347ac33071 Metrics dashboard Target profiles

Baseline: e7715df
Comparison: eba45f5

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.

Fine details of change detection per experiment

perf experiment goal Δ mean % Δ mean % CI trials links
otel_to_otel_logs ingress throughput +0.38 [-0.44, +1.21] 1 Logs
idle memory utilization +0.35 [+0.30, +0.39] 1 Logs
uds_dogstatsd_to_api ingress throughput -0.00 [-0.00, +0.00] 1 Logs
tcp_dd_logs_filter_exclude ingress throughput -0.00 [-0.01, +0.01] 1 Logs
tcp_syslog_to_blackhole ingress throughput -0.09 [-0.14, -0.04] 1 Logs
file_tree memory utilization -0.28 [-0.39, -0.17] 1 Logs
uds_dogstatsd_to_api_cpu % cpu utilization -0.49 [-1.25, +0.27] 1 Logs
basic_py_check % cpu utilization -1.12 [-3.91, +1.67] 1 Logs
pycheck_lots_of_tags % cpu utilization -1.79 [-4.41, +0.83] 1 Logs

Bounds Checks

perf experiment bounds_check_name replicates_passed
idle memory_usage 7/10

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".

@gjulianm gjulianm force-pushed the guillermo.julian/uprobe-attacher-refactor-usm branch from 8aa0fe7 to 9a3a84e Compare August 7, 2024 14:24
@pr-commenter
Copy link

pr-commenter bot commented Aug 7, 2024

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

Note: This applies to commit eba45f5

@gjulianm gjulianm force-pushed the guillermo.julian/uprobe-attacher-refactor-usm branch 2 times, most recently from 391f14c to 48f4ab3 Compare August 12, 2024 09:06
@gjulianm gjulianm force-pushed the guillermo.julian/uprobe-attacher-refactor-usm branch from 60140b7 to 679d9c4 Compare August 19, 2024 14:23
Copy link
Contributor

Serverless Benchmark Results

BenchmarkStartEndInvocation comparison between 74cdc87 and 5990ff5.

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                            87.24µ ± 3%   86.75µ ± 4%       ~ (p=0.393 n=10)
api-gateway-kong-appsec.json                       69.53µ ± 3%   65.54µ ± 1%  -5.73% (p=0.000 n=10)
api-gateway-kong.json                              67.30µ ± 2%   65.47µ ± 1%  -2.71% (p=0.000 n=10)
api-gateway-non-proxy-async.json                   108.9µ ± 3%   104.8µ ± 2%  -3.75% (p=0.000 n=10)
api-gateway-non-proxy.json                         108.5µ ± 1%   106.3µ ± 2%  -2.02% (p=0.015 n=10)
api-gateway-websocket-connect.json                 71.30µ ± 1%   70.14µ ± 1%  -1.63% (p=0.015 n=10)
api-gateway-websocket-default.json                 63.73µ ± 1%   63.68µ ± 1%       ~ (p=0.971 n=10)
api-gateway-websocket-disconnect.json              63.66µ ± 1%   63.87µ ± 2%       ~ (p=0.579 n=10)
api-gateway.json                                   116.9µ ± 1%   115.9µ ± 1%       ~ (p=0.190 n=10)
application-load-balancer.json                     64.69µ ± 4%   64.86µ ± 1%       ~ (p=0.670 n=10)
cloudfront.json                                    47.38µ ± 4%   48.38µ ± 1%       ~ (p=0.165 n=10)
cloudwatch-events.json                             38.46µ ± 1%   38.91µ ± 2%  +1.19% (p=0.011 n=10)
cloudwatch-logs.json                               66.14µ ± 1%   65.71µ ± 2%       ~ (p=0.105 n=10)
custom.json                                        31.55µ ± 1%   32.09µ ± 1%  +1.72% (p=0.000 n=10)
dynamodb.json                                      96.22µ ± 2%   95.09µ ± 2%       ~ (p=0.393 n=10)
empty.json                                         30.01µ ± 1%   30.27µ ± 2%       ~ (p=0.218 n=10)
eventbridge-custom.json                            42.83µ ± 2%   43.22µ ± 2%       ~ (p=0.190 n=10)
http-api.json                                      73.43µ ± 1%   73.48µ ± 2%       ~ (p=0.529 n=10)
kinesis-batch.json                                 72.68µ ± 2%   71.84µ ± 1%       ~ (p=0.143 n=10)
kinesis.json                                       55.25µ ± 1%   55.41µ ± 1%       ~ (p=0.353 n=10)
s3.json                                            61.04µ ± 2%   59.85µ ± 2%  -1.94% (p=0.043 n=10)
sns-batch.json                                     92.64µ ± 2%   91.41µ ± 1%  -1.33% (p=0.004 n=10)
sns.json                                           66.45µ ± 2%   65.83µ ± 2%       ~ (p=0.123 n=10)
snssqs.json                                        113.3µ ± 2%   114.2µ ± 2%       ~ (p=0.631 n=10)
snssqs_no_dd_context.json                          100.3µ ± 2%   100.7µ ± 2%       ~ (p=0.529 n=10)
sqs-aws-header.json                                56.64µ ± 1%   57.31µ ± 2%       ~ (p=0.089 n=10)
sqs-batch.json                                     96.19µ ± 4%   94.77µ ± 1%  -1.47% (p=0.015 n=10)
sqs.json                                           70.70µ ± 1%   70.09µ ± 1%       ~ (p=0.063 n=10)
sqs_no_dd_context.json                             64.72µ ± 3%   64.81µ ± 4%       ~ (p=0.796 n=10)
geomean                                            68.27µ        67.87µ       -0.59%

                                      │ baseline/benchmark.log │        current/benchmark.log        │
                                      │          B/op          │     B/op      vs base               │
api-gateway-appsec.json                           37.26Ki ± 0%   37.32Ki ± 0%  +0.17% (p=0.000 n=10)
api-gateway-kong-appsec.json                      26.92Ki ± 0%   26.92Ki ± 0%       ~ (p=0.926 n=10)
api-gateway-kong.json                             24.42Ki ± 0%   24.42Ki ± 0%       ~ (p=0.753 n=10)
api-gateway-non-proxy-async.json                  48.05Ki ± 0%   48.09Ki ± 0%  +0.09% (p=0.000 n=10)
api-gateway-non-proxy.json                        47.26Ki ± 0%   47.31Ki ± 0%  +0.10% (p=0.000 n=10)
api-gateway-websocket-connect.json                25.47Ki ± 0%   25.50Ki ± 0%  +0.14% (p=0.000 n=10)
api-gateway-websocket-default.json                21.37Ki ± 0%   21.41Ki ± 0%  +0.19% (p=0.000 n=10)
api-gateway-websocket-disconnect.json             21.15Ki ± 0%   21.19Ki ± 0%  +0.17% (p=0.000 n=10)
api-gateway.json                                  49.56Ki ± 0%   49.56Ki ± 0%       ~ (p=0.093 n=10)
application-load-balancer.json                    22.34Ki ± 0%   23.28Ki ± 0%  +4.20% (p=0.000 n=10)
cloudfront.json                                   17.65Ki ± 0%   17.66Ki ± 0%  +0.09% (p=0.000 n=10)
cloudwatch-events.json                            11.69Ki ± 0%   11.72Ki ± 0%  +0.25% (p=0.000 n=10)
cloudwatch-logs.json                              53.37Ki ± 0%   53.36Ki ± 0%       ~ (p=0.985 n=10)
custom.json                                       9.720Ki ± 0%   9.723Ki ± 0%       ~ (p=0.469 n=10)
dynamodb.json                                     40.78Ki ± 0%   40.80Ki ± 0%       ~ (p=0.110 n=10)
empty.json                                        9.277Ki ± 0%   9.295Ki ± 0%       ~ (p=0.085 n=10)
eventbridge-custom.json                           13.41Ki ± 0%   13.46Ki ± 0%  +0.36% (p=0.009 n=10)
http-api.json                                     23.73Ki ± 0%   23.78Ki ± 0%  +0.21% (p=0.000 n=10)
kinesis-batch.json                                27.02Ki ± 0%   27.01Ki ± 0%       ~ (p=0.271 n=10)
kinesis.json                                      17.78Ki ± 0%   17.84Ki ± 0%  +0.34% (p=0.002 n=10)
s3.json                                           20.37Ki ± 0%   20.37Ki ± 0%       ~ (p=0.671 n=10)
sns-batch.json                                    38.70Ki ± 0%   38.69Ki ± 0%       ~ (p=0.810 n=10)
sns.json                                          24.00Ki ± 0%   23.97Ki ± 0%       ~ (p=0.256 n=10)
snssqs.json                                       50.77Ki ± 0%   50.81Ki ± 0%       ~ (p=0.218 n=10)
snssqs_no_dd_context.json                         44.81Ki ± 0%   44.87Ki ± 0%  +0.12% (p=0.007 n=10)
sqs-aws-header.json                               18.81Ki ± 0%   18.90Ki ± 0%  +0.51% (p=0.005 n=10)
sqs-batch.json                                    41.65Ki ± 0%   41.58Ki ± 0%       ~ (p=0.075 n=10)
sqs.json                                          25.55Ki ± 1%   25.57Ki ± 0%       ~ (p=0.481 n=10)
sqs_no_dd_context.json                            20.69Ki ± 1%   20.73Ki ± 1%       ~ (p=0.529 n=10)
geomean                                           25.71Ki        25.77Ki       +0.25%

                                      │ 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                    726.0 ± 0%   725.5 ± 0%       ~ (p=0.650 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=0.474 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.582 n=10)
application-load-balancer.json                      352.0 ± 0%   353.0 ± 0%  +0.28% (p=0.000 n=10)
cloudfront.json                                     284.0 ± 0%   284.0 ± 0%       ~ (p=1.000 n=10) ¹
cloudwatch-events.json                              220.0 ± 0%   220.0 ± 0%       ~ (p=1.000 n=10)
cloudwatch-logs.json                                215.5 ± 0%   215.0 ± 0%       ~ (p=1.000 n=10)
custom.json                                         168.0 ± 0%   168.0 ± 1%       ~ (p=1.000 n=10)
dynamodb.json                                       589.0 ± 0%   589.0 ± 0%       ~ (p=0.837 n=10)
empty.json                                          160.0 ± 1%   160.0 ± 1%       ~ (p=1.000 n=10)
eventbridge-custom.json                             254.0 ± 0%   254.0 ± 0%       ~ (p=0.582 n=10)
http-api.json                                       433.0 ± 0%   432.0 ± 0%       ~ (p=0.656 n=10)
kinesis-batch.json                                  391.0 ± 0%   390.0 ± 0%  -0.26% (p=0.000 n=10)
kinesis.json                                        285.0 ± 0%   285.0 ± 0%       ~ (p=0.224 n=10)
s3.json                                             358.0 ± 0%   358.0 ± 0%       ~ (p=0.667 n=10)
sns-batch.json                                      455.0 ± 0%   455.0 ± 0%       ~ (p=0.423 n=10)
sns.json                                            323.0 ± 0%   323.0 ± 0%       ~ (p=0.440 n=10)
snssqs.json                                         450.0 ± 0%   450.0 ± 0%       ~ (p=0.732 n=10)
snssqs_no_dd_context.json                           399.0 ± 0%   399.5 ± 0%       ~ (p=0.386 n=10)
sqs-aws-header.json                                 274.0 ± 0%   275.0 ± 0%  +0.36% (p=0.013 n=10)
sqs-batch.json                                      504.0 ± 0%   503.0 ± 0%       ~ (p=0.117 n=10)
sqs.json                                            351.0 ± 1%   351.0 ± 0%       ~ (p=0.578 n=10)
sqs_no_dd_context.json                              324.5 ± 1%   324.5 ± 0%       ~ (p=0.955 n=10)
geomean                                             376.8        376.8       -0.01%
¹ all samples are equal

@gjulianm gjulianm force-pushed the guillermo.julian/uprobe-attacher-refactor-usm branch 6 times, most recently from 46b33ef to 892b64e Compare August 22, 2024 15:47
@gjulianm
Copy link
Contributor Author

/trigger-ci

@dd-devflow
Copy link

dd-devflow bot commented Aug 23, 2024

🚂 Gitlab pipeline started

Started pipeline #42666612

@gjulianm gjulianm force-pushed the guillermo.julian/uprobe-attacher-refactor-usm branch from 892b64e to c5bba23 Compare August 27, 2024 11:22
@gjulianm gjulianm force-pushed the guillermo.julian/uprobe-attacher-refactor-usm branch from c5bba23 to 8be221e Compare September 3, 2024 14:53
Base automatically changed from guillermo.julian/uprobe-attacher to main September 13, 2024 15:09
@gjulianm gjulianm force-pushed the guillermo.julian/uprobe-attacher-refactor-usm branch from 8be221e to eba45f5 Compare September 13, 2024 15:56
@agent-platform-auto-pr
Copy link
Contributor

[Fast Unit Tests Report]

On pipeline 44304380 (CI Visibility). The following jobs did not run any unit tests:

Jobs:
  • tests_deb-arm64-py3
  • tests_deb-x64-py3
  • tests_flavor_dogstatsd_deb-x64
  • tests_flavor_heroku_deb-x64
  • tests_flavor_iot_deb-x64
  • tests_rpm-arm64-py3
  • tests_rpm-x64-py3
  • tests_windows-x64

If you modified Go files and expected unit tests to run in these jobs, please double check the job logs. If you think tests should have been executed reach out to #agent-devx-help

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant