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

Full mode for SQL Server #7186

Merged
merged 64 commits into from
Aug 8, 2024
Merged

Full mode for SQL Server #7186

merged 64 commits into from
Aug 8, 2024

Conversation

nenadnoveljic
Copy link
Contributor

@nenadnoveljic nenadnoveljic commented Jun 13, 2024

What Does This Do

Add full APM/DBM mode for SQL Server.

Motivation

A large demand.

Additional Notes

Jira ticket: [PROJ-IDENT]

@nenadnoveljic nenadnoveljic self-assigned this Jun 13, 2024
@pr-commenter
Copy link

pr-commenter bot commented Jun 13, 2024

Benchmarks

Startup

Parameters

Baseline Candidate
baseline_or_candidate baseline candidate
git_branch master nenanoveljic/sqlserver-full
git_commit_date 1723069959 1723090231
git_commit_sha 567c4e9 c3e9fa9
release_version 1.39.0-SNAPSHOT~567c4e978d 1.39.0-SNAPSHOT~c3e9fa9bab
See matching parameters
Baseline Candidate
application insecure-bank insecure-bank
ci_job_date 1723092776 1723092776
ci_job_id 598350062 598350062
ci_pipeline_id 41190107 41190107
cpu_model Intel(R) Xeon(R) Platinum 8259CL CPU @ 2.50GHz Intel(R) Xeon(R) Platinum 8259CL CPU @ 2.50GHz
module Agent Agent
parent None None
variant iast iast

Summary

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

Startup time reports for petclinic
gantt
    title petclinic - global startup overhead: candidate=1.39.0-SNAPSHOT~c3e9fa9bab, baseline=1.39.0-SNAPSHOT~567c4e978d

    dateFormat X
    axisFormat %s
section tracing
Agent [baseline] (1.052 s) : 0, 1052061
Total [baseline] (10.313 s) : 0, 10313273
Agent [candidate] (1.05 s) : 0, 1049807
Total [candidate] (10.291 s) : 0, 10291061
section appsec
Agent [baseline] (1.169 s) : 0, 1169259
Total [baseline] (10.547 s) : 0, 10546531
Agent [candidate] (1.165 s) : 0, 1165355
Total [candidate] (10.468 s) : 0, 10468177
section iast
Agent [baseline] (1.175 s) : 0, 1175004
Total [baseline] (10.734 s) : 0, 10733811
Agent [candidate] (1.171 s) : 0, 1170662
Total [candidate] (10.834 s) : 0, 10834359
section profiling
Agent [baseline] (1.254 s) : 0, 1254473
Total [baseline] (10.629 s) : 0, 10628669
Agent [candidate] (1.244 s) : 0, 1244105
Total [candidate] (10.625 s) : 0, 10625398
Loading
  • baseline results
Module Variant Duration Δ tracing
Agent tracing 1.052 s -
Agent appsec 1.169 s 117.198 ms (11.1%)
Agent iast 1.175 s 122.943 ms (11.7%)
Agent profiling 1.254 s 202.412 ms (19.2%)
Total tracing 10.313 s -
Total appsec 10.547 s 233.259 ms (2.3%)
Total iast 10.734 s 420.539 ms (4.1%)
Total profiling 10.629 s 315.396 ms (3.1%)
  • candidate results
Module Variant Duration Δ tracing
Agent tracing 1.05 s -
Agent appsec 1.165 s 115.548 ms (11.0%)
Agent iast 1.171 s 120.856 ms (11.5%)
Agent profiling 1.244 s 194.299 ms (18.5%)
Total tracing 10.291 s -
Total appsec 10.468 s 177.116 ms (1.7%)
Total iast 10.834 s 543.298 ms (5.3%)
Total profiling 10.625 s 334.337 ms (3.2%)
gantt
    title petclinic - break down per module: candidate=1.39.0-SNAPSHOT~c3e9fa9bab, baseline=1.39.0-SNAPSHOT~567c4e978d

    dateFormat X
    axisFormat %s
