Skip to content

Add asynchronous type support for trace annotation instrumentation#5802

Merged
PerfectSlayer merged 1 commit into
masterfrom
bbujon/trace-annotations
Sep 18, 2023
Merged

Add asynchronous type support for trace annotation instrumentation#5802
PerfectSlayer merged 1 commit into
masterfrom
bbujon/trace-annotations

Conversation

@PerfectSlayer

Copy link
Copy Markdown
Contributor

What Does This Do

This PR brings the asynchronous result type support from OpenTelemetry annotations (see #5593) to the original @Trace annotation.

Motivation

This should improve the generated span by having more precise span duration (span end will be at the end of the async operation).

Additional Notes

As a behavior change, this is not the default behavior despite it should be closer of the expected behavior.
The feature must be enabled by setting dd.trace.annotation.async to true.

@PerfectSlayer PerfectSlayer added type: feature Enhancements and improvements inst: others All other instrumentations labels Aug 29, 2023
@PerfectSlayer
PerfectSlayer requested a review from a team as a code owner August 29, 2023 11:41
@PerfectSlayer
PerfectSlayer requested review from am312 and dougqh August 29, 2023 11:41
@pr-commenter

pr-commenter Bot commented Aug 29, 2023

Copy link
Copy Markdown

Benchmarks

Startup

Parameters

Baseline Candidate
commit 1.20.0-SNAPSHOT~a879971d94 1.20.0-SNAPSHOT~dcf5592f4d
config baseline candidate
See matching parameters
Baseline Candidate
application insecure-bank insecure-bank
module Agent Agent
parent None None
variant appsec appsec

Summary

Found 0 performance improvements and 0 performance regressions! Performance is the same for 62 cases.

Startup time reports for insecure-bank
gantt
    title insecure-bank - global startup overhead: candidate=1.20.0-SNAPSHOT~dcf5592f4d, baseline=1.20.0-SNAPSHOT~a879971d94

    dateFormat X
    axisFormat %s
section tracing
Agent [baseline] (986.224 ms) : 0, 986224
Total [baseline] (8.643 s) : 0, 8643440
Agent [candidate] (989.865 ms) : 0, 989865
Total [candidate] (8.671 s) : 0, 8670654
section appsec
Agent [baseline] (1.074 s) : 0, 1074447
Total [baseline] (8.72 s) : 0, 8720485
Agent [candidate] (1.08 s) : 0, 1080226
Total [candidate] (8.738 s) : 0, 8737626
section iast
Agent [baseline] (1.096 s) : 0, 1095598
Total [baseline] (9.156 s) : 0, 9156343
Agent [candidate] (1.093 s) : 0, 1093467
Total [candidate] (9.192 s) : 0, 9192143
section profiling
Agent [baseline] (1.159 s) : 0, 1158750
Total [baseline] (8.892 s) : 0, 8891848
Agent [candidate] (1.164 s) : 0, 1163536
Total [candidate] (8.86 s) : 0, 8859673
Loading
  • baseline results
Module Variant Duration Δ tracing
Agent tracing 986.224 ms -
Agent appsec 1.074 s 88.224 ms (8.9%)
Agent iast 1.096 s 109.374 ms (11.1%)
Agent profiling 1.159 s 172.526 ms (17.5%)
Total tracing 8.643 s -
Total appsec 8.72 s 77.046 ms (0.9%)
Total iast 9.156 s 512.903 ms (5.9%)
Total profiling 8.892 s 248.409 ms (2.9%)
  • candidate results
Module Variant Duration Δ tracing
Agent tracing 989.865 ms -
Agent appsec 1.08 s 90.361 ms (9.1%)
Agent iast 1.093 s 103.603 ms (10.5%)
Agent profiling 1.164 s 173.671 ms (17.5%)
Total tracing 8.671 s -
Total appsec 8.738 s 66.972 ms (0.8%)
Total iast 9.192 s 521.49 ms (6.0%)
Total profiling 8.86 s 189.019 ms (2.2%)
gantt
    title insecure-bank - break down per module: candidate=1.20.0-SNAPSHOT~dcf5592f4d, baseline=1.20.0-SNAPSHOT~a879971d94

    dateFormat X
    axisFormat %s
section tracing
BytebuddyAgent [baseline] (611.737 ms) : 0, 611737
BytebuddyAgent [candidate] (614.067 ms) : 0, 614067
GlobalTracer [baseline] (283.71 ms) : 0, 283710
GlobalTracer [candidate] (284.935 ms) : 0, 284935
AppSec [baseline] (49.884 ms) : 0, 49884
AppSec [candidate] (49.807 ms) : 0, 49807
Remote Config [baseline] (657.56 µs) : 0, 658
Remote Config [candidate] (662.975 µs) : 0, 663
Telemetry [baseline] (5.964 ms) : 0, 5964
Telemetry [candidate] (5.967 ms) : 0, 5967
section appsec
BytebuddyAgent [baseline] (614.262 ms) : 0, 614262
BytebuddyAgent [candidate] (617.4 ms) : 0, 617400
GlobalTracer [baseline] (284.541 ms) : 0, 284541
GlobalTracer [candidate] (286.464 ms) : 0, 286464
AppSec [baseline] (134.75 ms) : 0, 134750
AppSec [candidate] (135.326 ms) : 0, 135326
Remote Config [baseline] (738.803 µs) : 0, 739
Remote Config [candidate] (729.848 µs) : 0, 730
Telemetry [baseline] (5.753 ms) : 0, 5753
Telemetry [candidate] (5.751 ms) : 0, 5751
section iast
BytebuddyAgent [baseline] (723.424 ms) : 0, 723424
BytebuddyAgent [candidate] (720.382 ms) : 0, 720382
GlobalTracer [baseline] (270.04 ms) : 0, 270040
GlobalTracer [candidate] (271.037 ms) : 0, 271037
AppSec [baseline] (47.059 ms) : 0, 47059
AppSec [candidate] (47.241 ms) : 0, 47241
IAST [baseline] (14.112 ms) : 0, 14112
IAST [candidate] (14.172 ms) : 0, 14172
Remote Config [baseline] (608.242 µs) : 0, 608
Remote Config [candidate] (582.77 µs) : 0, 583
Telemetry [baseline] (5.709 ms) : 0, 5709
Telemetry [candidate] (5.726 ms) : 0, 5726
section profiling
BytebuddyAgent [baseline] (625.632 ms) : 0, 625632
BytebuddyAgent [candidate] (627.355 ms) : 0, 627355
GlobalTracer [baseline] (347.88 ms) : 0, 347880
GlobalTracer [candidate] (349.657 ms) : 0, 349657
AppSec [baseline] (49.273 ms) : 0, 49273
AppSec [candidate] (49.571 ms) : 0, 49571
Remote Config [baseline] (647.325 µs) : 0, 647
Remote Config [candidate] (645.402 µs) : 0, 645
Telemetry [baseline] (6.008 ms) : 0, 6008
Telemetry [candidate] (6.047 ms) : 0, 6047
ProfilingAgent [baseline] (76.438 ms) : 0, 76438
ProfilingAgent [candidate] (77.36 ms) : 0, 77360
Profiling [baseline] (76.462 ms) : 0, 76462
Profiling [candidate] (77.385 ms) : 0, 77385
Loading
Startup time reports for petclinic
gantt
    title petclinic - global startup overhead: candidate=1.20.0-SNAPSHOT~dcf5592f4d, baseline=1.20.0-SNAPSHOT~a879971d94

    dateFormat X
    axisFormat %s
section tracing
Agent [baseline] (994.804 ms) : 0, 994804
Total [baseline] (9.261 s) : 0, 9261468
Agent [candidate] (991.734 ms) : 0, 991734
Total [candidate] (9.181 s) : 0, 9181263
section appsec
Agent [baseline] (1.072 s) : 0, 1072366
Total [baseline] (9.275 s) : 0, 9274838
Agent [candidate] (1.08 s) : 0, 1080448
Total [candidate] (9.364 s) : 0, 9364417
section iast
Agent [baseline] (1.094 s) : 0, 1093947
Total [baseline] (9.474 s) : 0, 9473746
Agent [candidate] (1.1 s) : 0, 1100008
Total [candidate] (9.411 s) : 0, 9411354
section profiling
Agent [baseline] (1.16 s) : 0, 1159577
Total [baseline] (9.461 s) : 0, 9460602
Agent [candidate] (1.159 s) : 0, 1158934
Total [candidate] (9.488 s) : 0, 9488192
Loading
  • baseline results
Module Variant Duration Δ tracing
Agent tracing 994.804 ms -
Agent appsec 1.072 s 77.561 ms (7.8%)
Agent iast 1.094 s 99.143 ms (10.0%)
Agent profiling 1.16 s 164.773 ms (16.6%)
Total tracing 9.261 s -
Total appsec 9.275 s 13.37 ms (0.1%)
Total iast 9.474 s 212.278 ms (2.3%)
Total profiling 9.461 s 199.134 ms (2.2%)
  • candidate results
Module Variant Duration Δ tracing
Agent tracing 991.734 ms -
Agent appsec 1.08 s 88.714 ms (8.9%)
Agent iast 1.1 s 108.274 ms (10.9%)
Agent profiling 1.159 s 167.2 ms (16.9%)
Total tracing 9.181 s -
Total appsec 9.364 s 183.154 ms (2.0%)
Total iast 9.411 s 230.092 ms (2.5%)
Total profiling 9.488 s 306.929 ms (3.3%)
gantt
    title petclinic - break down per module: candidate=1.20.0-SNAPSHOT~dcf5592f4d, baseline=1.20.0-SNAPSHOT~a879971d94

    dateFormat X
    axisFormat %s
section tracing
BytebuddyAgent [baseline] (617.394 ms) : 0, 617394
BytebuddyAgent [candidate] (615.167 ms) : 0, 615167
GlobalTracer [baseline] (285.917 ms) : 0, 285917
GlobalTracer [candidate] (285.651 ms) : 0, 285651
AppSec [baseline] (50.212 ms) : 0, 50212
AppSec [candidate] (49.833 ms) : 0, 49833
Remote Config [baseline] (667.559 µs) : 0, 668
Remote Config [candidate] (677.129 µs) : 0, 677
Telemetry [baseline] (6.032 ms) : 0, 6032
Telemetry [candidate] (5.982 ms) : 0, 5982
section appsec
BytebuddyAgent [baseline] (612.741 ms) : 0, 612741
BytebuddyAgent [candidate] (617.625 ms) : 0, 617625
GlobalTracer [baseline] (283.668 ms) : 0, 283668
GlobalTracer [candidate] (286.353 ms) : 0, 286353
AppSec [baseline] (135.092 ms) : 0, 135092
AppSec [candidate] (135.506 ms) : 0, 135506
Remote Config [baseline] (757.609 µs) : 0, 758
Remote Config [candidate] (743.025 µs) : 0, 743
Telemetry [baseline] (5.742 ms) : 0, 5742
Telemetry [candidate] (5.749 ms) : 0, 5749
section iast
BytebuddyAgent [baseline] (720.857 ms) : 0, 720857
BytebuddyAgent [candidate] (726.277 ms) : 0, 726277
GlobalTracer [baseline] (270.964 ms) : 0, 270964
GlobalTracer [candidate] (271.559 ms) : 0, 271559
AppSec [baseline] (47.156 ms) : 0, 47156
AppSec [candidate] (47.031 ms) : 0, 47031
IAST [baseline] (14.152 ms) : 0, 14152
IAST [candidate] (14.135 ms) : 0, 14135
Remote Config [baseline] (575.758 µs) : 0, 576
Remote Config [candidate] (568.147 µs) : 0, 568
Telemetry [baseline] (5.811 ms) : 0, 5811
Telemetry [candidate] (5.72 ms) : 0, 5720
section profiling
BytebuddyAgent [baseline] (625.911 ms) : 0, 625911
BytebuddyAgent [candidate] (626.31 ms) : 0, 626310
GlobalTracer [baseline] (347.336 ms) : 0, 347336
GlobalTracer [candidate] (347.449 ms) : 0, 347449
AppSec [baseline] (49.188 ms) : 0, 49188
AppSec [candidate] (48.973 ms) : 0, 48973
Remote Config [baseline] (658.118 µs) : 0, 658
Remote Config [candidate] (648.732 µs) : 0, 649
Telemetry [baseline] (6.044 ms) : 0, 6044
Telemetry [candidate] (5.976 ms) : 0, 5976
ProfilingAgent [baseline] (77.6 ms) : 0, 77600
ProfilingAgent [candidate] (76.599 ms) : 0, 76599
Profiling [baseline] (77.624 ms) : 0, 77624
Profiling [candidate] (76.623 ms) : 0, 76623
Loading

Load

Parameters

Baseline Candidate
commit 1.20.0-SNAPSHOT~a879971d94 1.20.0-SNAPSHOT~dcf5592f4d
config baseline candidate
end_time 2023-08-29T12:08:41 2023-08-29T12:26:46
start_time 2023-08-29T12:08:23 2023-08-29T12:26:28
See matching parameters
Baseline Candidate
application insecure-bank insecure-bank
variant appsec appsec

Summary

Found 0 performance improvements and 0 performance regressions! Performance is the same for 24 cases.

Request duration reports for insecure-bank
gantt
    title insecure-bank - request duration [CI 0.99] : candidate=1.20.0-SNAPSHOT~dcf5592f4d, baseline=1.20.0-SNAPSHOT~a879971d94
    dateFormat X
    axisFormat %s
section baseline
no_agent (359.586 µs) : 340, 379
.   : milestone, 360,
appsec (666.945 µs) : 645, 689
.   : milestone, 667,
iast (454.784 µs) : 434, 476
.   : milestone, 455,
iast_FULL (522.077 µs) : 501, 543
.   : milestone, 522,
iast_INACTIVE (438.665 µs) : 417, 461
.   : milestone, 439,
profiling (434.051 µs) : 413, 455
.   : milestone, 434,
tracing (426.571 µs) : 406, 447
.   : milestone, 427,
section candidate
no_agent (360.963 µs) : 340, 382
.   : milestone, 361,
appsec (663.076 µs) : 642, 684
.   : milestone, 663,
iast (452.136 µs) : 432, 473
.   : milestone, 452,
iast_FULL (517.948 µs) : 497, 539
.   : milestone, 518,
iast_INACTIVE (427.267 µs) : 407, 448
.   : milestone, 427,
profiling (433.954 µs) : 413, 455
.   : milestone, 434,
tracing (433.575 µs) : 413, 454
.   : milestone, 434,
Loading
  • baseline results
Variant Request duration [CI 0.99] Δ no_agent
no_agent 359.586 µs [339.691 µs, 379.482 µs] -
appsec 666.945 µs [645.35 µs, 688.54 µs] 307.359 µs (85.5%)
iast 454.784 µs [433.785 µs, 475.784 µs] 95.198 µs (26.5%)
iast_FULL 522.077 µs [501.285 µs, 542.87 µs] 162.491 µs (45.2%)
iast_INACTIVE 438.665 µs [416.66 µs, 460.67 µs] 79.079 µs (22.0%)
profiling 434.051 µs [413.466 µs, 454.636 µs] 74.465 µs (20.7%)
tracing 426.571 µs [406.476 µs, 446.666 µs] 66.985 µs (18.6%)
  • candidate results
Variant Request duration [CI 0.99] Δ no_agent
no_agent 360.963 µs [340.415 µs, 381.511 µs] -
appsec 663.076 µs [642.063 µs, 684.09 µs] 302.113 µs (83.7%)
iast 452.136 µs [431.564 µs, 472.708 µs] 91.173 µs (25.3%)
iast_FULL 517.948 µs [497.073 µs, 538.822 µs] 156.985 µs (43.5%)
iast_INACTIVE 427.267 µs [406.581 µs, 447.954 µs] 66.304 µs (18.4%)
profiling 433.954 µs [413.14 µs, 454.769 µs] 72.991 µs (20.2%)
tracing 433.575 µs [412.921 µs, 454.229 µs] 72.612 µs (20.1%)
Request duration reports for petclinic
gantt
    title petclinic - request duration [CI 0.99] : candidate=1.20.0-SNAPSHOT~dcf5592f4d, baseline=1.20.0-SNAPSHOT~a879971d94
    dateFormat X
    axisFormat %s
section baseline
no_agent (1.329 ms) : 1310, 1349
.   : milestone, 1329,
appsec (1.69 ms) : 1666, 1714
.   : milestone, 1690,
iast (1.445 ms) : 1421, 1469
.   : milestone, 1445,
profiling (1.474 ms) : 1449, 1499
.   : milestone, 1474,
tracing (1.451 ms) : 1426, 1475
.   : milestone, 1451,
section candidate
no_agent (1.336 ms) : 1317, 1355
.   : milestone, 1336,
appsec (1.691 ms) : 1667, 1716
.   : milestone, 1691,
iast (1.455 ms) : 1431, 1479
.   : milestone, 1455,
profiling (1.467 ms) : 1442, 1492
.   : milestone, 1467,
tracing (1.44 ms) : 1415, 1465
.   : milestone, 1440,
Loading
  • baseline results
Variant Request duration [CI 0.99] Δ no_agent
no_agent 1.329 ms [1.31 ms, 1.349 ms] -
appsec 1.69 ms [1.666 ms, 1.714 ms] 360.794 µs (27.1%)
iast 1.445 ms [1.421 ms, 1.469 ms] 115.306 µs (8.7%)
profiling 1.474 ms [1.449 ms, 1.499 ms] 144.669 µs (10.9%)
tracing 1.451 ms [1.426 ms, 1.475 ms] 121.54 µs (9.1%)
  • candidate results
Variant Request duration [CI 0.99] Δ no_agent
no_agent 1.336 ms [1.317 ms, 1.355 ms] -
appsec 1.691 ms [1.667 ms, 1.716 ms] 355.516 µs (26.6%)
iast 1.455 ms [1.431 ms, 1.479 ms] 119.101 µs (8.9%)
profiling 1.467 ms [1.442 ms, 1.492 ms] 131.191 µs (9.8%)
tracing 1.44 ms [1.415 ms, 1.465 ms] 104.246 µs (7.8%)

@PerfectSlayer
PerfectSlayer merged commit d0b65c5 into master Sep 18, 2023
@PerfectSlayer
PerfectSlayer deleted the bbujon/trace-annotations branch September 18, 2023 13:53
@github-actions github-actions Bot added this to the 1.21.0 milestone Sep 18, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

inst: others All other instrumentations type: feature Enhancements and improvements

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants