Add custom ImageNameSubstitutor implementation that rewrites Docker image names to use Datadog’s internal registry registry.ddbuild.io when running in a CI environment.#9679
Conversation
… image names to use Datadog’s internal registry `registry.ddbuild.io` when running in a CI environment.
BenchmarksStartupParameters
See matching parameters
SummaryFound 0 performance improvements and 0 performance regressions! Performance is the same for 62 metrics, 9 unstable metrics. Startup time reports for petclinicgantt
title petclinic - global startup overhead: candidate=1.55.0-SNAPSHOT~f38e41c880, baseline=1.60.0-SNAPSHOT~2fa3c0c243
dateFormat X
axisFormat %s
section tracing
Agent [baseline] (1.062 s) : 0, 1062175
Total [baseline] (10.836 s) : 0, 10836038
Agent [candidate] (1.065 s) : 0, 1065388
Total [candidate] (10.817 s) : 0, 10816613
section appsec
Agent [baseline] (1.245 s) : 0, 1245118
Total [baseline] (11.05 s) : 0, 11049908
Agent [candidate] (1.237 s) : 0, 1236912
Total [candidate] (10.982 s) : 0, 10981608
section iast
Agent [baseline] (1.231 s) : 0, 1231376
Total [baseline] (11.127 s) : 0, 11126763
Agent [candidate] (1.235 s) : 0, 1235356
Total [candidate] (11.155 s) : 0, 11155181
section profiling
Agent [baseline] (1.198 s) : 0, 1198277
Total [baseline] (10.972 s) : 0, 10971606
Agent [candidate] (1.189 s) : 0, 1189251
Total [candidate] (10.843 s) : 0, 10842818
gantt
title petclinic - break down per module: candidate=1.55.0-SNAPSHOT~f38e41c880, baseline=1.60.0-SNAPSHOT~2fa3c0c243
dateFormat X
axisFormat %s
section tracing
crashtracking [baseline] (1.181 ms) : 0, 1181
crashtracking [candidate] (1.205 ms) : 0, 1205
BytebuddyAgent [baseline] (625.721 ms) : 0, 625721
BytebuddyAgent [candidate] (627.705 ms) : 0, 627705
AgentMeter [baseline] (29.072 ms) : 0, 29072
AgentMeter [candidate] (28.978 ms) : 0, 28978
GlobalTracer [baseline] (256.793 ms) : 0, 256793
GlobalTracer [candidate] (257.211 ms) : 0, 257211
AppSec [baseline] (33.001 ms) : 0, 33001
AppSec [candidate] (33.013 ms) : 0, 33013
Debugger [baseline] (66.305 ms) : 0, 66305
Debugger [candidate] (63.928 ms) : 0, 63928
Remote Config [baseline] (603.524 µs) : 0, 604
Remote Config [candidate] (613.403 µs) : 0, 613
Telemetry [baseline] (9.806 ms) : 0, 9806
Telemetry [candidate] (12.072 ms) : 0, 12072
Flare Poller [baseline] (3.731 ms) : 0, 3731
Flare Poller [candidate] (4.605 ms) : 0, 4605
section appsec
crashtracking [baseline] (1.191 ms) : 0, 1191
crashtracking [candidate] (1.178 ms) : 0, 1178
BytebuddyAgent [baseline] (661.504 ms) : 0, 661504
BytebuddyAgent [candidate] (656.588 ms) : 0, 656588
AgentMeter [baseline] (12.044 ms) : 0, 12044
AgentMeter [candidate] (11.952 ms) : 0, 11952
GlobalTracer [baseline] (259.284 ms) : 0, 259284
GlobalTracer [candidate] (257.888 ms) : 0, 257888
AppSec [baseline] (168.583 ms) : 0, 168583
AppSec [candidate] (167.734 ms) : 0, 167734
Debugger [baseline] (67.099 ms) : 0, 67099
Debugger [candidate] (66.344 ms) : 0, 66344
Remote Config [baseline] (665.336 µs) : 0, 665
Remote Config [candidate] (653.144 µs) : 0, 653
Telemetry [baseline] (9.424 ms) : 0, 9424
Telemetry [candidate] (9.486 ms) : 0, 9486
Flare Poller [baseline] (3.705 ms) : 0, 3705
Flare Poller [candidate] (3.713 ms) : 0, 3713
IAST [baseline] (25.578 ms) : 0, 25578
IAST [candidate] (25.434 ms) : 0, 25434
section iast
crashtracking [baseline] (1.191 ms) : 0, 1191
crashtracking [candidate] (1.192 ms) : 0, 1192
BytebuddyAgent [baseline] (796.585 ms) : 0, 796585
BytebuddyAgent [candidate] (799.619 ms) : 0, 799619
AgentMeter [baseline] (11.275 ms) : 0, 11275
AgentMeter [candidate] (11.515 ms) : 0, 11515
GlobalTracer [baseline] (246.667 ms) : 0, 246667
GlobalTracer [candidate] (247.631 ms) : 0, 247631
AppSec [baseline] (34.504 ms) : 0, 34504
AppSec [candidate] (32.652 ms) : 0, 32652
Debugger [baseline] (65.636 ms) : 0, 65636
Debugger [candidate] (67.135 ms) : 0, 67135
Remote Config [baseline] (529.029 µs) : 0, 529
Remote Config [candidate] (536.947 µs) : 0, 537
Telemetry [baseline] (8.628 ms) : 0, 8628
Telemetry [candidate] (8.642 ms) : 0, 8642
Flare Poller [baseline] (3.453 ms) : 0, 3453
Flare Poller [candidate] (3.447 ms) : 0, 3447
IAST [baseline] (26.981 ms) : 0, 26981
IAST [candidate] (26.979 ms) : 0, 26979
section profiling
ProfilingAgent [baseline] (100.959 ms) : 0, 100959
ProfilingAgent [candidate] (99.518 ms) : 0, 99518
crashtracking [baseline] (1.189 ms) : 0, 1189
crashtracking [candidate] (1.183 ms) : 0, 1183
BytebuddyAgent [baseline] (685.884 ms) : 0, 685884
BytebuddyAgent [candidate] (681.361 ms) : 0, 681361
AgentMeter [baseline] (8.585 ms) : 0, 8585
AgentMeter [candidate] (8.503 ms) : 0, 8503
GlobalTracer [baseline] (216.682 ms) : 0, 216682
GlobalTracer [candidate] (215.342 ms) : 0, 215342
AppSec [baseline] (32.952 ms) : 0, 32952
AppSec [candidate] (32.5 ms) : 0, 32500
Debugger [baseline] (67.484 ms) : 0, 67484
Debugger [candidate] (66.851 ms) : 0, 66851
Remote Config [baseline] (635.059 µs) : 0, 635
Remote Config [candidate] (624.948 µs) : 0, 625
Telemetry [baseline] (9.089 ms) : 0, 9089
Telemetry [candidate] (9.022 ms) : 0, 9022
Flare Poller [baseline] (3.901 ms) : 0, 3901
Flare Poller [candidate] (3.753 ms) : 0, 3753
Profiling [baseline] (101.543 ms) : 0, 101543
Profiling [candidate] (100.08 ms) : 0, 100080
Startup time reports for insecure-bankgantt
title insecure-bank - global startup overhead: candidate=1.55.0-SNAPSHOT~f38e41c880, baseline=1.60.0-SNAPSHOT~2fa3c0c243
dateFormat X
axisFormat %s
section tracing
Agent [baseline] (1.072 s) : 0, 1072434
Total [baseline] (8.768 s) : 0, 8768189
Agent [candidate] (1.061 s) : 0, 1060594
Total [candidate] (8.759 s) : 0, 8758540
section iast
Agent [baseline] (1.226 s) : 0, 1226149
Total [baseline] (9.343 s) : 0, 9342721
Agent [candidate] (1.233 s) : 0, 1233253
Total [candidate] (9.382 s) : 0, 9382063
gantt
title insecure-bank - break down per module: candidate=1.55.0-SNAPSHOT~f38e41c880, baseline=1.60.0-SNAPSHOT~2fa3c0c243
dateFormat X
axisFormat %s
section tracing
crashtracking [baseline] (1.212 ms) : 0, 1212
crashtracking [candidate] (1.191 ms) : 0, 1191
BytebuddyAgent [baseline] (632.068 ms) : 0, 632068
BytebuddyAgent [candidate] (625.478 ms) : 0, 625478
AgentMeter [baseline] (29.327 ms) : 0, 29327
AgentMeter [candidate] (28.933 ms) : 0, 28933
GlobalTracer [baseline] (259.344 ms) : 0, 259344
GlobalTracer [candidate] (256.675 ms) : 0, 256675
AppSec [baseline] (33.24 ms) : 0, 33240
AppSec [candidate] (32.839 ms) : 0, 32839
Debugger [baseline] (63.439 ms) : 0, 63439
Debugger [candidate] (63.91 ms) : 0, 63910
Remote Config [baseline] (627.393 µs) : 0, 627
Remote Config [candidate] (610.799 µs) : 0, 611
Telemetry [baseline] (11.573 ms) : 0, 11573
Telemetry [candidate] (8.94 ms) : 0, 8940
Flare Poller [baseline] (5.275 ms) : 0, 5275
Flare Poller [candidate] (5.97 ms) : 0, 5970
section iast
crashtracking [baseline] (1.189 ms) : 0, 1189
crashtracking [candidate] (1.201 ms) : 0, 1201
BytebuddyAgent [baseline] (792.701 ms) : 0, 792701
BytebuddyAgent [candidate] (797.004 ms) : 0, 797004
AgentMeter [baseline] (11.224 ms) : 0, 11224
AgentMeter [candidate] (11.351 ms) : 0, 11351
GlobalTracer [baseline] (246.799 ms) : 0, 246799
GlobalTracer [candidate] (248.649 ms) : 0, 248649
IAST [baseline] (26.865 ms) : 0, 26865
IAST [candidate] (27.291 ms) : 0, 27291
AppSec [baseline] (31.19 ms) : 0, 31190
AppSec [candidate] (34.837 ms) : 0, 34837
Debugger [baseline] (67.828 ms) : 0, 67828
Debugger [candidate] (64.512 ms) : 0, 64512
Remote Config [baseline] (531.313 µs) : 0, 531
Remote Config [candidate] (535.097 µs) : 0, 535
Telemetry [baseline] (8.531 ms) : 0, 8531
Telemetry [candidate] (8.579 ms) : 0, 8579
Flare Poller [baseline] (3.413 ms) : 0, 3413
Flare Poller [candidate] (3.444 ms) : 0, 3444
LoadParameters
See matching parameters
SummaryFound 0 performance improvements and 3 performance regressions! Performance is the same for 18 metrics, 15 unstable metrics.
Request duration reports for petclinicgantt
title petclinic - request duration [CI 0.99] : candidate=1.55.0-SNAPSHOT~f38e41c880, baseline=1.60.0-SNAPSHOT~2fa3c0c243
dateFormat X
axisFormat %s
section baseline
no_agent (18.001 ms) : 17817, 18185
. : milestone, 18001,
appsec (18.519 ms) : 18332, 18706
. : milestone, 18519,
code_origins (17.723 ms) : 17549, 17898
. : milestone, 17723,
iast (17.702 ms) : 17522, 17882
. : milestone, 17702,
profiling (18.78 ms) : 18594, 18966
. : milestone, 18780,
tracing (17.833 ms) : 17655, 18011
. : milestone, 17833,
section candidate
no_agent (18.98 ms) : 18789, 19172
. : milestone, 18980,
appsec (18.605 ms) : 18415, 18796
. : milestone, 18605,
code_origins (19.301 ms) : 19100, 19502
. : milestone, 19301,
iast (17.476 ms) : 17303, 17649
. : milestone, 17476,
profiling (18.601 ms) : 18412, 18790
. : milestone, 18601,
tracing (18.022 ms) : 17845, 18199
. : milestone, 18022,
Request duration reports for insecure-bankgantt
title insecure-bank - request duration [CI 0.99] : candidate=1.55.0-SNAPSHOT~f38e41c880, baseline=1.60.0-SNAPSHOT~2fa3c0c243
dateFormat X
axisFormat %s
section baseline
no_agent (1.184 ms) : 1172, 1195
. : milestone, 1184,
iast (3.26 ms) : 3215, 3305
. : milestone, 3260,
iast_FULL (5.762 ms) : 5704, 5820
. : milestone, 5762,
iast_GLOBAL (3.464 ms) : 3408, 3520
. : milestone, 3464,
profiling (2.109 ms) : 2089, 2129
. : milestone, 2109,
tracing (1.839 ms) : 1823, 1855
. : milestone, 1839,
section candidate
no_agent (1.182 ms) : 1170, 1193
. : milestone, 1182,
iast (3.223 ms) : 3178, 3269
. : milestone, 3223,
iast_FULL (5.707 ms) : 5651, 5763
. : milestone, 5707,
iast_GLOBAL (3.451 ms) : 3400, 3501
. : milestone, 3451,
profiling (1.994 ms) : 1977, 2010
. : milestone, 1994,
tracing (1.819 ms) : 1803, 1835
. : milestone, 1819,
DacapoParameters
See matching parameters
SummaryFound 0 performance improvements and 0 performance regressions! Performance is the same for 10 metrics, 2 unstable metrics. Execution time for tomcatgantt
title tomcat - execution time [CI 0.99] : candidate=1.55.0-SNAPSHOT~f38e41c880, baseline=1.60.0-SNAPSHOT~2fa3c0c243
dateFormat X
axisFormat %s
section baseline
no_agent (1.473 ms) : 1462, 1485
. : milestone, 1473,
appsec (2.508 ms) : 2453, 2564
. : milestone, 2508,
iast (2.248 ms) : 2179, 2317
. : milestone, 2248,
iast_GLOBAL (2.289 ms) : 2219, 2358
. : milestone, 2289,
profiling (2.492 ms) : 2331, 2653
. : milestone, 2492,
tracing (2.068 ms) : 2014, 2122
. : milestone, 2068,
section candidate
no_agent (1.468 ms) : 1456, 1479
. : milestone, 1468,
appsec (3.763 ms) : 3543, 3982
. : milestone, 3763,
iast (2.248 ms) : 2179, 2317
. : milestone, 2248,
iast_GLOBAL (2.295 ms) : 2226, 2365
. : milestone, 2295,
profiling (2.14 ms) : 2081, 2200
. : milestone, 2140,
tracing (2.055 ms) : 2001, 2108
. : milestone, 2055,
Execution time for biojavagantt
title biojava - execution time [CI 0.99] : candidate=1.55.0-SNAPSHOT~f38e41c880, baseline=1.60.0-SNAPSHOT~2fa3c0c243
dateFormat X
axisFormat %s
section baseline
no_agent (15.41 s) : 15410000, 15410000
. : milestone, 15410000,
appsec (14.725 s) : 14725000, 14725000
. : milestone, 14725000,
iast (17.868 s) : 17868000, 17868000
. : milestone, 17868000,
iast_GLOBAL (17.731 s) : 17731000, 17731000
. : milestone, 17731000,
profiling (14.783 s) : 14783000, 14783000
. : milestone, 14783000,
tracing (14.77 s) : 14770000, 14770000
. : milestone, 14770000,
section candidate
no_agent (15.489 s) : 15489000, 15489000
. : milestone, 15489000,
appsec (14.904 s) : 14904000, 14904000
. : milestone, 14904000,
iast (18.06 s) : 18060000, 18060000
. : milestone, 18060000,
iast_GLOBAL (17.709 s) : 17709000, 17709000
. : milestone, 17709000,
profiling (14.805 s) : 14805000, 14805000
. : milestone, 14805000,
tracing (14.762 s) : 14762000, 14762000
. : milestone, 14762000,
|
...a-agent/instrumentation/jdbc/src/test/groovy/test/DataDogRegistryImageNameSubstitutor.groovy
Show resolved
Hide resolved
bric3
left a comment
There was a problem hiding this comment.
Nice improvement !
By the way since our registry mirrors docker hub do you think we could use the mirror of the build image in .gitlab-ci.yaml ? I remember pull failures in our GL runner.
| name = name.replace( | ||
| 'mcr.microsoft.com/mssql/server:', | ||
| 'registry.ddbuild.io/images/mirror/sqlserver:' | ||
| ) |
There was a problem hiding this comment.
thought: For consistency shouldn't we do that for all images. Also while writing this comment I noticed that the prefix is not exactly the same, i.e. one cannot simply replace mcr.microsoft.com by registry.ddbuild.io/images/mirror.
Also, what about logging / printing image names that are unknown ?
| (POSTGRESQL): "jdbc:postgresql://localhost:5432/" + dbName.get(POSTGRESQL), | ||
| (MYSQL) : "jdbc:mysql://localhost:3306/" + dbName.get(MYSQL), | ||
| (SQLSERVER) : "jdbc:sqlserver://localhost:1433/" + dbName.get(SQLSERVER), | ||
| (ORACLE) : "jdbc:oracle:thin:@//localhost:1521/" + dbName.get(ORACLE), |
There was a problem hiding this comment.
| (POSTGRESQL): "jdbc:postgresql://localhost:5432/" + dbName.get(POSTGRESQL), | |
| (MYSQL) : "jdbc:mysql://localhost:3306/" + dbName.get(MYSQL), | |
| (SQLSERVER) : "jdbc:sqlserver://localhost:1433/" + dbName.get(SQLSERVER), | |
| (ORACLE) : "jdbc:oracle:thin:@//localhost:1521/" + dbName.get(ORACLE), | |
| (POSTGRESQL): "jdbc:postgresql://localhost:5432/${dbName.get(POSTGRESQL)}", | |
| (MYSQL) : "jdbc:mysql://localhost:3306/${dbName.get(MYSQL)}", | |
| (SQLSERVER) : "jdbc:sqlserver://localhost:1433/${dbName.get(SQLSERVER)}", | |
| (ORACLE) : "jdbc:oracle:thin:@//localhost:1521/${dbName.get(ORACLE)}", |
| PortUtils.waitForPortToOpen(mysql.getHost(), mysql.getMappedPort(MySQLContainer.MYSQL_PORT), 5, TimeUnit.SECONDS) | ||
| jdbcUrls.put(MYSQL, "${mysql.getJdbcUrl()}") | ||
| sqlserver = new MSSQLServerContainer(MSSQLServerContainer.IMAGE).acceptLicense().withPassword(jdbcPasswords.get(SQLSERVER)) | ||
| sqlserver = new MSSQLServerContainer("mcr.microsoft.com/mssql/server:2022-latest").acceptLicense().withPassword(jdbcPasswords.get(SQLSERVER)) |
There was a problem hiding this comment.
thought: I think it's fine to keep MSSQLServerContainer.IMAGE.
There was a problem hiding this comment.
problem with MSSQLServerContainer.IMAGE that it is resolved as mcr.microsoft.com/mssql/server:latest, that is actually has same SHA as :2022-latest on Microsoft registry:
2022-latest | Docker Image | sha256:b1395aa51b4ec39981883560f1379ea9eba2a1c0719bf8e6477902769316bb79 | 09/11/2025
latest | Docker Image | sha256:b1395aa51b4ec39981883560f1379ea9eba2a1c0719bf8e6477902769316bb79 | 09/11/2025
But on our DataDog mirror we do not have latest image at all...
Although I can try to add it there (will check and update on that).
There was a problem hiding this comment.
Ah got it ! But if the image is different it's not exactly the same test.
It's weird however that the lastest image is not pulled "automatically" by the registry ?.
|
This pull request has been marked as stale because it has not had activity over the past quarter. It will be closed in 7 days if no further activity occurs. Feel free to reopen the PR if you are still working on it. |
What Does This Do
Implements a custom
ImageNameSubstitutorthat rewrites Docker image names to use Datadog’s internal registry (registry.ddbuild.io) when running in a CI environment.Motivation
Improve CI reliability.
Some tests were failing on CI with the following error:
org.testcontainers.containers.ContainerLaunchException: Container startup failed for image mcr.microsoft.com/mssql/server:latest.Datadog’s internal registry mirrors DockerHub images by default (via
TESTCONTAINERS_HUB_IMAGE_NAME_PREFIX), but not images from other registries.By introducing a custom
ImageNameSubstitutor, we can rewrite image names to use our internal registry in CI, ensuring consistent availability and faster pulls.Additional Notes
Tested locally by toggling the
CIenvironment variable:CIis unset, the image is pulled from the Microsoft registry.CIis set, the image is pulled from the internal registry.