section tracing
BytebuddyAgent [baseline] (672.025 ms) : 0, 672025
BytebuddyAgent [candidate] (671.191 ms) : 0, 671191
GlobalTracer [baseline] (308.231 ms) : 0, 308231
GlobalTracer [candidate] (306.664 ms) : 0, 306664
AppSec [baseline] (50.356 ms) : 0, 50356
AppSec [candidate] (50.352 ms) : 0, 50352
Remote Config [baseline] (686.741 µs) : 0, 687
Remote Config [candidate] (691.809 µs) : 0, 692
Telemetry [baseline] (7.254 ms) : 0, 7254
Telemetry [candidate] (7.394 ms) : 0, 7394
section appsec
BytebuddyAgent [baseline] (680.752 ms) : 0, 680752
BytebuddyAgent [candidate] (678.205 ms) : 0, 678205
GlobalTracer [baseline] (301.149 ms) : 0, 301149
GlobalTracer [candidate] (299.037 ms) : 0, 299037
AppSec [baseline] (155.253 ms) : 0, 155253
AppSec [candidate] (155.319 ms) : 0, 155319
Remote Config [baseline] (607.987 µs) : 0, 608
Remote Config [candidate] (599.979 µs) : 0, 600
Telemetry [baseline] (7.269 ms) : 0, 7269
Telemetry [candidate] (7.602 ms) : 0, 7602
IAST [baseline] (21.406 ms) : 0, 21406
IAST [candidate] (22.138 ms) : 0, 22138
section iast
BytebuddyAgent [baseline] (782.807 ms) : 0, 782807
BytebuddyAgent [candidate] (780.715 ms) : 0, 780715
GlobalTracer [baseline] (295.776 ms) : 0, 295776
GlobalTracer [candidate] (294.968 ms) : 0, 294968
AppSec [baseline] (51.464 ms) : 0, 51464
AppSec [candidate] (51.113 ms) : 0, 51113
Remote Config [baseline] (572.789 µs) : 0, 573
Remote Config [candidate] (589.96 µs) : 0, 590
Telemetry [baseline] (7.822 ms) : 0, 7822
Telemetry [candidate] (7.023 ms) : 0, 7023
IAST [baseline] (23.092 ms) : 0, 23092
IAST [candidate] (22.742 ms) : 0, 22742
section profiling
BytebuddyAgent [baseline] (668.835 ms) : 0, 668835
BytebuddyAgent [candidate] (663.661 ms) : 0, 663661
GlobalTracer [baseline] (393.06 ms) : 0, 393060
GlobalTracer [candidate] (389.084 ms) : 0, 389084
AppSec [baseline] (51.844 ms) : 0, 51844
AppSec [candidate] (51.287 ms) : 0, 51287
Remote Config [baseline] (695.527 µs) : 0, 696
Remote Config [candidate] (693.696 µs) : 0, 694
Telemetry [baseline] (7.318 ms) : 0, 7318
Telemetry [candidate] (7.252 ms) : 0, 7252
ProfilingAgent [baseline] (95.278 ms) : 0, 95278
ProfilingAgent [candidate] (94.925 ms) : 0, 94925
Profiling [baseline] (95.303 ms) : 0, 95303
Profiling [candidate] (94.95 ms) : 0, 94950
Loading
Startup time reports for insecure-bank
gantt
    title insecure-bank - global startup overhead: candidate=1.39.0-SNAPSHOT~c3e9fa9bab, baseline=1.39.0-SNAPSHOT~567c4e978d

    dateFormat X
    axisFormat %s
section tracing
Agent [baseline] (1.057 s) : 0, 1056899
Total [baseline] (8.527 s) : 0, 8526787
Agent [candidate] (1.044 s) : 0, 1044020
Total [candidate] (8.467 s) : 0, 8467492
section iast
Agent [baseline] (1.177 s) : 0, 1176579
Total [baseline] (9.024 s) : 0, 9024099
Agent [candidate] (1.185 s) : 0, 1184919
Total [candidate] (9.02 s) : 0, 9020227
section iast_HARDCODED_SECRET_DISABLED
Agent [baseline] (1.177 s) : 0, 1176681
Total [baseline] (8.944 s) : 0, 8943977
Agent [candidate] (1.185 s) : 0, 1184686
Total [candidate] (8.985 s) : 0, 8984587
section iast_TELEMETRY_OFF
Agent [baseline] (1.173 s) : 0, 1172575
Total [baseline] (8.991 s) : 0, 8991466
Agent [candidate] (1.175 s) : 0, 1175423
Total [candidate] (8.951 s) : 0, 8951168
Loading
  • baseline results
