-
Notifications
You must be signed in to change notification settings - Fork 291
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
Improves ServiceNameCollector #8109
Improves ServiceNameCollector #8109
Conversation
Hi! 👋 Thanks for your pull request! 🎉 To help us review it, please make sure to:
If you need help, please check our contributing guidelines. |
internal-api/src/main/java/datadog/trace/api/remoteconfig/ServiceNameCollector.java
Outdated
Show resolved
Hide resolved
…iceNameCollector.java Co-authored-by: Stuart McCulloch <[email protected]>
internal-api/src/main/java/datadog/trace/api/remoteconfig/ServiceNameCollector.java
Outdated
Show resolved
Hide resolved
if (services.isEmpty()) { | ||
return null; | ||
} | ||
final Set<String> uniques = new HashSet<>(services.size()); |
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.
You could also use TreeSet<String>(String.CASE_INSENSITIVE_ORDER);
to avoid the need for any lower-casing
You'd then use Config.get().getServiceName().equalsIgnoreCase(...)
below
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.
Or maybe even
Set<String> uniqueNames = new TreeSet<String>(String.CASE_INSENSITIVE_ORDER);
uniqueNames.addAll(services.keySet());
uniqueNames.remove(Config.get().getServiceName());
return new ArrayList<>(uniqueNames);
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.
It makes completely sense. It's way better. 🤦 I just changed it
BenchmarksStartupParameters
See matching parameters
SummaryFound 0 performance improvements and 0 performance regressions! Performance is the same for 52 metrics, 11 unstable metrics. Startup time reports for insecure-bankgantt
title insecure-bank - global startup overhead: candidate=1.45.0-SNAPSHOT~da89e60163, baseline=1.45.0-SNAPSHOT~a19f73a5ea
dateFormat X
axisFormat %s
section tracing
Agent [baseline] (1.1 s) : 0, 1099959
Total [baseline] (8.684 s) : 0, 8683570
Agent [candidate] (1.095 s) : 0, 1095380
Total [candidate] (8.64 s) : 0, 8640262
section iast
Agent [baseline] (1.22 s) : 0, 1220392
Total [baseline] (9.189 s) : 0, 9188512
Agent [candidate] (1.23 s) : 0, 1230087
Total [candidate] (9.183 s) : 0, 9182749
section iast_HARDCODED_SECRET_DISABLED
Agent [baseline] (1.229 s) : 0, 1228976
Total [baseline] (9.2 s) : 0, 9200084
Agent [candidate] (1.222 s) : 0, 1221974
Total [candidate] (9.167 s) : 0, 9167474
section iast_TELEMETRY_OFF
Agent [baseline] (1.218 s) : 0, 1217668
Total [baseline] (9.165 s) : 0, 9165308
Agent [candidate] (1.218 s) : 0, 1217570
Total [candidate] (9.163 s) : 0, 9163278
gantt
title insecure-bank - break down per module: candidate=1.45.0-SNAPSHOT~da89e60163, baseline=1.45.0-SNAPSHOT~a19f73a5ea
dateFormat X
axisFormat %s
section tracing
BytebuddyAgent [baseline] (701.666 ms) : 0, 701666
BytebuddyAgent [candidate] (696.793 ms) : 0, 696793
GlobalTracer [baseline] (317.085 ms) : 0, 317085
GlobalTracer [candidate] (318.831 ms) : 0, 318831
AppSec [baseline] (54.674 ms) : 0, 54674
AppSec [candidate] (55.177 ms) : 0, 55177
Remote Config [baseline] (656.339 µs) : 0, 656
Remote Config [candidate] (715.281 µs) : 0, 715
Telemetry [baseline] (12.06 ms) : 0, 12060
Telemetry [candidate] (10.083 ms) : 0, 10083
section iast
BytebuddyAgent [baseline] (813.116 ms) : 0, 813116
BytebuddyAgent [candidate] (820.571 ms) : 0, 820571
GlobalTracer [baseline] (305.629 ms) : 0, 305629
GlobalTracer [candidate] (308.059 ms) : 0, 308059
AppSec [baseline] (55.297 ms) : 0, 55297
AppSec [candidate] (57.627 ms) : 0, 57627
IAST [baseline] (24.51 ms) : 0, 24510
IAST [candidate] (21.829 ms) : 0, 21829
Remote Config [baseline] (609.964 µs) : 0, 610
Remote Config [candidate] (618.293 µs) : 0, 618
Telemetry [baseline] (7.485 ms) : 0, 7485
Telemetry [candidate] (7.535 ms) : 0, 7535
section iast_HARDCODED_SECRET_DISABLED
BytebuddyAgent [baseline] (819.185 ms) : 0, 819185
BytebuddyAgent [candidate] (814.384 ms) : 0, 814384
GlobalTracer [baseline] (307.419 ms) : 0, 307419
GlobalTracer [candidate] (306.159 ms) : 0, 306159
AppSec [baseline] (57.958 ms) : 0, 57958
AppSec [candidate] (57.621 ms) : 0, 57621
IAST [baseline] (22.384 ms) : 0, 22384
IAST [candidate] (21.903 ms) : 0, 21903
Remote Config [baseline] (628.725 µs) : 0, 629
Remote Config [candidate] (622.268 µs) : 0, 622
Telemetry [baseline] (7.605 ms) : 0, 7605
Telemetry [candidate] (7.514 ms) : 0, 7514
section iast_TELEMETRY_OFF
BytebuddyAgent [baseline] (811.433 ms) : 0, 811433
BytebuddyAgent [candidate] (811.157 ms) : 0, 811157
GlobalTracer [baseline] (305.965 ms) : 0, 305965
GlobalTracer [candidate] (305.933 ms) : 0, 305933
AppSec [baseline] (58.026 ms) : 0, 58026
AppSec [candidate] (58.179 ms) : 0, 58179
IAST [baseline] (20.473 ms) : 0, 20473
IAST [candidate] (20.561 ms) : 0, 20561
Remote Config [baseline] (636.562 µs) : 0, 637
Remote Config [candidate] (606.826 µs) : 0, 607
Telemetry [baseline] (7.365 ms) : 0, 7365
Telemetry [candidate] (7.341 ms) : 0, 7341
Startup time reports for petclinicgantt
title petclinic - global startup overhead: candidate=1.45.0-SNAPSHOT~da89e60163, baseline=1.45.0-SNAPSHOT~a19f73a5ea
dateFormat X
axisFormat %s
section tracing
Agent [baseline] (1.092 s) : 0, 1092435
Total [baseline] (10.457 s) : 0, 10457480
Agent [candidate] (1.092 s) : 0, 1092468
Total [candidate] (10.477 s) : 0, 10477160
section appsec
Agent [baseline] (1.228 s) : 0, 1228429
Total [baseline] (10.71 s) : 0, 10710493
Agent [candidate] (1.229 s) : 0, 1228775
Total [candidate] (10.674 s) : 0, 10674239
section iast
Agent [baseline] (1.222 s) : 0, 1222479
Total [baseline] (11.012 s) : 0, 11011965
Agent [candidate] (1.232 s) : 0, 1231628
Total [candidate] (10.961 s) : 0, 10961489
section profiling
Agent [baseline] (1.319 s) : 0, 1319027
Total [baseline] (10.856 s) : 0, 10855698
Agent [candidate] (1.315 s) : 0, 1314821
Total [candidate] (10.81 s) : 0, 10810408
gantt
title petclinic - break down per module: candidate=1.45.0-SNAPSHOT~da89e60163, baseline=1.45.0-SNAPSHOT~a19f73a5ea
dateFormat X
axisFormat %s
section tracing
BytebuddyAgent [baseline] (696.339 ms) : 0, 696339
BytebuddyAgent [candidate] (696.891 ms) : 0, 696891
GlobalTracer [baseline] (317.119 ms) : 0, 317119
GlobalTracer [candidate] (317.189 ms) : 0, 317189
AppSec [baseline] (54.542 ms) : 0, 54542
AppSec [candidate] (54.662 ms) : 0, 54662
Remote Config [baseline] (663.993 µs) : 0, 664
Remote Config [candidate] (676.545 µs) : 0, 677
Telemetry [baseline] (10.019 ms) : 0, 10019
Telemetry [candidate] (9.284 ms) : 0, 9284
section appsec
BytebuddyAgent [baseline] (714.955 ms) : 0, 714955
BytebuddyAgent [candidate] (713.539 ms) : 0, 713539
GlobalTracer [baseline] (314.157 ms) : 0, 314157
GlobalTracer [candidate] (315.438 ms) : 0, 315438
AppSec [baseline] (166.099 ms) : 0, 166099
AppSec [candidate] (166.93 ms) : 0, 166930
Remote Config [baseline] (659.795 µs) : 0, 660
Remote Config [candidate] (659.578 µs) : 0, 660
Telemetry [baseline] (8.91 ms) : 0, 8910
Telemetry [candidate] (8.489 ms) : 0, 8489
IAST [baseline] (19.721 ms) : 0, 19721
IAST [candidate] (19.927 ms) : 0, 19927
section iast
BytebuddyAgent [baseline] (814.217 ms) : 0, 814217
BytebuddyAgent [candidate] (821.608 ms) : 0, 821608
GlobalTracer [baseline] (306.245 ms) : 0, 306245
GlobalTracer [candidate] (308.49 ms) : 0, 308490
AppSec [baseline] (57.006 ms) : 0, 57006
AppSec [candidate] (57.396 ms) : 0, 57396
Remote Config [baseline] (625.776 µs) : 0, 626
Remote Config [candidate] (624.23 µs) : 0, 624
Telemetry [baseline] (7.553 ms) : 0, 7553
Telemetry [candidate] (7.546 ms) : 0, 7546
IAST [baseline] (23.046 ms) : 0, 23046
IAST [candidate] (22.045 ms) : 0, 22045
section profiling
BytebuddyAgent [baseline] (690.826 ms) : 0, 690826
BytebuddyAgent [candidate] (688.988 ms) : 0, 688988
GlobalTracer [baseline] (433.925 ms) : 0, 433925
GlobalTracer [candidate] (431.623 ms) : 0, 431623
AppSec [baseline] (53.436 ms) : 0, 53436
AppSec [candidate] (53.337 ms) : 0, 53337
Remote Config [baseline] (680.901 µs) : 0, 681
Remote Config [candidate] (659.083 µs) : 0, 659
Telemetry [baseline] (8.039 ms) : 0, 8039
Telemetry [candidate] (7.738 ms) : 0, 7738
ProfilingAgent [baseline] (92.884 ms) : 0, 92884
ProfilingAgent [candidate] (93.248 ms) : 0, 93248
Profiling [baseline] (92.907 ms) : 0, 92907
Profiling [candidate] (93.273 ms) : 0, 93273
LoadParameters
See matching parameters
SummaryFound 0 performance improvements and 0 performance regressions! Performance is the same for 11 metrics, 17 unstable metrics. Request duration reports for petclinicgantt
title petclinic - request duration [CI 0.99] : candidate=1.45.0-SNAPSHOT~da89e60163, baseline=1.45.0-SNAPSHOT~a19f73a5ea
dateFormat X
axisFormat %s
section baseline
no_agent (1.347 ms) : 1326, 1367
. : milestone, 1347,
appsec (1.759 ms) : 1734, 1784
. : milestone, 1759,
appsec_no_iast (1.757 ms) : 1733, 1781
. : milestone, 1757,
iast (1.488 ms) : 1465, 1511
. : milestone, 1488,
profiling (1.503 ms) : 1479, 1526
. : milestone, 1503,
tracing (1.462 ms) : 1437, 1487
. : milestone, 1462,
section candidate
no_agent (1.351 ms) : 1331, 1371
. : milestone, 1351,
appsec (1.744 ms) : 1720, 1767
. : milestone, 1744,
appsec_no_iast (1.727 ms) : 1703, 1752
. : milestone, 1727,
iast (1.531 ms) : 1508, 1553
. : milestone, 1531,
profiling (1.49 ms) : 1466, 1513
. : milestone, 1490,
tracing (1.479 ms) : 1455, 1503
. : milestone, 1479,
Request duration reports for insecure-bankgantt
title insecure-bank - request duration [CI 0.99] : candidate=1.45.0-SNAPSHOT~da89e60163, baseline=1.45.0-SNAPSHOT~a19f73a5ea
dateFormat X
axisFormat %s
section baseline
no_agent (371.23 µs) : 350, 392
. : milestone, 371,
iast (487.514 µs) : 466, 509
. : milestone, 488,
iast_FULL (654.326 µs) : 633, 676
. : milestone, 654,
iast_GLOBAL (513.695 µs) : 492, 536
. : milestone, 514,
iast_HARDCODED_SECRET_DISABLED (491.082 µs) : 470, 513
. : milestone, 491,
iast_INACTIVE (446.517 µs) : 425, 468
. : milestone, 447,
iast_TELEMETRY_OFF (482.757 µs) : 461, 504
. : milestone, 483,
tracing (448.646 µs) : 427, 470
. : milestone, 449,
section candidate
no_agent (372.966 µs) : 353, 393
. : milestone, 373,
iast (488.472 µs) : 467, 510
. : milestone, 488,
iast_FULL (649.133 µs) : 628, 671
. : milestone, 649,
iast_GLOBAL (522.313 µs) : 499, 545
. : milestone, 522,
iast_HARDCODED_SECRET_DISABLED (485.267 µs) : 464, 507
. : milestone, 485,
iast_INACTIVE (451.709 µs) : 431, 473
. : milestone, 452,
iast_TELEMETRY_OFF (478.516 µs) : 457, 500
. : milestone, 479,
tracing (446.936 µs) : 426, 468
. : milestone, 447,
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 tomcatgantt
title tomcat - execution time [CI 0.99] : candidate=1.45.0-SNAPSHOT~da89e60163, baseline=1.45.0-SNAPSHOT~a19f73a5ea
dateFormat X
axisFormat %s
section baseline
no_agent (1.471 ms) : 1460, 1483
. : milestone, 1471,
appsec (2.342 ms) : 2301, 2384
. : milestone, 2342,
iast (2.085 ms) : 2032, 2137
. : milestone, 2085,
iast_GLOBAL (2.127 ms) : 2074, 2179
. : milestone, 2127,
profiling (1.959 ms) : 1916, 2001
. : milestone, 1959,
tracing (1.936 ms) : 1895, 1977
. : milestone, 1936,
section candidate
no_agent (1.466 ms) : 1455, 1478
. : milestone, 1466,
appsec (2.343 ms) : 2302, 2384
. : milestone, 2343,
iast (2.081 ms) : 2028, 2133
. : milestone, 2081,
iast_GLOBAL (2.138 ms) : 2085, 2191
. : milestone, 2138,
profiling (1.977 ms) : 1934, 2021
. : milestone, 1977,
tracing (1.922 ms) : 1882, 1962
. : milestone, 1922,
Execution time for biojavagantt
title biojava - execution time [CI 0.99] : candidate=1.45.0-SNAPSHOT~da89e60163, baseline=1.45.0-SNAPSHOT~a19f73a5ea
dateFormat X
axisFormat %s
section baseline
no_agent (14.99 s) : 14990000, 14990000
. : milestone, 14990000,
appsec (14.905 s) : 14905000, 14905000
. : milestone, 14905000,
iast (18.776 s) : 18776000, 18776000
. : milestone, 18776000,
iast_GLOBAL (17.985 s) : 17985000, 17985000
. : milestone, 17985000,
profiling (14.782 s) : 14782000, 14782000
. : milestone, 14782000,
tracing (15.067 s) : 15067000, 15067000
. : milestone, 15067000,
section candidate
no_agent (14.969 s) : 14969000, 14969000
. : milestone, 14969000,
appsec (15.161 s) : 15161000, 15161000
. : milestone, 15161000,
iast (18.847 s) : 18847000, 18847000
. : milestone, 18847000,
iast_GLOBAL (17.739 s) : 17739000, 17739000
. : milestone, 17739000,
profiling (15.07 s) : 15070000, 15070000
. : milestone, 15070000,
tracing (15.105 s) : 15105000, 15105000
. : milestone, 15105000,
|
What Does This Do
ServiceNameCollector.add is called very frequently. This PR aims moving the expensive operations inside it (i.e. string case transformation, default service name deduplication) to the
getServices
method that's called way more infrequentlyMotivation
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]