Skip to content

Added span events to the DD Trace API #8585

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

Open
wants to merge 13 commits into
base: master
Choose a base branch
from

Conversation

nayeem-kamal
Copy link
Contributor

@nayeem-kamal nayeem-kamal commented Mar 18, 2025

What Does This Do

Adds the addEvent method to DDSpan, to allow the creation of Span Events from integrations. This will be use shortly to add Span Events for the GraphQL integration.

Today, it's only possible to create Span Events through the OpenTelemetry span.

Motivation

We want to record multiple query errors coming from a single GraphQL span. Our choice of implementation will be to emit multiple span events, one per GraphQL query error. These are slightly different from regular Span errors, so they will have custom fields in their query error span event.

Contributor Checklist

Jira ticket: AIDM-511

@pr-commenter
Copy link

pr-commenter bot commented Mar 18, 2025

Benchmarks

Startup

Parameters

Baseline Candidate
baseline_or_candidate baseline candidate
git_branch master nayeem-kamal/graphql-errors
git_commit_date 1743085833 1743096585
git_commit_sha 60f8046 4a2d5c5
release_version 1.48.0-SNAPSHOT~60f8046e47 1.48.0-SNAPSHOT~4a2d5c52cb
See matching parameters
Baseline Candidate
application insecure-bank insecure-bank
ci_job_date 1743099812 1743099812
ci_job_id 868553344 868553344
ci_pipeline_id 60224530 60224530
cpu_model Intel(R) Xeon(R) Platinum 8259CL CPU @ 2.50GHz Intel(R) Xeon(R) Platinum 8259CL CPU @ 2.50GHz
kernel_version Linux runner-3yvggzrb-project-304-concurrent-1-hi835s0t 6.8.0-1024-aws #26~22.04.1-Ubuntu SMP Wed Feb 19 06:54:57 UTC 2025 x86_64 x86_64 x86_64 GNU/Linux Linux runner-3yvggzrb-project-304-concurrent-1-hi835s0t 6.8.0-1024-aws #26~22.04.1-Ubuntu SMP Wed Feb 19 06:54:57 UTC 2025 x86_64 x86_64 x86_64 GNU/Linux
module Agent Agent
parent None None
variant iast iast

Summary

Found 0 performance improvements and 0 performance regressions! Performance is the same for 65 metrics, 6 unstable metrics.

Startup time reports for insecure-bank
gantt
    title insecure-bank - global startup overhead: candidate=1.48.0-SNAPSHOT~4a2d5c52cb, baseline=1.48.0-SNAPSHOT~60f8046e47

    dateFormat X
    axisFormat %s
section tracing
Agent [baseline] (1.062 s) : 0, 1062402
Total [baseline] (8.697 s) : 0, 8697176
Agent [candidate] (1.052 s) : 0, 1052346
Total [candidate] (8.652 s) : 0, 8651788
section iast
Agent [baseline] (1.176 s) : 0, 1175920
Total [baseline] (9.205 s) : 0, 9204919
Agent [candidate] (1.176 s) : 0, 1175718
Total [candidate] (9.22 s) : 0, 9220228
section iast_HARDCODED_SECRET_DISABLED
Agent [baseline] (1.179 s) : 0, 1179165
Total [baseline] (9.187 s) : 0, 9187403
Agent [candidate] (1.18 s) : 0, 1180262
Total [candidate] (9.247 s) : 0, 9246938
section iast_TELEMETRY_OFF
Agent [baseline] (1.174 s) : 0, 1174246
Total [baseline] (9.274 s) : 0, 9273966
Agent [candidate] (1.175 s) : 0, 1175133
Total [candidate] (9.244 s) : 0, 9244271
Loading
  • baseline results
Module Variant Duration Δ tracing
Agent tracing 1.062 s -
Agent iast 1.176 s 113.518 ms (10.7%)
Agent iast_HARDCODED_SECRET_DISABLED 1.179 s 116.763 ms (11.0%)
Agent iast_TELEMETRY_OFF 1.174 s 111.845 ms (10.5%)
Total tracing 8.697 s -
Total iast 9.205 s 507.743 ms (5.8%)
Total iast_HARDCODED_SECRET_DISABLED 9.187 s 490.226 ms (5.6%)
Total iast_TELEMETRY_OFF 9.274 s 576.789 ms (6.6%)
  • candidate results