Module Variant Duration Δ tracing
Agent tracing 1.057 s -
Agent iast 1.177 s 119.68 ms (11.3%)
Agent iast_HARDCODED_SECRET_DISABLED 1.177 s 119.781 ms (11.3%)
Agent iast_TELEMETRY_OFF 1.173 s 115.676 ms (10.9%)
Total tracing 8.527 s -
Total iast 9.024 s 497.312 ms (5.8%)
Total iast_HARDCODED_SECRET_DISABLED 8.944 s 417.191 ms (4.9%)
Total iast_TELEMETRY_OFF 8.991 s 464.68 ms (5.4%)
  • candidate results
Module Variant Duration Δ tracing
Agent tracing 1.044 s -
Agent iast 1.185 s 140.899 ms (13.5%)
Agent iast_HARDCODED_SECRET_DISABLED 1.185 s 140.666 ms (13.5%)
Agent iast_TELEMETRY_OFF 1.175 s 131.403 ms (12.6%)
Total tracing 8.467 s -
Total iast 9.02 s 552.735 ms (6.5%)
Total iast_HARDCODED_SECRET_DISABLED 8.985 s 517.095 ms (6.1%)
Total iast_TELEMETRY_OFF 8.951 s 483.676 ms (5.7%)
gantt
    title insecure-bank - break down per module: candidate=1.39.0-SNAPSHOT~c3e9fa9bab, baseline=1.39.0-SNAPSHOT~567c4e978d

    dateFormat X
    axisFormat %s
section tracing
BytebuddyAgent [baseline] (673.877 ms) : 0, 673877
BytebuddyAgent [candidate] (666.785 ms) : 0, 666785
GlobalTracer [baseline] (310.497 ms) : 0, 310497
GlobalTracer [candidate] (305.623 ms) : 0, 305623
AppSec [baseline] (50.895 ms) : 0, 50895
AppSec [candidate] (50.221 ms) : 0, 50221
Remote Config [baseline] (704.639 µs) : 0, 705
Remote Config [candidate] (679.07 µs) : 0, 679
Telemetry [baseline] (7.428 ms) : 0, 7428
Telemetry [candidate] (7.286 ms) : 0, 7286
section iast
BytebuddyAgent [baseline] (782.994 ms) : 0, 782994
BytebuddyAgent [candidate] (792.132 ms) : 0, 792132
GlobalTracer [baseline] (296.76 ms) : 0, 296760
GlobalTracer [candidate] (296.537 ms) : 0, 296537
AppSec [baseline] (52.592 ms) : 0, 52592
AppSec [candidate] (52.576 ms) : 0, 52576
IAST [baseline] (22.524 ms) : 0, 22524
IAST [candidate] (22.422 ms) : 0, 22422
Remote Config [baseline] (564.092 µs) : 0, 564
Remote Config [candidate] (581.459 µs) : 0, 581
Telemetry [baseline] (7.652 ms) : 0, 7652
Telemetry [candidate] (7.019 ms) : 0, 7019
section iast_HARDCODED_SECRET_DISABLED
BytebuddyAgent [baseline] (783.017 ms) : 0, 783017
BytebuddyAgent [candidate] (788.549 ms) : 0, 788549
GlobalTracer [baseline] (297.035 ms) : 0, 297035
GlobalTracer [candidate] (299.099 ms) : 0, 299099
AppSec [baseline] (49.966 ms) : 0, 49966
AppSec [candidate] (51.102 ms) : 0, 51102
IAST [baseline] (24.785 ms) : 0, 24785
IAST [candidate] (23.848 ms) : 0, 23848
Remote Config [baseline] (591.78 µs) : 0, 592
Remote Config [candidate] (1.324 ms) : 0, 1324
Telemetry [baseline] (7.781 ms) : 0, 7781
Telemetry [candidate] (7.144 ms) : 0, 7144
section iast_TELEMETRY_OFF
BytebuddyAgent [baseline] (780.402 ms) : 0, 780402
BytebuddyAgent [candidate] (784.287 ms) : 0, 784287
GlobalTracer [baseline] (297.03 ms) : 0, 297030
GlobalTracer [candidate] (297.033 ms) : 0, 297033
AppSec [baseline] (46.746 ms) : 0, 46746
AppSec [candidate] (47.092 ms) : 0, 47092
IAST [baseline] (26.691 ms) : 0, 26691
IAST [candidate] (25.952 ms) : 0, 25952
Remote Config [baseline] (602.53 µs) : 0, 603
Remote Config [candidate] (610.234 µs) : 0, 610
Telemetry [baseline] (7.611 ms) : 0, 7611
Telemetry [candidate] (6.882 ms) : 0, 6882
Loading

