datadog-agent
datadog-agent copied to clipboard
[WIP][OTEL-1720] Add a new API to Concentrator that directly computes APM stats for OTLP traces
What does this PR do?
Motivation
Describe how to test/QA your changes
Regression Detector
Regression Detector Results
Run ID: 3725f509-a34e-4acf-8c80-9556408c9149 Baseline: be8177a0766a87aca26ab8e319c70db1506f6525 Comparison: 3d4186b286cecc464e61e581bb8105b16096c913
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 |
|---|---|---|---|---|
| ➖ | tcp_syslog_to_blackhole | ingress throughput | +5.09 | [-16.61, +26.78] |
| ➖ | idle | memory utilization | +0.55 | [+0.50, +0.59] |
| ➖ | uds_dogstatsd_to_api_cpu | % cpu utilization | +0.23 | [-2.71, +3.18] |
| ➖ | trace_agent_msgpack | ingress throughput | +0.01 | [-0.01, +0.02] |
| ➖ | trace_agent_json | ingress throughput | +0.00 | [-0.01, +0.01] |
| ➖ | otel_to_otel_logs | ingress throughput | +0.00 | [-0.37, +0.37] |
| ➖ | uds_dogstatsd_to_api | ingress throughput | -0.01 | [-0.21, +0.19] |
| ➖ | tcp_dd_logs_filter_exclude | ingress throughput | -0.03 | [-0.06, +0.01] |
| ➖ | file_tree | memory utilization | -1.26 | [-1.37, -1.15] |
| ➖ | pycheck_1000_100byte_tags | % cpu utilization | -1.34 | [-5.87, +3.19] |
| ➖ | basic_py_check | % cpu utilization | -2.06 | [-4.87, +0.75] |
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:
-
Its estimated |Δ mean %| ≥ 5.00%, indicating the change is big enough to merit a closer look.
-
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.
-
Its configuration does not mark it "erratic".
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=35227988 --os-family=ubuntu
Chatted offline, I'm going to try split this PR into incremental ones as it is currently too large.
This feels like a very risky change as it refactors much of the existing code path for computing stats for all Datadog APM customers. Furthermore, it introduces a second forked code path for OTEL spans. Changing logic in the future will be much more difficult with these divergent code paths. Can we supply real-world evidence that the purported "overhead" of converting structs from one type to another justifies the an entirely separate code path? Furthermore, where can we find a test plan for ensuring this change doesn't create a regression for existing APM customers?
Chatted with @dineshg13 and @jdgumz offline and we agree to split out the OTel -> DD conversion code to a helper function, and use the same (DD) ingest API in Concentrator so that the changes in pkg/trace/stats are minimized.
This feels like a very risky change as it refactors much of the existing code path for computing stats for all Datadog APM customers. Furthermore, it introduces a second forked code path for OTEL spans.
@pkalmakis this is no longer the case in the revised approach. Now the new API only converts OTLP spans to Concentrator.Input rather than making any changes to Concentrator itself. APM stats processing on OTel is now identical to DD spans.
Benchmarks
Benchmark execution time: 2024-05-22 22:05:42
Comparing candidate commit 80d28b2ac6d73739ebb27c667b7e0c32cd519f80 in PR branch yang.song/otlp-apm-stats with baseline commit 71ab04ee4581b7cf394ca85f8b8f7aa026482f9f in branch main.
Found 0 performance improvements and 0 performance regressions! Performance is the same for 2 metrics, 1 unstable metrics.
Benchmarks
Benchmark execution time: 2024-05-23 15:51:52
Comparing candidate commit f66446c2fc346f377ea2718703d85e1a7eab80d4 in PR branch yang.song/otlp-apm-stats with baseline commit 6520c3c1585049f70a248745107fdee728e7ae71 in branch main.
Found 0 performance improvements and 0 performance regressions! Performance is the same for 2 metrics, 1 unstable metrics.
Benchmarks
Benchmark execution time: 2024-05-23 15:54:59
Comparing candidate commit f66446c2fc346f377ea2718703d85e1a7eab80d4 in PR branch yang.song/otlp-apm-stats with baseline commit 6520c3c1585049f70a248745107fdee728e7ae71 in branch main.
Found 0 performance improvements and 0 performance regressions! Performance is the same for 1 metrics, 2 unstable metrics.
Codecov Report
Attention: Patch coverage is 91.51786% with 19 lines in your changes are missing coverage. Please review.
Project coverage is 51.98%. Comparing base (
be8177a) to head (3d4186b). Report is 27 commits behind head on main.
| Files | Patch % | Lines |
|---|---|---|
| pkg/trace/traceutil/otel_util.go | 64.28% | 10 Missing :warning: |
| pkg/trace/stats/otel_util.go | 89.65% | 6 Missing and 3 partials :warning: |
Additional details and impacted files
@@ Coverage Diff @@
## main #23503 +/- ##
===========================================
+ Coverage 45.85% 51.98% +6.13%
===========================================
Files 2181 1799 -382
Lines 256794 154027 -102767
===========================================
- Hits 117747 80076 -37671
+ Misses 129678 69485 -60193
+ Partials 9369 4466 -4903
| Flag | Coverage Δ | |
|---|---|---|
| amzn_aarch64 | 52.32% <91.51%> (+6.50%) |
:arrow_up: |
| centos_x86_64 | 52.21% <91.51%> (+6.48%) |
:arrow_up: |
| ubuntu_aarch64 | 52.33% <91.51%> (+6.50%) |
:arrow_up: |
| ubuntu_x86_64 | 52.31% <91.51%> (+6.48%) |
:arrow_up: |
| windows_amd64 | 56.03% <91.51%> (?) |
Flags with carried forward coverage won't be shown. Click here to find out more.
:umbrella: View full report in Codecov by Sentry.
:loudspeaker: Have feedback on the report? Share it here.
Benchmarks
Benchmark execution time: 2024-05-23 20:11:47
Comparing candidate commit 53ddcfb20ab33ed8e2d41ddb743be314abbfdb6d in PR branch yang.song/otlp-apm-stats with baseline commit fa5ba1bb4c8fcdcee74136224e19d4ea55722e37 in branch main.
Found 0 performance improvements and 0 performance regressions! Performance is the same for 2 metrics, 1 unstable metrics.
Benchmarks
Benchmark execution time: 2024-05-23 21:30:29
Comparing candidate commit 289790ed1314304ef18d2a42926f6aa960bd4f19 in PR branch yang.song/otlp-apm-stats with baseline commit ece035dccfbae4701ca83b3ebe42807825005edd in branch main.
Found 0 performance improvements and 0 performance regressions! Performance is the same for 2 metrics, 1 unstable metrics.
Serverless Benchmark Results
BenchmarkStartEndInvocation comparison between 33d43600c674a65c10336b0edadc2b677c6604a0 and a5bca057782ea6fe14e0ab496843b617e4bdf2e3.
tl;dr
Use these benchmarks as an insight tool during development.
-
Skim down the
vs basecolumn 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. -
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 85.90µ ± 8% 85.65µ ± 3% ~ (p=0.971 n=10)
api-gateway-kong-appsec.json 68.40µ ± 2% 66.17µ ± 1% -3.25% (p=0.002 n=10)
api-gateway-kong.json 67.19µ ± 1% 64.60µ ± 2% -3.86% (p=0.000 n=10)
api-gateway-non-proxy-async.json 105.8µ ± 1% 105.2µ ± 3% ~ (p=0.436 n=10)
api-gateway-non-proxy.json 104.1µ ± 2% 103.7µ ± 2% ~ (p=0.912 n=10)
api-gateway-websocket-connect.json 70.32µ ± 1% 69.67µ ± 2% ~ (p=0.143 n=10)
api-gateway-websocket-default.json 63.36µ ± 1% 61.93µ ± 2% -2.25% (p=0.023 n=10)
api-gateway-websocket-disconnect.json 63.26µ ± 1% 61.95µ ± 2% -2.08% (p=0.023 n=10)
api-gateway.json 115.7µ ± 1% 113.4µ ± 1% -1.99% (p=0.003 n=10)
application-load-balancer.json 61.94µ ± 1% 62.50µ ± 1% +0.90% (p=0.019 n=10)
cloudfront.json 47.08µ ± 2% 47.90µ ± 3% +1.75% (p=0.011 n=10)
cloudwatch-events.json 37.31µ ± 2% 38.48µ ± 3% +3.14% (p=0.002 n=10)
cloudwatch-logs.json 64.80µ ± 1% 66.41µ ± 2% +2.48% (p=0.002 n=10)
custom.json 29.25µ ± 5% 30.84µ ± 2% +5.44% (p=0.002 n=10)
dynamodb.json 92.24µ ± 2% 93.76µ ± 1% +1.65% (p=0.019 n=10)
empty.json 27.71µ ± 3% 29.18µ ± 2% +5.30% (p=0.001 n=10)
eventbridge-custom.json 40.59µ ± 2% 42.37µ ± 3% +4.37% (p=0.000 n=10)
http-api.json 71.39µ ± 3% 74.39µ ± 2% +4.21% (p=0.000 n=10)
kinesis-batch.json 70.42µ ± 2% 71.86µ ± 2% +2.04% (p=0.009 n=10)
kinesis.json 52.70µ ± 2% 55.00µ ± 2% +4.37% (p=0.000 n=10)
s3.json 58.37µ ± 2% 59.75µ ± 1% +2.38% (p=0.001 n=10)
sns-batch.json 89.12µ ± 2% 91.14µ ± 2% +2.27% (p=0.043 n=10)
sns.json 62.92µ ± 1% 64.07µ ± 3% +1.82% (p=0.011 n=10)
snssqs.json 109.9µ ± 2% 111.9µ ± 2% ~ (p=0.075 n=10)
snssqs_no_dd_context.json 97.69µ ± 1% 100.28µ ± 2% +2.66% (p=0.000 n=10)
sqs-aws-header.json 53.82µ ± 1% 55.84µ ± 3% +3.75% (p=0.000 n=10)
sqs-batch.json 93.45µ ± 2% 96.55µ ± 2% +3.32% (p=0.004 n=10)
sqs.json 67.10µ ± 2% 69.68µ ± 2% +3.84% (p=0.000 n=10)
sqs_no_dd_context.json 60.68µ ± 2% 62.45µ ± 2% +2.91% (p=0.000 n=10)
geomean 65.98µ 66.97µ +1.51%
│ baseline/benchmark.log │ current/benchmark.log │
│ B/op │ B/op vs base │
api-gateway-appsec.json 37.13Ki ± 0% 37.13Ki ± 0% ~ (p=0.697 n=10)
api-gateway-kong-appsec.json 26.80Ki ± 0% 26.80Ki ± 0% ~ (p=0.839 n=10)
api-gateway-kong.json 24.29Ki ± 0% 24.28Ki ± 0% ~ (p=0.670 n=10)
api-gateway-non-proxy-async.json 47.93Ki ± 0% 47.94Ki ± 0% ~ (p=0.698 n=10)
api-gateway-non-proxy.json 47.15Ki ± 0% 47.14Ki ± 0% ~ (p=0.987 n=10)
api-gateway-websocket-connect.json 25.37Ki ± 0% 25.37Ki ± 0% ~ (p=0.617 n=10)
api-gateway-websocket-default.json 21.27Ki ± 0% 21.27Ki ± 0% ~ (p=0.362 n=10)
api-gateway-websocket-disconnect.json 21.05Ki ± 0% 21.05Ki ± 0% ~ (p=0.697 n=10)
api-gateway.json 49.45Ki ± 0% 49.45Ki ± 0% ~ (p=0.240 n=10)
application-load-balancer.json 22.23Ki ± 0% 22.23Ki ± 0% ~ (p=0.591 n=10)
cloudfront.json 17.58Ki ± 0% 17.57Ki ± 0% ~ (p=0.382 n=10)
cloudwatch-events.json 11.61Ki ± 0% 11.62Ki ± 0% +0.09% (p=0.045 n=10)
cloudwatch-logs.json 53.28Ki ± 0% 53.30Ki ± 0% ~ (p=0.288 n=10)
custom.json 9.640Ki ± 0% 9.652Ki ± 0% +0.13% (p=0.017 n=10)
dynamodb.json 40.59Ki ± 0% 40.57Ki ± 0% ~ (p=0.060 n=10)
empty.json 9.209Ki ± 0% 9.208Ki ± 0% ~ (p=0.470 n=10)
eventbridge-custom.json 13.32Ki ± 0% 13.33Ki ± 0% ~ (p=0.089 n=10)
http-api.json 23.62Ki ± 0% 23.65Ki ± 0% +0.15% (p=0.000 n=10)
kinesis-batch.json 26.94Ki ± 0% 26.95Ki ± 0% ~ (p=0.255 n=10)
kinesis.json 17.71Ki ± 0% 17.75Ki ± 0% +0.20% (p=0.006 n=10)
s3.json 20.22Ki ± 0% 20.26Ki ± 0% ~ (p=0.052 n=10)
sns-batch.json 38.55Ki ± 0% 38.56Ki ± 0% ~ (p=0.494 n=10)
sns.json 23.88Ki ± 0% 23.90Ki ± 0% ~ (p=0.724 n=10)
snssqs.json 50.54Ki ± 0% 50.53Ki ± 0% ~ (p=0.469 n=10)
snssqs_no_dd_context.json 44.71Ki ± 0% 44.74Ki ± 0% +0.07% (p=0.006 n=10)
sqs-aws-header.json 18.77Ki ± 0% 18.79Ki ± 0% ~ (p=0.699 n=10)
sqs-batch.json 41.56Ki ± 0% 41.60Ki ± 0% ~ (p=0.305 n=10)
sqs.json 25.42Ki ± 0% 25.43Ki ± 0% ~ (p=0.644 n=10)
sqs_no_dd_context.json 20.67Ki ± 1% 20.60Ki ± 0% ~ (p=0.436 n=10)
geomean 25.60Ki 25.61Ki +0.03%
│ baseline/benchmark.log │ current/benchmark.log │
│ allocs/op │ allocs/op vs base │
api-gateway-appsec.json 629.0 ± 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=0.628 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 369.0 ± 0% 369.0 ± 0% ~ (p=0.628 n=10)
api-gateway.json 790.0 ± 0% 790.0 ± 0% ~ (p=0.474 n=10)
application-load-balancer.json 352.0 ± 0% 351.0 ± 0% ~ (p=0.656 n=10)
cloudfront.json 284.0 ± 0% 283.0 ± 0% ~ (p=0.656 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=0.526 n=10)
dynamodb.json 589.0 ± 0% 588.0 ± 0% ~ (p=0.370 n=10)
empty.json 159.0 ± 1% 159.0 ± 1% ~ (p=0.628 n=10)
eventbridge-custom.json 253.0 ± 0% 254.0 ± 0% ~ (p=0.179 n=10)
http-api.json 432.0 ± 0% 432.5 ± 0% ~ (p=0.094 n=10)
kinesis-batch.json 390.0 ± 0% 391.0 ± 0% ~ (p=0.370 n=10)
kinesis.json 284.5 ± 0% 285.0 ± 0% +0.18% (p=0.022 n=10)
s3.json 357.0 ± 0% 358.0 ± 0% +0.28% (p=0.050 n=10)
sns-batch.json 454.0 ± 0% 454.5 ± 0% ~ (p=0.650 n=10)
sns.json 322.0 ± 0% 323.0 ± 0% ~ (p=0.611 n=10)
snssqs.json 446.0 ± 0% 446.0 ± 0% ~ (p=1.000 n=10)
snssqs_no_dd_context.json 399.0 ± 0% 399.0 ± 0% 0.00% (p=0.010 n=10)
sqs-aws-header.json 273.0 ± 0% 273.5 ± 1% ~ (p=0.651 n=10)
sqs-batch.json 503.0 ± 0% 504.0 ± 0% ~ (p=0.259 n=10)
sqs.json 350.0 ± 0% 350.0 ± 0% ~ (p=0.834 n=10)
sqs_no_dd_context.json 325.5 ± 1% 324.5 ± 0% ~ (p=0.421 n=10)
geomean 376.2 376.3 +0.03%
¹ all samples are equal
Benchmarks
Benchmark execution time: 2024-05-24 00:44:45
Comparing candidate commit 4a4578f219a745acbe1aa556de3c142032eacf21 in PR branch yang.song/otlp-apm-stats with baseline commit 33d43600c674a65c10336b0edadc2b677c6604a0 in branch main.
Found 0 performance improvements and 0 performance regressions! Performance is the same for 2 metrics, 1 unstable metrics.
Benchmarks
Benchmark execution time: 2024-05-24 19:48:13
Comparing candidate commit ebf21694f40505d166251059bba1b2189bd0df3d in PR branch yang.song/otlp-apm-stats with baseline commit 7ac9c8b8595235bdf9a3ed457d0095100251c451 in branch main.
Found 0 performance improvements and 0 performance regressions! Performance is the same for 2 metrics, 1 unstable metrics.
/merge
:steam_locomotive: MergeQueue
This merge request is not mergeable yet, because of pending checks/missing approvals. It will be added to the queue as soon as checks pass and/or get approvals.
Note: if you pushed new commits since the last approval, you may need additional approval.
You can remove it from the waiting list with /remove command.
Use /merge -c to cancel this operation!
Benchmarks
Benchmark execution time: 2024-05-24 22:11:53
Comparing candidate commit 13a6fe883701ece1b8a2048f2c4637d5c4ea9a90 in PR branch yang.song/otlp-apm-stats with baseline commit e19773f96565662a14fad551d5be0dee5e668ef7 in branch main.
Found 0 performance improvements and 0 performance regressions! Performance is the same for 2 metrics, 1 unstable metrics.
:warning: MergeQueue
This merge request was unqueued
If you need support, contact us on Slack #devflow!
/merge
:steam_locomotive: MergeQueue
This merge request is not mergeable yet, because of pending checks/missing approvals. It will be added to the queue as soon as checks pass and/or get approvals.
Note: if you pushed new commits since the last approval, you may need additional approval.
You can remove it from the waiting list with /remove command.
Use /merge -c to cancel this operation!
Benchmarks
Benchmark execution time: 2024-05-28 12:54:40
Comparing candidate commit 3d4186b286cecc464e61e581bb8105b16096c913 in PR branch yang.song/otlp-apm-stats with baseline commit be8177a0766a87aca26ab8e319c70db1506f6525 in branch main.
Found 0 performance improvements and 0 performance regressions! Performance is the same for 2 metrics, 1 unstable metrics.
:warning: MergeQueue
This merge request was unqueued
If you need support, contact us on Slack #devflow!
/merge
:steam_locomotive: MergeQueue
This merge request is not mergeable yet, because of pending checks/missing approvals. It will be added to the queue as soon as checks pass and/or get approvals.
Note: if you pushed new commits since the last approval, you may need additional approval.
You can remove it from the waiting list with /remove command.
Use /merge -c to cancel this operation!
/merge -c
:warning: MergeQueue
This merge request was unqueued
If you need support, contact us on Slack #devflow!
/merge
:steam_locomotive: MergeQueue
Pull request added to the queue.
There are 4 builds ahead! (estimated merge in less than 2h)
Use /merge -c to cancel this operation!