Module Variant Duration Δ tracing
Agent tracing 1.052 s -
Agent iast 1.176 s 123.372 ms (11.7%)
Agent iast_HARDCODED_SECRET_DISABLED 1.18 s 127.916 ms (12.2%)
Agent iast_TELEMETRY_OFF 1.175 s 122.787 ms (11.7%)
Total tracing 8.652 s -
Total iast 9.22 s 568.441 ms (6.6%)
Total iast_HARDCODED_SECRET_DISABLED 9.247 s 595.15 ms (6.9%)
Total iast_TELEMETRY_OFF 9.244 s 592.483 ms (6.8%)
gantt
    title insecure-bank - break down per module: candidate=1.48.0-SNAPSHOT~4a2d5c52cb, baseline=1.48.0-SNAPSHOT~60f8046e47

    dateFormat X
    axisFormat %s
section tracing
BytebuddyAgent [baseline] (727.443 ms) : 0, 727443
BytebuddyAgent [candidate] (720.736 ms) : 0, 720736
GlobalTracer [baseline] (242.838 ms) : 0, 242838
GlobalTracer [candidate] (241.184 ms) : 0, 241184
AppSec [baseline] (55.495 ms) : 0, 55495
AppSec [candidate] (54.763 ms) : 0, 54763
Debugger [baseline] (5.167 ms) : 0, 5167
Debugger [candidate] (4.386 ms) : 0, 4386
Remote Config [baseline] (729.932 µs) : 0, 730
Remote Config [candidate] (702.892 µs) : 0, 703
Telemetry [baseline] (14.389 ms) : 0, 14389
Telemetry [candidate] (14.454 ms) : 0, 14454
section iast
BytebuddyAgent [baseline] (837.769 ms) : 0, 837769
BytebuddyAgent [candidate] (837.645 ms) : 0, 837645
GlobalTracer [baseline] (230.225 ms) : 0, 230225
GlobalTracer [candidate] (230.32 ms) : 0, 230320
IAST [baseline] (22.603 ms) : 0, 22603
IAST [candidate] (22.796 ms) : 0, 22796
AppSec [baseline] (55.954 ms) : 0, 55954
AppSec [candidate] (55.646 ms) : 0, 55646
Debugger [baseline] (4.154 ms) : 0, 4154
Debugger [candidate] (4.132 ms) : 0, 4132
Remote Config [baseline] (590.163 µs) : 0, 590
Remote Config [candidate] (592.596 µs) : 0, 593
Telemetry [baseline] (8.669 ms) : 0, 8669
Telemetry [candidate] (8.663 ms) : 0, 8663
section iast_HARDCODED_SECRET_DISABLED
BytebuddyAgent [baseline] (839.598 ms) : 0, 839598
BytebuddyAgent [candidate] (839.49 ms) : 0, 839490
GlobalTracer [baseline] (231.129 ms) : 0, 231129
GlobalTracer [candidate] (232.087 ms) : 0, 232087
IAST [baseline] (23.767 ms) : 0, 23767
IAST [candidate] (23.005 ms) : 0, 23005
AppSec [baseline] (55.094 ms) : 0, 55094
AppSec [candidate] (56.085 ms) : 0, 56085
Debugger [baseline] (4.174 ms) : 0, 4174
Debugger [candidate] (4.177 ms) : 0, 4177
Remote Config [baseline] (600.886 µs) : 0, 601
Remote Config [candidate] (600.516 µs) : 0, 601
Telemetry [baseline] (8.806 ms) : 0, 8806
Telemetry [candidate] (8.832 ms) : 0, 8832
section iast_TELEMETRY_OFF
BytebuddyAgent [baseline] (835.812 ms) : 0, 835812
BytebuddyAgent [candidate] (836.697 ms) : 0, 836697
GlobalTracer [baseline] (230.394 ms) : 0, 230394
GlobalTracer [candidate] (230.587 ms) : 0, 230587
IAST [baseline] (22.391 ms) : 0, 22391
IAST [candidate] (22.536 ms) : 0, 22536
AppSec [baseline] (56.327 ms) : 0, 56327
AppSec [candidate] (55.969 ms) : 0, 55969
Debugger [baseline] (4.131 ms) : 0, 4131
Debugger [candidate] (4.13 ms) : 0, 4130
Remote Config [baseline] (611.594 µs) : 0, 612
Remote Config [candidate] (600.988 µs) : 0, 601
Telemetry [baseline] (8.608 ms) : 0, 8608
Telemetry [candidate] (8.605 ms) : 0, 8605
Loading
Startup time reports for petclinic
gantt
    title petclinic - global startup overhead: candidate=1.48.0-SNAPSHOT~4a2d5c52cb, baseline=1.48.0-SNAPSHOT~60f8046e47

    dateFormat X
    axisFormat %s