Load

Parameters

Baseline Candidate
baseline_or_candidate baseline candidate
end_time 2024-08-08T04:24:51 2024-08-08T04:33:49
git_branch master nenanoveljic/sqlserver-full
git_commit_date 1723069959 1723090231
git_commit_sha 567c4e9 c3e9fa9
release_version 1.39.0-SNAPSHOT~567c4e978d 1.39.0-SNAPSHOT~c3e9fa9bab
start_time 2024-08-08T04:24:35 2024-08-08T04:33:33
See matching parameters
Baseline Candidate
application insecure-bank insecure-bank
ci_job_date 1723092084 1723092084
ci_job_id 598350063 598350063
ci_pipeline_id 41190107 41190107
cpu_model Intel(R) Xeon(R) Platinum 8175M CPU @ 2.50GHz Intel(R) Xeon(R) Platinum 8175M CPU @ 2.50GHz
variant iast iast

Summary

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

Request duration reports for insecure-bank
gantt
    title insecure-bank - request duration [CI 0.99] : candidate=1.39.0-SNAPSHOT~c3e9fa9bab, baseline=1.39.0-SNAPSHOT~567c4e978d
    dateFormat X
    axisFormat %s
section baseline
no_agent (444.242 µs) : 415, 473
.   : milestone, 444,
iast (596.361 µs) : 564, 628
.   : milestone, 596,
iast_FULL (680.72 µs) : 647, 714
.   : milestone, 681,
iast_GLOBAL (614.06 µs) : 581, 647
.   : milestone, 614,
iast_HARDCODED_SECRET_DISABLED (581.218 µs) : 550, 613
.   : milestone, 581,
iast_INACTIVE (551.248 µs) : 518, 584
.   : milestone, 551,
iast_TELEMETRY_OFF (583.858 µs) : 552, 616
.   : milestone, 584,
tracing (534.777 µs) : 505, 564
.   : milestone, 535,
section candidate
no_agent (448.094 µs) : 419, 477
.   : milestone, 448,
iast (587.342 µs) : 555, 619
.   : milestone, 587,
iast_FULL (686.557 µs) : 654, 719
.   : milestone, 687,
iast_GLOBAL (617.216 µs) : 585, 649
.   : milestone, 617,
iast_HARDCODED_SECRET_DISABLED (583.248 µs) : 552, 615
.   : milestone, 583,
iast_INACTIVE (552.342 µs) : 521, 584
.   : milestone, 552,
iast_TELEMETRY_OFF (582.881 µs) : 551, 614
.   : milestone, 583,
tracing (545.357 µs) : 515, 575
.   : milestone, 545,
Loading
  • baseline results
Variant Request duration [CI 0.99] Δ no_agent
no_agent 444.242 µs [415.444 µs, 473.04 µs] -
iast 596.361 µs [564.325 µs, 628.397 µs] 152.119 µs (34.2%)
iast_FULL 680.72 µs [647.261 µs, 714.178 µs] 236.478 µs (53.2%)
iast_GLOBAL 614.06 µs [581.344 µs, 646.775 µs] 169.818 µs (38.2%)
iast_HARDCODED_SECRET_DISABLED 581.218 µs [549.63 µs, 612.805 µs] 136.976 µs (30.8%)
iast_INACTIVE 551.248 µs [518.013 µs, 584.483 µs] 107.006 µs (24.1%)
iast_TELEMETRY_OFF 583.858 µs [551.903 µs, 615.813 µs] 139.615 µs (31.4%)
tracing 534.777 µs [505.116 µs, 564.438 µs] 90.535 µs (20.4%)
  • candidate results
Variant Request duration [CI 0.99] Δ no_agent
no_agent 448.094 µs [419.367 µs, 476.82 µs] -
iast 587.342 µs [555.407 µs, 619.276 µs] 139.248 µs (31.1%)
iast_FULL 686.557 µs [653.779 µs, 719.335 µs] 238.464 µs (53.2%)
iast_GLOBAL 617.216 µs [585.448 µs, 648.983 µs] 169.122 µs (37.7%)
iast_HARDCODED_SECRET_DISABLED 583.248 µs [551.689 µs, 614.808 µs] 135.155 µs (30.2%)
iast_INACTIVE 552.342 µs [520.61 µs, 584.074 µs] 104.248 µs (23.3%)
iast_TELEMETRY_OFF 582.881 µs [551.461 µs, 614.301 µs] 134.787 µs (30.1%)
tracing 545.357 µs [515.421 µs, 575.292 µs] 97.263 µs (21.7%)
Request duration reports for petclinic
gantt
    title petclinic - request duration [CI 0.99] : candidate=1.39.0-SNAPSHOT~c3e9fa9bab, baseline=1.39.0-SNAPSHOT~567c4e978d
    dateFormat X
    axisFormat %s
section baseline
no_agent (1.709 ms) : 1685, 1734
.   : milestone, 1709,
appsec (2.153 ms) : 2123, 2184
.   : milestone, 2153,
appsec_no_iast (2.174 ms) : 2142, 2206
.   : milestone, 2174,
iast (1.844 ms) : 1814, 1874
.   : milestone, 1844,
profiling (1.889 ms) : 1858, 1921
.   : milestone, 1889,
tracing (1.845 ms) : 1814, 1876
.   : milestone, 1845,
section candidate
no_agent (1.719 ms) : 1694, 1743
.   : milestone, 1719,
appsec (2.137 ms) : 2105, 2168
.   : milestone, 2137,
appsec_no_iast (2.155 ms) : 2123, 2186
.   : milestone, 2155,
iast (1.909 ms) : 1880, 1939
.   : milestone, 1909,
profiling (1.881 ms) : 1849, 1913
.   : milestone, 1881,
tracing (1.866 ms) : 1832, 1899
.   : milestone, 1866,
Loading
  • baseline results
Variant Request duration [CI 0.99] Δ no_agent
no_agent 1.709 ms [1.685 ms, 1.734 ms] -
appsec 2.153 ms [2.123 ms, 2.184 ms] 444.1 µs (26.0%)
appsec_no_iast 2.174 ms [2.142 ms, 2.206 ms] 464.818 µs (27.2%)
iast 1.844 ms [1.814 ms, 1.874 ms] 134.864 µs (7.9%)
profiling 1.889 ms [1.858 ms, 1.921 ms] 180.154 µs (10.5%)
tracing 1.845 ms [1.814 ms, 1.876 ms] 136.014 µs (8.0%)
  • candidate results
Variant Request duration [CI 0.99] Δ no_agent
no_agent 1.719 ms [1.694 ms, 1.743 ms] -
appsec 2.137 ms [2.105 ms, 2.168 ms] 417.864 µs (24.3%)
appsec_no_iast 2.155 ms [2.123 ms, 2.186 ms] 435.999 µs (25.4%)
iast 1.909 ms [1.88 ms, 1.939 ms] 190.759 µs (11.1%)
profiling 1.881 ms [1.849 ms, 1.913 ms] 162.558 µs (9.5%)
tracing 1.866 ms [1.832 ms, 1.899 ms] 147.04 µs (8.6%)

Dacapo

Parameters

Baseline Candidate
baseline_or_candidate baseline candidate
git_branch master nenanoveljic/sqlserver-full
git_commit_date 1723069959 1723090231
git_commit_sha 567c4e9 c3e9fa9
release_version 1.39.0-SNAPSHOT~567c4e978d 1.39.0-SNAPSHOT~c3e9fa9bab
See matching parameters
Baseline Candidate
application biojava biojava
ci_job_date 1723092889 1723092889
ci_job_id 598350064 598350064
ci_pipeline_id 41190107 41190107
cpu_model Intel(R) Xeon(R) Platinum 8175M CPU @ 2.50GHz Intel(R) Xeon(R) Platinum 8175M CPU @ 2.50GHz
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.39.0-SNAPSHOT~c3e9fa9bab, baseline=1.39.0-SNAPSHOT~567c4e978d
    dateFormat X
    axisFormat %s
section baseline
no_agent (1.537 ms) : 1525, 1550
.   : milestone, 1537,
appsec (2.704 ms) : 2642, 2766
.   : milestone, 2704,
iast (2.365 ms) : 2291, 2439
.   : milestone, 2365,
iast_GLOBAL (2.427 ms) : 2351, 2502
.   : milestone, 2427,
profiling (2.229 ms) : 2167, 2292
.   : milestone, 2229,
tracing (2.18 ms) : 2120, 2240
.   : milestone, 2180,
section candidate
no_agent (1.541 ms) : 1528, 1554
.   : milestone, 1541,
appsec (2.713 ms) : 2651, 2775
.   : milestone, 2713,
iast (2.328 ms) : 2256, 2399
.   : milestone, 2328,
iast_GLOBAL (2.407 ms) : 2333, 2481
.   : milestone, 2407,
profiling (2.242 ms) : 2177, 2307
.   : milestone, 2242,
tracing (2.17 ms) : 2112, 2229
.   : milestone, 2170,
Loading
  • baseline results
Variant Execution Time [CI 0.99] Δ no_agent
no_agent 1.537 ms [1.525 ms, 1.55 ms] -
appsec 2.704 ms [2.642 ms, 2.766 ms] 1.167 ms (75.9%)
iast 2.365 ms [2.291 ms, 2.439 ms] 827.576 µs (53.8%)
iast_GLOBAL 2.427 ms [2.351 ms, 2.502 ms] 889.282 µs (57.8%)
profiling 2.229 ms [2.167 ms, 2.292 ms] 691.922 µs (45.0%)
tracing 2.18 ms [2.12 ms, 2.24 ms] 642.884 µs (41.8%)
  • candidate results
Variant Execution Time [CI 0.99] Δ no_agent
no_agent 1.541 ms [1.528 ms, 1.554 ms] -
appsec 2.713 ms [2.651 ms, 2.775 ms] 1.172 ms (76.0%)
iast 2.328 ms [2.256 ms, 2.399 ms] 786.423 µs (51.0%)
iast_GLOBAL 2.407 ms [2.333 ms, 2.481 ms] 866.154 µs (56.2%)
profiling 2.242 ms [2.177 ms, 2.307 ms] 701.017 µs (45.5%)
tracing 2.17 ms [2.112 ms, 2.229 ms] 629.055 µs (40.8%)
Execution time for biojava
gantt
    title biojava - execution time [CI 0.99] : candidate=1.39.0-SNAPSHOT~c3e9fa9bab, baseline=1.39.0-SNAPSHOT~567c4e978d
    dateFormat X
    axisFormat %s
section baseline
no_agent (20.308 s) : 20308000, 20308000
.   : milestone, 20308000,
appsec (21.282 s) : 21282000, 21282000
.   : milestone, 21282000,
iast (24.463 s) : 24463000, 24463000
.   : milestone, 24463000,
iast_GLOBAL (25.152 s) : 25152000, 25152000
.   : milestone, 25152000,
profiling (20.492 s) : 20492000, 20492000
.   : milestone, 20492000,
tracing (20.926 s) : 20926000, 20926000
.   : milestone, 20926000,
section candidate
no_agent (20.644 s) : 20644000, 20644000
.   : milestone, 20644000,
appsec (21.659 s) : 21659000, 21659000
.   : milestone, 21659000,
iast (24.275 s) : 24275000, 24275000
.   : milestone, 24275000,
iast_GLOBAL (25.172 s) : 25172000, 25172000
.   : milestone, 25172000,
profiling (20.9 s) : 20900000, 20900000
.   : milestone, 20900000,
tracing (21.376 s) : 21376000, 21376000
.   : milestone, 21376000,
Loading
  • baseline results
Variant Execution Time [CI 0.99] Δ no_agent
no_agent 20.308 s [20.308 s, 20.308 s] -
appsec 21.282 s [21.282 s, 21.282 s] 974.0 ms (4.8%)
iast 24.463 s [24.463 s, 24.463 s] 4.155 s (20.5%)
iast_GLOBAL 25.152 s [25.152 s, 25.152 s] 4.844 s (23.9%)
profiling 20.492 s [20.492 s, 20.492 s] 184.0 ms (0.9%)
tracing 20.926 s [20.926 s, 20.926 s] 618.0 ms (3.0%)
  • candidate results
Variant Execution Time [CI 0.99] Δ no_agent
no_agent 20.644 s [20.644 s, 20.644 s] -
appsec 21.659 s [21.659 s, 21.659 s] 1.015 s (4.9%)
iast 24.275 s [24.275 s, 24.275 s] 3.631 s (17.6%)
iast_GLOBAL 25.172 s [25.172 s, 25.172 s] 4.528 s (21.9%)
profiling 20.9 s [20.9 s, 20.9 s] 256.0 ms (1.2%)
tracing 21.376 s [21.376 s, 21.376 s] 732.0 ms (3.5%)

@nenadnoveljic nenadnoveljic force-pushed the nenanoveljic/sqlserver-full branch 2 times, most recently from 4d0aa82 to 87f47d8 Compare June 14, 2024 14:43
@nenadnoveljic nenadnoveljic marked this pull request as ready for review July 11, 2024 06:26
@nenadnoveljic nenadnoveljic requested review from a team as code owners July 11, 2024 06:26
@nenadnoveljic nenadnoveljic marked this pull request as draft July 11, 2024 06:38
@nenadnoveljic nenadnoveljic marked this pull request as ready for review July 11, 2024 07:58
Copy link
Contributor

@vandonr vandonr left a comment

Choose a reason for hiding this comment

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

LGTM

@vandonr vandonr added comp: database Database Monitoring inst: jdbc JDBC instrumentation labels Jul 24, 2024
Copy link
Contributor

@dougqh dougqh left a comment

Choose a reason for hiding this comment

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

Overall, design is okay.
However, there are injection vulnerabilities and resource leaks that need to be addressed.

@nenadnoveljic
Copy link
Contributor Author

Overall, design is okay. However, there are injection vulnerabilities and resource leaks that need to be addressed.

Fixed now.

@vandonr
Copy link
Contributor

vandonr commented Aug 6, 2024

note that when you force-push, it makes it hard to review what was changed since the last comment.
If you need to update the branch to the latest master, you can merge master to it.

@nenadnoveljic
Copy link
Contributor Author

note that when you force-push, it makes it hard to review what was changed since the last comment. If you need to update the branch to the latest master, you can merge master to it.

Got it & will do it next time.

@vandonr
Copy link
Contributor

vandonr commented Aug 7, 2024

Ok, there are still strings being converted to byte arrays, but honestly I think it's OK.
On the dotnet version, I started working on some code that would generate the bytes directly, you can look at this temp implem:
https://github.com/DataDog/dd-trace-dotnet/blob/5fb6e2e0e6fc6b4b3ada35ca25fd71b650d99020/tracer/src/Datadog.Trace/DatabaseMonitoring/DatabaseMonitoringPropagator.cs#L133-L150

Doug still has a blocking "change requested" btw

@nenadnoveljic
Copy link
Contributor Author

nenadnoveljic commented Aug 7, 2024

Ok, there are still strings being converted to byte arrays, but honestly I think it's OK. On the dotnet version, I started working on some code that would generate the bytes directly, you can look at this temp implem: https://github.com/DataDog/dd-trace-dotnet/blob/5fb6e2e0e6fc6b4b3ada35ca25fd71b650d99020/tracer/src/Datadog.Trace/DatabaseMonitoring/DatabaseMonitoringPropagator.cs#L133-L150

Doug still has a blocking "change requested" btw

ok, i pushed the change to write all the values directly to the stream now. thus, i completely eliminated string conversions.

e);
DECORATE.onError(instrumentationSpan, e);
} finally {
if (instrumentationStatement != null) {
Copy link
Contributor

Choose a reason for hiding this comment

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

If you create a smaller try / finally just around instrumentationStatement, then you won't need the null handling.
But that's a bit of a matter of preference

Copy link
Contributor Author

@nenadnoveljic nenadnoveljic Aug 8, 2024

Choose a reason for hiding this comment

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

I believe we need then another try/catch/finally block, as the code before instrumentationStatement = connection.prepareStatement(instrumentationSql); also can throw exceptions we want to log. This would make the code more verbose. The current approach with the ugly (instrumentationStatement != null) check seems less problematic. What do you prefer?

Copy link
Contributor

Choose a reason for hiding this comment

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

My preference is usually that there's a tight try / finally with the resource acquisition just before the try and the resource disposed of by itself in the finally. This code is mixing the handling of two different resources into the one try / finally structure which can be hard to follow.

} catch (SQLException e) {
}
}
instrumentationSpan.finish();
Copy link
Contributor

Choose a reason for hiding this comment

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

Ideally, finish needs to be in a finally block.
If close raises anything other than a SQLException, the span isn't being finished.

Copy link
Contributor Author

@nenadnoveljic nenadnoveljic Aug 7, 2024

Choose a reason for hiding this comment

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

Can I change } catch (SQLException e) { to } catch (Exception e) {, and leave instrumentationSpan.finish(); where it is, instead? A (small) advantage would be to avoid nesting.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

fixed as described above

Copy link
Contributor

Choose a reason for hiding this comment

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

No, it has to be a finally block. catch ( Exception e ) doesn't catch everything, since there are other classes of Throwables.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I opened a separate PR for this.

Copy link
Contributor

@dougqh dougqh left a comment

Choose a reason for hiding this comment

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

An issue remains where the span may not be properly closed, that should be fixed before this change is checked in.

There's also room for improving the allocation to be lighter, but that's less crucial.

I've gone ahead and approved with the expectation that the span finish problem will be fixed.

@nenadnoveljic nenadnoveljic merged commit bec85d9 into master Aug 8, 2024
80 checks passed
@nenadnoveljic nenadnoveljic deleted the nenanoveljic/sqlserver-full branch August 8, 2024 17:25
@github-actions github-actions bot added this to the 1.39.0 milestone Aug 8, 2024
vandonr added a commit to DataDog/dd-trace-dotnet that referenced this pull request Sep 5, 2024
## Summary of changes

Adding support for `Full` propagation mode for SQL Server when using
DSM.
DSM has 3 modes: disabled, service and full.
Service means that we inject info about the service who sent the query
Full means Service + trace ID and span ID.

## Reason for change

We used to forbid Full mode for sql server because it uses a cache of
query text -> execution plan, and injecting with comments like we did
before would break the cache. (injecting service is OK because it
doesn't change much, so the cache is still OK)
The solution that was found was to use the `context_info` to set the
trace/span ID. It's independant from the query itself, and sets a
"context" for the duration of the session that is visible to DBM when
they sample a "slice" of the DB.
The drawback ofc is that it's an extra query (albeit a fast one) that we
have to run before every "regular" query. It can be slow mostly if the
network is slow. For this reason, we want to cover it with a span to
clearly represent the time being spent there, so that clients can
identify where the time is spent.

## Implementation details

## Test coverage

I added this scenario to the integration test, but since the query is
parameterized, I don't think I can assert easily on the value that is
set.

## Other details

This is the dotnet equivalent of
DataDog/dd-trace-java#7186

---------

Co-authored-by: Lucas Pimentel <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
comp: database Database Monitoring inst: jdbc JDBC instrumentation
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants