-
Notifications
You must be signed in to change notification settings - Fork 293
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
Add API to capture logs in unit tests #8513
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Dumb question: how is this going to work with parallel test execution? -- not sure we use them though 🤔
utils/test-utils/src/main/java/datadog/trace/test/logging/TestLogCollector.java
Outdated
Show resolved
Hide resolved
@PerfectSlayer This will definitely not work with parallel tests. Best case, the second test that starts, will fail on |
BenchmarksStartupParameters
See matching parameters
SummaryFound 0 performance improvements and 0 performance regressions! Performance is the same for 58 metrics, 5 unstable metrics. Startup time reports for insecure-bankgantt
title insecure-bank - global startup overhead: candidate=1.48.0-SNAPSHOT~e8145ffd98, baseline=1.47.0-SNAPSHOT~a951656fc4
dateFormat X
axisFormat %s
section tracing
Agent [baseline] (1.044 s) : 0, 1043934
Total [baseline] (8.682 s) : 0, 8682256
Agent [candidate] (1.042 s) : 0, 1041705
Total [candidate] (8.664 s) : 0, 8664144
section iast
Agent [baseline] (1.169 s) : 0, 1169226
Total [baseline] (9.205 s) : 0, 9205384
Agent [candidate] (1.172 s) : 0, 1171545
Total [candidate] (9.228 s) : 0, 9228412
section iast_HARDCODED_SECRET_DISABLED
Agent [baseline] (1.174 s) : 0, 1174497
Total [baseline] (9.203 s) : 0, 9202971
Agent [candidate] (1.17 s) : 0, 1169982
Total [candidate] (9.152 s) : 0, 9151919
section iast_TELEMETRY_OFF
Agent [baseline] (1.164 s) : 0, 1164269
Total [baseline] (9.254 s) : 0, 9254214
Agent [candidate] (1.173 s) : 0, 1172842
Total [candidate] (9.252 s) : 0, 9251702
gantt
title insecure-bank - break down per module: candidate=1.48.0-SNAPSHOT~e8145ffd98, baseline=1.47.0-SNAPSHOT~a951656fc4
dateFormat X
axisFormat %s
section tracing
BytebuddyAgent [baseline] (720.237 ms) : 0, 720237
BytebuddyAgent [candidate] (718.161 ms) : 0, 718161
GlobalTracer [baseline] (240.495 ms) : 0, 240495
GlobalTracer [candidate] (239.512 ms) : 0, 239512
AppSec [baseline] (55.911 ms) : 0, 55911
AppSec [candidate] (55.556 ms) : 0, 55556
Remote Config [baseline] (694.788 µs) : 0, 695
Remote Config [candidate] (684.734 µs) : 0, 685
Telemetry [baseline] (11.668 ms) : 0, 11668
Telemetry [candidate] (12.829 ms) : 0, 12829
section iast
BytebuddyAgent [baseline] (835.728 ms) : 0, 835728
BytebuddyAgent [candidate] (836.39 ms) : 0, 836390
GlobalTracer [baseline] (229.863 ms) : 0, 229863
GlobalTracer [candidate] (230.746 ms) : 0, 230746
IAST [baseline] (22.787 ms) : 0, 22787
IAST [candidate] (22.95 ms) : 0, 22950
AppSec [baseline] (56.698 ms) : 0, 56698
AppSec [candidate] (57.159 ms) : 0, 57159
Remote Config [baseline] (609.798 µs) : 0, 610
Remote Config [candidate] (631.977 µs) : 0, 632
Telemetry [baseline] (8.636 ms) : 0, 8636
Telemetry [candidate] (8.785 ms) : 0, 8785
section iast_HARDCODED_SECRET_DISABLED
BytebuddyAgent [baseline] (840.298 ms) : 0, 840298
BytebuddyAgent [candidate] (835.849 ms) : 0, 835849
GlobalTracer [baseline] (230.055 ms) : 0, 230055
GlobalTracer [candidate] (230.509 ms) : 0, 230509
IAST [baseline] (22.903 ms) : 0, 22903
IAST [candidate] (22.621 ms) : 0, 22621
AppSec [baseline] (56.844 ms) : 0, 56844
AppSec [candidate] (56.906 ms) : 0, 56906
Remote Config [baseline] (616.842 µs) : 0, 617
Remote Config [candidate] (612.099 µs) : 0, 612
Telemetry [baseline] (8.734 ms) : 0, 8734
Telemetry [candidate] (8.583 ms) : 0, 8583
section iast_TELEMETRY_OFF
BytebuddyAgent [baseline] (831.584 ms) : 0, 831584
BytebuddyAgent [candidate] (838.089 ms) : 0, 838089
GlobalTracer [baseline] (229.656 ms) : 0, 229656
GlobalTracer [candidate] (230.983 ms) : 0, 230983
IAST [baseline] (24.439 ms) : 0, 24439
IAST [candidate] (24.154 ms) : 0, 24154
AppSec [baseline] (54.543 ms) : 0, 54543
AppSec [candidate] (55.389 ms) : 0, 55389
Remote Config [baseline] (608.517 µs) : 0, 609
Remote Config [candidate] (617.608 µs) : 0, 618
Telemetry [baseline] (8.547 ms) : 0, 8547
Telemetry [candidate] (8.615 ms) : 0, 8615
Startup time reports for petclinicgantt
title petclinic - global startup overhead: candidate=1.48.0-SNAPSHOT~e8145ffd98, baseline=1.47.0-SNAPSHOT~a951656fc4
dateFormat X
axisFormat %s
section tracing
Agent [baseline] (1.042 s) : 0, 1041852
Total [baseline] (10.458 s) : 0, 10458167
Agent [candidate] (1.045 s) : 0, 1044638
Total [candidate] (10.482 s) : 0, 10481993
section appsec
Agent [baseline] (1.183 s) : 0, 1182654
Total [baseline] (10.724 s) : 0, 10723790
Agent [candidate] (1.182 s) : 0, 1181543
Total [candidate] (10.759 s) : 0, 10759029
section iast
Agent [baseline] (1.171 s) : 0, 1171147
Total [baseline] (10.93 s) : 0, 10930378
Agent [candidate] (1.172 s) : 0, 1171600
Total [candidate] (10.989 s) : 0, 10988615
section profiling
Agent [baseline] (1.26 s) : 0, 1259634
Total [baseline] (10.808 s) : 0, 10808269
Agent [candidate] (1.257 s) : 0, 1257191
Total [candidate] (10.875 s) : 0, 10874512
gantt
title petclinic - break down per module: candidate=1.48.0-SNAPSHOT~e8145ffd98, baseline=1.47.0-SNAPSHOT~a951656fc4
dateFormat X
axisFormat %s
section tracing
BytebuddyAgent [baseline] (720.198 ms) : 0, 720198
BytebuddyAgent [candidate] (722.279 ms) : 0, 722279
GlobalTracer [baseline] (240.242 ms) : 0, 240242
GlobalTracer [candidate] (239.738 ms) : 0, 239738
AppSec [baseline] (55.732 ms) : 0, 55732
AppSec [candidate] (55.418 ms) : 0, 55418
Remote Config [baseline] (685.968 µs) : 0, 686
Remote Config [candidate] (682.57 µs) : 0, 683
Telemetry [baseline] (10.067 ms) : 0, 10067
Telemetry [candidate] (11.426 ms) : 0, 11426
section appsec
BytebuddyAgent [baseline] (734.337 ms) : 0, 734337
BytebuddyAgent [candidate] (734.147 ms) : 0, 734147
GlobalTracer [baseline] (236.429 ms) : 0, 236429
GlobalTracer [candidate] (235.509 ms) : 0, 235509
IAST [baseline] (21.742 ms) : 0, 21742
IAST [candidate] (21.565 ms) : 0, 21565
AppSec [baseline] (177.233 ms) : 0, 177233
AppSec [candidate] (176.952 ms) : 0, 176952
Remote Config [baseline] (660.602 µs) : 0, 661
Remote Config [candidate] (658.308 µs) : 0, 658
Telemetry [baseline] (8.312 ms) : 0, 8312
Telemetry [candidate] (8.603 ms) : 0, 8603
section iast
BytebuddyAgent [baseline] (836.964 ms) : 0, 836964
BytebuddyAgent [candidate] (837.09 ms) : 0, 837090
GlobalTracer [baseline] (230.765 ms) : 0, 230765
GlobalTracer [candidate] (230.126 ms) : 0, 230126
IAST [baseline] (22.63 ms) : 0, 22630
IAST [candidate] (23.018 ms) : 0, 23018
AppSec [baseline] (56.62 ms) : 0, 56620
AppSec [candidate] (57.144 ms) : 0, 57144
Remote Config [baseline] (609.123 µs) : 0, 609
Remote Config [candidate] (620.351 µs) : 0, 620
Telemetry [baseline] (8.616 ms) : 0, 8616
Telemetry [candidate] (8.74 ms) : 0, 8740
section profiling
BytebuddyAgent [baseline] (708.792 ms) : 0, 708792
BytebuddyAgent [candidate] (707.672 ms) : 0, 707672
GlobalTracer [baseline] (349.788 ms) : 0, 349788
GlobalTracer [candidate] (349.658 ms) : 0, 349658
AppSec [baseline] (55.199 ms) : 0, 55199
AppSec [candidate] (54.446 ms) : 0, 54446
Remote Config [baseline] (676.935 µs) : 0, 677
Remote Config [candidate] (665.867 µs) : 0, 666
Telemetry [baseline] (9.03 ms) : 0, 9030
Telemetry [candidate] (9.013 ms) : 0, 9013
ProfilingAgent [baseline] (95.702 ms) : 0, 95702
ProfilingAgent [candidate] (95.524 ms) : 0, 95524
Profiling [baseline] (95.726 ms) : 0, 95726
Profiling [candidate] (95.548 ms) : 0, 95548
LoadParameters
See matching parameters
SummaryFound 0 performance improvements and 0 performance regressions! Performance is the same for 14 metrics, 16 unstable metrics. Request duration reports for insecure-bankgantt
title insecure-bank - request duration [CI 0.99] : candidate=1.48.0-SNAPSHOT~e8145ffd98, baseline=1.47.0-SNAPSHOT~a951656fc4
dateFormat X
axisFormat %s
section baseline
no_agent (383.622 µs) : 364, 403
. : milestone, 384,
iast (512.396 µs) : 491, 534
. : milestone, 512,
iast_FULL (731.986 µs) : 710, 754
. : milestone, 732,
iast_GLOBAL (568.045 µs) : 545, 591
. : milestone, 568,
iast_HARDCODED_SECRET_DISABLED (517.856 µs) : 496, 540
. : milestone, 518,
iast_INACTIVE (464.119 µs) : 443, 485
. : milestone, 464,
iast_TELEMETRY_OFF (503.803 µs) : 481, 527
. : milestone, 504,
tracing (463.061 µs) : 442, 484
. : milestone, 463,
section candidate
no_agent (381.379 µs) : 361, 402
. : milestone, 381,
iast (515.002 µs) : 493, 537
. : milestone, 515,
iast_FULL (734.283 µs) : 712, 756
. : milestone, 734,
iast_GLOBAL (565.555 µs) : 543, 588
. : milestone, 566,
iast_HARDCODED_SECRET_DISABLED (522.322 µs) : 500, 544
. : milestone, 522,
iast_INACTIVE (463.039 µs) : 442, 484
. : milestone, 463,
iast_TELEMETRY_OFF (502.71 µs) : 480, 525
. : milestone, 503,
tracing (463.156 µs) : 442, 485
. : milestone, 463,
Request duration reports for petclinicgantt
title petclinic - request duration [CI 0.99] : candidate=1.48.0-SNAPSHOT~e8145ffd98, baseline=1.47.0-SNAPSHOT~a951656fc4
dateFormat X
axisFormat %s
section baseline
no_agent (1.364 ms) : 1345, 1384
. : milestone, 1364,
appsec (1.724 ms) : 1699, 1748
. : milestone, 1724,
appsec_no_iast (1.734 ms) : 1711, 1758
. : milestone, 1734,
code_origins (1.672 ms) : 1638, 1706
. : milestone, 1672,
iast (1.519 ms) : 1494, 1544
. : milestone, 1519,
profiling (1.568 ms) : 1543, 1592
. : milestone, 1568,
tracing (1.506 ms) : 1482, 1531
. : milestone, 1506,
section candidate
no_agent (1.35 ms) : 1332, 1369
. : milestone, 1350,
appsec (1.738 ms) : 1714, 1762
. : milestone, 1738,
appsec_no_iast (1.75 ms) : 1727, 1773
. : milestone, 1750,
code_origins (1.688 ms) : 1654, 1721
. : milestone, 1688,
iast (1.507 ms) : 1483, 1531
. : milestone, 1507,
profiling (1.534 ms) : 1509, 1560
. : milestone, 1534,
tracing (1.513 ms) : 1488, 1537
. : milestone, 1513,
DacapoParameters
See matching parameters
SummaryFound 0 performance improvements and 0 performance regressions! Performance is the same for 12 metrics, 0 unstable metrics. Execution time for biojavagantt
title biojava - execution time [CI 0.99] : candidate=1.48.0-SNAPSHOT~e8145ffd98, baseline=1.47.0-SNAPSHOT~a951656fc4
dateFormat X
axisFormat %s
section baseline
no_agent (15.355 s) : 15355000, 15355000
. : milestone, 15355000,
appsec (14.892 s) : 14892000, 14892000
. : milestone, 14892000,
iast (18.85 s) : 18850000, 18850000
. : milestone, 18850000,
iast_GLOBAL (18.121 s) : 18121000, 18121000
. : milestone, 18121000,
profiling (14.971 s) : 14971000, 14971000
. : milestone, 14971000,
tracing (15.159 s) : 15159000, 15159000
. : milestone, 15159000,
section candidate
no_agent (15.448 s) : 15448000, 15448000
. : milestone, 15448000,
appsec (15.167 s) : 15167000, 15167000
. : milestone, 15167000,
iast (18.169 s) : 18169000, 18169000
. : milestone, 18169000,
iast_GLOBAL (18.095 s) : 18095000, 18095000
. : milestone, 18095000,
profiling (15.241 s) : 15241000, 15241000
. : milestone, 15241000,
tracing (15.196 s) : 15196000, 15196000
. : milestone, 15196000,
Execution time for tomcatgantt
title tomcat - execution time [CI 0.99] : candidate=1.48.0-SNAPSHOT~e8145ffd98, baseline=1.47.0-SNAPSHOT~a951656fc4
dateFormat X
axisFormat %s
section baseline
no_agent (1.467 ms) : 1456, 1478
. : milestone, 1467,
appsec (2.332 ms) : 2289, 2376
. : milestone, 2332,
iast (2.107 ms) : 2052, 2162
. : milestone, 2107,
iast_GLOBAL (2.148 ms) : 2093, 2203
. : milestone, 2148,
profiling (1.999 ms) : 1954, 2044
. : milestone, 1999,
tracing (1.955 ms) : 1912, 1997
. : milestone, 1955,
section candidate
no_agent (1.471 ms) : 1460, 1483
. : milestone, 1471,
appsec (2.343 ms) : 2299, 2386
. : milestone, 2343,
iast (2.118 ms) : 2063, 2173
. : milestone, 2118,
iast_GLOBAL (2.16 ms) : 2105, 2215
. : milestone, 2160,
profiling (1.972 ms) : 1927, 2016
. : milestone, 1972,
tracing (1.959 ms) : 1917, 2002
. : milestone, 1959,
|
16b9858
to
e8145ff
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM! just one thing, IMHO it's weird to have those same changes in #8510
@jandro996 Yep, I'll rebase that one! |
1 similar comment
@jandro996 Yep, I'll rebase that one! |
What Does This Do
TestLogbackAppender
must be setup insrc/test/resources/logback-test.xml
for the module. There is an integration example in this PR.TestLogCollector
can be used during tests.enable()
is used to start capturing,drainCapturedLogs()
to retrieve captured logs, anddisable()
to stop capturing.enable()
will fail if it was not disabled in the previous step. This should help avoiding tests keeping capture enabled for the rest of the test run.Motivation
Asserting logs, especially in unit test modules where telemetry is not setup and there are no better alternatives.
Additional Notes
Contributor Checklist
type:
and (comp:
orinst:
) labels in addition to any usefull labelsclose
,fix
or any linking keywords when referencing an issue.Use
solves
instead, and assign the PR milestone to the issueJira ticket: [PROJ-IDENT]