section tracing
Agent [baseline] (1.046 s) : 0, 1046437
Total [baseline] (10.453 s) : 0, 10452612
Agent [candidate] (1.054 s) : 0, 1053940
Total [candidate] (10.428 s) : 0, 10428331
section appsec
Agent [baseline] (1.191 s) : 0, 1190540
Total [baseline] (10.719 s) : 0, 10718949
Agent [candidate] (1.189 s) : 0, 1189401
Total [candidate] (10.738 s) : 0, 10738494
section iast
Agent [baseline] (1.18 s) : 0, 1180427
Total [baseline] (11.043 s) : 0, 11042710
Agent [candidate] (1.177 s) : 0, 1177241
Total [candidate] (10.958 s) : 0, 10957573
section profiling
Agent [baseline] (1.275 s) : 0, 1274549
Total [baseline] (10.927 s) : 0, 10926509
Agent [candidate] (1.272 s) : 0, 1271785
Total [candidate] (10.84 s) : 0, 10839715
Loading
  • baseline results
Module Variant Duration Δ tracing
Agent tracing 1.046 s -
Agent appsec 1.191 s 144.103 ms (13.8%)
Agent iast 1.18 s 133.99 ms (12.8%)
Agent profiling 1.275 s 228.112 ms (21.8%)
Total tracing 10.453 s -
Total appsec 10.719 s 266.337 ms (2.5%)
Total iast 11.043 s 590.098 ms (5.6%)
Total profiling 10.927 s 473.897 ms (4.5%)
  • candidate results
Module Variant Duration Δ tracing
Agent tracing 1.054 s -
Agent appsec 1.189 s 135.461 ms (12.9%)
Agent iast 1.177 s 123.301 ms (11.7%)
Agent profiling 1.272 s 217.845 ms (20.7%)
Total tracing 10.428 s -
Total appsec 10.738 s 310.164 ms (3.0%)
Total iast 10.958 s 529.242 ms (5.1%)
Total profiling 10.84 s 411.384 ms (3.9%)
gantt
    title petclinic - break down per module: candidate=1.48.0-SNAPSHOT~4a2d5c52cb, baseline=1.48.0-SNAPSHOT~60f8046e47

    dateFormat X
    axisFormat %s
section tracing
BytebuddyAgent [baseline] (718.321 ms) : 0, 718321
BytebuddyAgent [candidate] (723.433 ms) : 0, 723433
GlobalTracer [baseline] (240.282 ms) : 0, 240282
GlobalTracer [candidate] (242.056 ms) : 0, 242056
AppSec [baseline] (54.648 ms) : 0, 54648
AppSec [candidate] (55.042 ms) : 0, 55042
Debugger [baseline] (5.116 ms) : 0, 5116
Debugger [candidate] (4.46 ms) : 0, 4460
Remote Config [baseline] (702.603 µs) : 0, 703
Remote Config [candidate] (732.945 µs) : 0, 733
Telemetry [baseline] (11.44 ms) : 0, 11440
Telemetry [candidate] (12.101 ms) : 0, 12101
section appsec
BytebuddyAgent [baseline] (737.19 ms) : 0, 737190
BytebuddyAgent [candidate] (736.808 ms) : 0, 736808
GlobalTracer [baseline] (236.8 ms) : 0, 236800
GlobalTracer [candidate] (236.595 ms) : 0, 236595
AppSec [baseline] (176.549 ms) : 0, 176549
AppSec [candidate] (176.103 ms) : 0, 176103
Debugger [baseline] (4.262 ms) : 0, 4262
Debugger [candidate] (4.315 ms) : 0, 4315
Remote Config [baseline] (643.424 µs) : 0, 643
Remote Config [candidate] (647.106 µs) : 0, 647
Telemetry [baseline] (8.143 ms) : 0, 8143
Telemetry [candidate] (8.18 ms) : 0, 8180
IAST [baseline] (21.791 ms) : 0, 21791
IAST [candidate] (21.532 ms) : 0, 21532
section iast
BytebuddyAgent [baseline] (840.15 ms) : 0, 840150
BytebuddyAgent [candidate] (838.524 ms) : 0, 838524
GlobalTracer [baseline] (231.134 ms) : 0, 231134
GlobalTracer [candidate] (230.654 ms) : 0, 230654
AppSec [baseline] (56.362 ms) : 0, 56362
AppSec [candidate] (55.894 ms) : 0, 55894
Debugger [baseline] (4.199 ms) : 0, 4199
Debugger [candidate] (4.119 ms) : 0, 4119
Remote Config [baseline] (597.628 µs) : 0, 598
Remote Config [candidate] (600.172 µs) : 0, 600
Telemetry [baseline] (8.836 ms) : 0, 8836
Telemetry [candidate] (8.704 ms) : 0, 8704
IAST [baseline] (22.988 ms) : 0, 22988
IAST [candidate] (22.737 ms) : 0, 22737
section profiling
BytebuddyAgent [baseline] (710.698 ms) : 0, 710698
BytebuddyAgent [candidate] (709.081 ms) : 0, 709081
GlobalTracer [baseline] (351.249 ms) : 0, 351249
GlobalTracer [candidate] (351.64 ms) : 0, 351640
AppSec [baseline] (54.862 ms) : 0, 54862
AppSec [candidate] (53.785 ms) : 0, 53785
Debugger [baseline] (4.34 ms) : 0, 4340
Debugger [candidate] (4.293 ms) : 0, 4293
Remote Config [baseline] (698.611 µs) : 0, 699
Remote Config [candidate] (688.44 µs) : 0, 688
Telemetry [baseline] (9.042 ms) : 0, 9042
Telemetry [candidate] (8.912 ms) : 0, 8912
ProfilingAgent [baseline] (101.974 ms) : 0, 101974
ProfilingAgent [candidate] (101.819 ms) : 0, 101819
Profiling [baseline] (102.0 ms) : 0, 102000
Profiling [candidate] (101.845 ms) : 0, 101845
Loading

Load

Parameters

Baseline Candidate
baseline_or_candidate baseline candidate
end_time 2025-03-27T17:53:48 2025-03-27T18:01:32
git_branch master nayeem-kamal/graphql-errors
git_commit_date 1743085833 1743096585
git_commit_sha 60f8046 4a2d5c5
release_version 1.48.0-SNAPSHOT~60f8046e47 1.48.0-SNAPSHOT~4a2d5c52cb
start_time 2025-03-27T17:53:34 2025-03-27T18:01:18
See matching parameters
Baseline Candidate
application insecure-bank insecure-bank
ci_job_date 1743098889 1743098889
ci_job_id 868553345 868553345
ci_pipeline_id 60224530 60224530
cpu_model Intel(R) Xeon(R) Platinum 8259CL CPU @ 2.50GHz Intel(R) Xeon(R) Platinum 8259CL CPU @ 2.50GHz
kernel_version Linux runner-xjcpkyqs-project-304-concurrent-0-xjcpgnha 6.8.0-1024-aws #26~22.04.1-Ubuntu SMP Wed Feb 19 06:54:57 UTC 2025 x86_64 x86_64 x86_64 GNU/Linux Linux runner-xjcpkyqs-project-304-concurrent-0-xjcpgnha 6.8.0-1024-aws #26~22.04.1-Ubuntu SMP Wed Feb 19 06:54:57 UTC 2025 x86_64 x86_64 x86_64 GNU/Linux
variant iast iast

Summary

Found 0 performance improvements and 0 performance regressions! Performance is the same for 13 metrics, 17 unstable metrics.

Request duration reports for insecure-bank
gantt
    title insecure-bank - request duration [CI 0.99] : candidate=1.48.0-SNAPSHOT~4a2d5c52cb, baseline=1.48.0-SNAPSHOT~60f8046e47
    dateFormat X
    axisFormat %s
section baseline
no_agent (380.732 µs) : 360, 401
.   : milestone, 381,
iast (509.68 µs) : 488, 531
.   : milestone, 510,
iast_FULL (733.477 µs) : 711, 756
.   : milestone, 733,
iast_GLOBAL (564.6 µs) : 541, 588
.   : milestone, 565,
iast_HARDCODED_SECRET_DISABLED (511.124 µs) : 489, 533
.   : milestone, 511,
iast_INACTIVE (470.584 µs) : 449, 492
.   : milestone, 471,
iast_TELEMETRY_OFF (497.939 µs) : 476, 519
.   : milestone, 498,
tracing (459.846 µs) : 438, 481
.   : milestone, 460,
section candidate
no_agent (382.065 µs) : 362, 402
.   : milestone, 382,
iast (510.085 µs) : 488, 532
.   : milestone, 510,
iast_FULL (727.779 µs) : 706, 750
.   : milestone, 728,
iast_GLOBAL (558.261 µs) : 537, 580
.   : milestone, 558,
iast_HARDCODED_SECRET_DISABLED (515.123 µs) : 493, 537
.   : milestone, 515,
iast_INACTIVE (469.004 µs) : 447, 491
.   : milestone, 469,
iast_TELEMETRY_OFF (505.29 µs) : 483, 527
.   : milestone, 505,
tracing (462.84 µs) : 441, 484
.   : milestone, 463,
Loading
  • baseline results
Variant Request duration [CI 0.99] Δ no_agent
no_agent 380.732 µs [360.22 µs, 401.243 µs] -
iast 509.68 µs [488.02 µs, 531.341 µs] 128.948 µs (33.9%)
iast_FULL 733.477 µs [711.282 µs, 755.672 µs] 352.745 µs (92.6%)
iast_GLOBAL 564.6 µs [541.206 µs, 587.995 µs] 183.869 µs (48.3%)
iast_HARDCODED_SECRET_DISABLED 511.124 µs [489.174 µs, 533.075 µs] 130.393 µs (34.2%)
iast_INACTIVE 470.584 µs [448.728 µs, 492.441 µs] 89.853 µs (23.6%)
iast_TELEMETRY_OFF 497.939 µs [476.451 µs, 519.428 µs] 117.208 µs (30.8%)
tracing 459.846 µs [438.464 µs, 481.228 µs] 79.114 µs (20.8%)
  • candidate results
Variant Request duration [CI 0.99] Δ no_agent
no_agent 382.065 µs [362.233 µs, 401.897 µs] -
iast 510.085 µs [488.053 µs, 532.116 µs] 128.02 µs (33.5%)
iast_FULL 727.779 µs [705.752 µs, 749.806 µs] 345.714 µs (90.5%)
iast_GLOBAL 558.261 µs [536.67 µs, 579.852 µs] 176.196 µs (46.1%)
iast_HARDCODED_SECRET_DISABLED 515.123 µs [493.358 µs, 536.889 µs] 133.058 µs (34.8%)
iast_INACTIVE 469.004 µs [447.258 µs, 490.75 µs] 86.939 µs (22.8%)
iast_TELEMETRY_OFF 505.29 µs [483.228 µs, 527.351 µs] 123.225 µs (32.3%)
tracing 462.84 µs [441.312 µs, 484.368 µs] 80.775 µs (21.1%)
Request duration reports for petclinic
gantt
    title petclinic - request duration [CI 0.99] : candidate=1.48.0-SNAPSHOT~4a2d5c52cb, baseline=1.48.0-SNAPSHOT~60f8046e47
    dateFormat X
    axisFormat %s
section baseline
no_agent (1.35 ms) : 1331, 1370
.   : milestone, 1350,
appsec (1.717 ms) : 1694, 1741
.   : milestone, 1717,
appsec_no_iast (1.74 ms) : 1717, 1764
.   : milestone, 1740,
code_origins (1.681 ms) : 1655, 1707
.   : milestone, 1681,
iast (1.51 ms) : 1486, 1535
.   : milestone, 1510,
profiling (1.508 ms) : 1484, 1532
.   : milestone, 1508,
tracing (1.503 ms) : 1478, 1527
.   : milestone, 1503,
section candidate
no_agent (1.353 ms) : 1334, 1373
.   : milestone, 1353,
appsec (1.728 ms) : 1704, 1752
.   : milestone, 1728,
appsec_no_iast (1.729 ms) : 1705, 1753
.   : milestone, 1729,
code_origins (1.675 ms) : 1649, 1701
.   : milestone, 1675,
iast (1.518 ms) : 1495, 1542
.   : milestone, 1518,
profiling (1.521 ms) : 1498, 1543
.   : milestone, 1521,
tracing (1.51 ms) : 1485, 1534
.   : milestone, 1510,
Loading
  • baseline results
Variant Request duration [CI 0.99] Δ no_agent
no_agent 1.35 ms [1.331 ms, 1.37 ms] -
appsec 1.717 ms [1.694 ms, 1.741 ms] 366.875 µs (27.2%)
appsec_no_iast 1.74 ms [1.717 ms, 1.764 ms] 390.18 µs (28.9%)
code_origins 1.681 ms [1.655 ms, 1.707 ms] 330.32 µs (24.5%)
iast 1.51 ms [1.486 ms, 1.535 ms] 159.772 µs (11.8%)
profiling 1.508 ms [1.484 ms, 1.532 ms] 157.349 µs (11.7%)
tracing 1.503 ms [1.478 ms, 1.527 ms] 152.327 µs (11.3%)
  • candidate results
Variant Request duration [CI 0.99] Δ no_agent
no_agent 1.353 ms [1.334 ms, 1.373 ms] -
appsec 1.728 ms [1.704 ms, 1.752 ms] 374.054 µs (27.6%)
appsec_no_iast 1.729 ms [1.705 ms, 1.753 ms] 375.234 µs (27.7%)
code_origins 1.675 ms [1.649 ms, 1.701 ms] 321.723 µs (23.8%)
iast 1.518 ms [1.495 ms, 1.542 ms] 164.763 µs (12.2%)
profiling 1.521 ms [1.498 ms, 1.543 ms] 167.045 µs (12.3%)
tracing 1.51 ms [1.485 ms, 1.534 ms] 156.171 µs (11.5%)

Dacapo

Parameters

Baseline Candidate
baseline_or_candidate baseline candidate
git_branch master nayeem-kamal/graphql-errors
git_commit_date 1743085833 1743096585
git_commit_sha 60f8046 4a2d5c5
release_version 1.48.0-SNAPSHOT~60f8046e47 1.48.0-SNAPSHOT~4a2d5c52cb
See matching parameters
Baseline Candidate
application biojava biojava
ci_job_date 1743099371 1743099371
ci_job_id 868553346 868553346
ci_pipeline_id 60224530 60224530
cpu_model Intel(R) Xeon(R) Platinum 8259CL CPU @ 2.50GHz Intel(R) Xeon(R) Platinum 8259CL CPU @ 2.50GHz
kernel_version Linux runner-3yvggzrb-project-304-concurrent-2-sj87xche 6.8.0-1024-aws #26~22.04.1-Ubuntu SMP Wed Feb 19 06:54:57 UTC 2025 x86_64 x86_64 x86_64 GNU/Linux Linux runner-3yvggzrb-project-304-concurrent-2-sj87xche 6.8.0-1024-aws #26~22.04.1-Ubuntu SMP Wed Feb 19 06:54:57 UTC 2025 x86_64 x86_64 x86_64 GNU/Linux
variant appsec appsec

Summary

Found 0 performance improvements and 0 performance regressions! Performance is the same for 12 metrics, 0 unstable metrics.

Execution time for tomcat
gantt
    title tomcat - execution time [CI 0.99] : candidate=1.48.0-SNAPSHOT~4a2d5c52cb, baseline=1.48.0-SNAPSHOT~60f8046e47
    dateFormat X
    axisFormat %s
section baseline
no_agent (1.475 ms) : 1464, 1487
.   : milestone, 1475,
appsec (2.342 ms) : 2298, 2385
.   : milestone, 2342,
iast (2.11 ms) : 2054, 2165
.   : milestone, 2110,
iast_GLOBAL (2.159 ms) : 2103, 2214
.   : milestone, 2159,
profiling (1.979 ms) : 1934, 2023
.   : milestone, 1979,
tracing (1.956 ms) : 1914, 1999
.   : milestone, 1956,
section candidate
no_agent (1.469 ms) : 1458, 1481
.   : milestone, 1469,
appsec (2.341 ms) : 2297, 2385
.   : milestone, 2341,
iast (2.12 ms) : 2064, 2175
.   : milestone, 2120,
iast_GLOBAL (2.154 ms) : 2098, 2209
.   : milestone, 2154,
profiling (1.969 ms) : 1925, 2013
.   : milestone, 1969,
tracing (1.959 ms) : 1916, 2001
.   : milestone, 1959,
Loading
  • baseline results
Variant Execution Time [CI 0.99] Δ no_agent
no_agent 1.475 ms [1.464 ms, 1.487 ms] -
appsec 2.342 ms [2.298 ms, 2.385 ms] 866.301 µs (58.7%)
iast 2.11 ms [2.054 ms, 2.165 ms] 634.157 µs (43.0%)
iast_GLOBAL 2.159 ms [2.103 ms, 2.214 ms] 683.201 µs (46.3%)
profiling 1.979 ms [1.934 ms, 2.023 ms] 503.219 µs (34.1%)
tracing 1.956 ms [1.914 ms, 1.999 ms] 480.88 µs (32.6%)
  • candidate results
Variant Execution Time [CI 0.99] Δ no_agent
no_agent 1.469 ms [1.458 ms, 1.481 ms] -
appsec 2.341 ms [2.297 ms, 2.385 ms] 871.736 µs (59.3%)
iast 2.12 ms [2.064 ms, 2.175 ms] 650.27 µs (44.3%)
iast_GLOBAL 2.154 ms [2.098 ms, 2.209 ms] 684.152 µs (46.6%)
profiling 1.969 ms [1.925 ms, 2.013 ms] 499.488 µs (34.0%)
tracing 1.959 ms [1.916 ms, 2.001 ms] 489.428 µs (33.3%)
Execution time for biojava
gantt
    title biojava - execution time [CI 0.99] : candidate=1.48.0-SNAPSHOT~4a2d5c52cb, baseline=1.48.0-SNAPSHOT~60f8046e47
    dateFormat X
    axisFormat %s
section baseline
no_agent (14.956 s) : 14956000, 14956000
.   : milestone, 14956000,
appsec (14.974 s) : 14974000, 14974000
.   : milestone, 14974000,
iast (18.767 s) : 18767000, 18767000
.   : milestone, 18767000,
iast_GLOBAL (17.821 s) : 17821000, 17821000
.   : milestone, 17821000,
profiling (14.942 s) : 14942000, 14942000
.   : milestone, 14942000,
tracing (15.054 s) : 15054000, 15054000
.   : milestone, 15054000,
section candidate
no_agent (15.339 s) : 15339000, 15339000
.   : milestone, 15339000,
appsec (14.935 s) : 14935000, 14935000
.   : milestone, 14935000,
iast (18.442 s) : 18442000, 18442000
.   : milestone, 18442000,
iast_GLOBAL (17.746 s) : 17746000, 17746000
.   : milestone, 17746000,
profiling (15.198 s) : 15198000, 15198000
.   : milestone, 15198000,
tracing (15.092 s) : 15092000, 15092000
.   : milestone, 15092000,
Loading
  • baseline results
Variant Execution Time [CI 0.99] Δ no_agent
no_agent 14.956 s [14.956 s, 14.956 s] -
appsec 14.974 s [14.974 s, 14.974 s] 18.0 ms (0.1%)
iast 18.767 s [18.767 s, 18.767 s] 3.811 s (25.5%)
iast_GLOBAL 17.821 s [17.821 s, 17.821 s] 2.865 s (19.2%)
profiling 14.942 s [14.942 s, 14.942 s] -14.0 ms (-0.1%)
tracing 15.054 s [15.054 s, 15.054 s] 98.0 ms (0.7%)
  • candidate results
Variant Execution Time [CI 0.99] Δ no_agent
no_agent 15.339 s [15.339 s, 15.339 s] -
appsec 14.935 s [14.935 s, 14.935 s] -404.0 ms (-2.6%)
iast 18.442 s [18.442 s, 18.442 s] 3.103 s (20.2%)
iast_GLOBAL 17.746 s [17.746 s, 17.746 s] 2.407 s (15.7%)
profiling 15.198 s [15.198 s, 15.198 s] -141.0 ms (-0.9%)
tracing 15.092 s [15.092 s, 15.092 s] -247.0 ms (-1.6%)

nayeem-kamal and others added 2 commits March 18, 2025 17:38
Co-authored-by: datadog-datadog-prod-us1[bot] <88084959+datadog-datadog-prod-us1[bot]@users.noreply.github.com>
}
first = false;
}
json.append("}");
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟠 Code Quality Violation

Suggested change
json.append("}");
json.append('}');
Do not append a string literal that contains only a single char (...read more)

Do not append a string with single character to a StringBuffer. Instead, append a character type. This is better practice and results in better performance. While this is negligible if the operation occurs once, it has performance impact if done at scale.

Learn More

View in Datadog  Leave us feedback  Documentation

@marcotc marcotc added the comp: api Tracer public API label Mar 25, 2025
@marcotc marcotc changed the title Added span events functionality and tests Added span events to the DD Trace API Mar 25, 2025
@marcotc marcotc marked this pull request as ready for review March 25, 2025 21:57
@marcotc marcotc requested a review from a team as a code owner March 25, 2025 21:57
@marcotc marcotc requested a review from dougqh March 25, 2025 21:57
Copy link
Contributor

github-actions bot commented Mar 25, 2025

Hi! 👋 Thanks for your pull request! 🎉

To help us review it, please make sure to:

  • Add at least one type, and one component or instrumentation label to the pull request

If you need help, please check our contributing guidelines.

Copy link
Contributor

@ygree ygree left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm posting the first part of my notes because I didn't have time to complete the review all at once.

* data model closely follows the OpenTelemetry specification.
*
* @see <a
* href="https://github.com/open-telemetry/opentelemetry.io/blob/2b007bc89daf60fe72e25a11f7e7d21887faf4ae/content/en/docs/concepts/signals/traces.md#span-events">OpenTelemetry
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You may want to use this shorter link instead https://opentelemetry.io/docs/concepts/signals/traces/#span-links

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍

*/
public class DDSpanEvent {
private static final Logger LOGGER = LoggerFactory.getLogger(DDSpanEvent.class);
private static final int TAG_MAX_LENGTH = 25_000;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It might be worth commenting on where this limit comes from.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍


public AgentSpan addEvent(String name, SpanNativeAttributes attributes) {
if (name != null) {
events.add(new DDSpanEvent(name, attributes));
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

How does an event without a timestamp appear in the UI?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

With the current timestamp.

return null;
}
// Manually encode as JSON array
StringBuilder builder = new StringBuilder("[");
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

As a safer option to work with, you could just use com.squareup.moshi.JsonWriter. As a bonus, no adapter or intermediate to string conversion is required.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Awesome recommendation!

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There is a new JSON component for this in the codebase.


// Verify span events
def actualEvents = actualSpan.meta["events"]
def expectedEvent = "[{\"time_unix_nano\":${java.util.concurrent.TimeUnit.MILLISECONDS.toNanos(timestamp)},\"name\":\"test-event\",\"attributes\":{\"key1\":\"value1\",\"key2\":123,\"key3\":[1.1,2.2,3.3]}}]"
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Use single quotes to avoid escaping.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍


// Verify span events
def actualEvents = actualSpan.meta["events"]
def expectedEvent = "[{\"time_unix_nano\":${java.util.concurrent.TimeUnit.MILLISECONDS.toNanos(timestamp)},\"name\":\"test-event\",\"attributes\":{\"key1\":\"value1\",\"key2\":123,\"key3\":[1.1,2.2,3.3]}}]"
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No need to use fully qualified name.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍

def actual = genericAdapter.fromJson(jsonStr)
def actualSpan = actual[0]

// Verify basic span fields
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This test looks like an AI generated with unnecessary noise and duplicated code.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I had a hard time getting the test coverage reporter to be happy (it kept saying it was 50% coverage, when the tests pretty much covered everything), so I added more tests than I thought were needed, and I agree some of it seems like too much.

I'll review these and see if can remove the noisy ones.

@@ -136,6 +140,7 @@ private DDSpan(
}

this.links = links == null ? new CopyOnWriteArrayList<>() : new CopyOnWriteArrayList<>(links);
this.events = new CopyOnWriteArrayList<>();
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We should rather not allocate the COW list by default for performance reason

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

Successfully merging this pull request may close these issues.

5 participants