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 61 metrics, 10 unstable metrics. Startup time reports for petclinicgantt
title petclinic - global startup overhead: candidate=1.55.0-SNAPSHOT~e5e7faffed, baseline=1.60.0-SNAPSHOT~af8b84438c
dateFormat X
axisFormat %s
section tracing
Agent [baseline] (1.065 s) : 0, 1065453
Total [baseline] (10.963 s) : 0, 10963183
Agent [candidate] (1.069 s) : 0, 1068851
Total [candidate] (10.991 s) : 0, 10991239
section appsec
Agent [baseline] (1.25 s) : 0, 1250214
Total [baseline] (11.071 s) : 0, 11071433
Agent [candidate] (1.242 s) : 0, 1242033
Total [candidate] (11.154 s) : 0, 11154500
section iast
Agent [baseline] (1.236 s) : 0, 1236086
Total [baseline] (11.233 s) : 0, 11232916
Agent [candidate] (1.236 s) : 0, 1236225
Total [candidate] (11.132 s) : 0, 11131929
section profiling
Agent [baseline] (1.193 s) : 0, 1192678
Total [baseline] (10.906 s) : 0, 10906000
Agent [candidate] (1.193 s) : 0, 1193410
Total [candidate] (10.977 s) : 0, 10977328
gantt
title petclinic - break down per module: candidate=1.55.0-SNAPSHOT~e5e7faffed, baseline=1.60.0-SNAPSHOT~af8b84438c
dateFormat X
axisFormat %s
section tracing
crashtracking [baseline] (1.205 ms) : 0, 1205
crashtracking [candidate] (1.203 ms) : 0, 1203
BytebuddyAgent [baseline] (628.085 ms) : 0, 628085
BytebuddyAgent [candidate] (628.516 ms) : 0, 628516
AgentMeter [baseline] (29.144 ms) : 0, 29144
AgentMeter [candidate] (29.141 ms) : 0, 29141
GlobalTracer [baseline] (257.905 ms) : 0, 257905
GlobalTracer [candidate] (258.641 ms) : 0, 258641
AppSec [baseline] (32.93 ms) : 0, 32930
AppSec [candidate] (33.115 ms) : 0, 33115
Debugger [baseline] (64.909 ms) : 0, 64909
Debugger [candidate] (66.838 ms) : 0, 66838
Remote Config [baseline] (626.486 µs) : 0, 626
Remote Config [candidate] (623.263 µs) : 0, 623
Telemetry [baseline] (10.757 ms) : 0, 10757
Telemetry [candidate] (9.963 ms) : 0, 9963
Flare Poller [baseline] (3.753 ms) : 0, 3753
Flare Poller [candidate] (4.537 ms) : 0, 4537
section appsec
crashtracking [baseline] (1.203 ms) : 0, 1203
crashtracking [candidate] (1.194 ms) : 0, 1194
BytebuddyAgent [baseline] (663.926 ms) : 0, 663926
BytebuddyAgent [candidate] (658.772 ms) : 0, 658772
AgentMeter [baseline] (12.081 ms) : 0, 12081
AgentMeter [candidate] (12.012 ms) : 0, 12012
GlobalTracer [baseline] (260.68 ms) : 0, 260680
GlobalTracer [candidate] (259.157 ms) : 0, 259157
AppSec [baseline] (169.887 ms) : 0, 169887
AppSec [candidate] (168.346 ms) : 0, 168346
Debugger [baseline] (66.332 ms) : 0, 66332
Debugger [candidate] (67.118 ms) : 0, 67118
Remote Config [baseline] (647.298 µs) : 0, 647
Remote Config [candidate] (669.166 µs) : 0, 669
Telemetry [baseline] (9.495 ms) : 0, 9495
Telemetry [candidate] (9.58 ms) : 0, 9580
Flare Poller [baseline] (3.712 ms) : 0, 3712
Flare Poller [candidate] (3.747 ms) : 0, 3747
IAST [baseline] (25.971 ms) : 0, 25971
IAST [candidate] (25.424 ms) : 0, 25424
section iast
crashtracking [baseline] (1.192 ms) : 0, 1192
crashtracking [candidate] (1.23 ms) : 0, 1230
BytebuddyAgent [baseline] (798.072 ms) : 0, 798072
BytebuddyAgent [candidate] (798.393 ms) : 0, 798393
AgentMeter [baseline] (11.346 ms) : 0, 11346
AgentMeter [candidate] (11.338 ms) : 0, 11338
GlobalTracer [baseline] (248.537 ms) : 0, 248537
GlobalTracer [candidate] (248.837 ms) : 0, 248837
AppSec [baseline] (35.279 ms) : 0, 35279
AppSec [candidate] (34.639 ms) : 0, 34639
Debugger [baseline] (65.925 ms) : 0, 65925
Debugger [candidate] (65.707 ms) : 0, 65707
Remote Config [baseline] (541.463 µs) : 0, 541
Remote Config [candidate] (544.06 µs) : 0, 544
Telemetry [baseline] (8.697 ms) : 0, 8697
Telemetry [candidate] (8.651 ms) : 0, 8651
Flare Poller [baseline] (3.409 ms) : 0, 3409
Flare Poller [candidate] (3.463 ms) : 0, 3463
IAST [baseline] (27.105 ms) : 0, 27105
IAST [candidate] (27.364 ms) : 0, 27364
section profiling
ProfilingAgent [baseline] (99.498 ms) : 0, 99498
ProfilingAgent [candidate] (100.03 ms) : 0, 100030
crashtracking [baseline] (1.191 ms) : 0, 1191
crashtracking [candidate] (1.193 ms) : 0, 1193
BytebuddyAgent [baseline] (682.868 ms) : 0, 682868
BytebuddyAgent [candidate] (683.201 ms) : 0, 683201
AgentMeter [baseline] (8.553 ms) : 0, 8553
AgentMeter [candidate] (8.609 ms) : 0, 8609
GlobalTracer [baseline] (216.285 ms) : 0, 216285
GlobalTracer [candidate] (216.319 ms) : 0, 216319
AppSec [baseline] (32.523 ms) : 0, 32523
AppSec [candidate] (32.596 ms) : 0, 32596
Debugger [baseline] (67.465 ms) : 0, 67465
Debugger [candidate] (67.126 ms) : 0, 67126
Remote Config [baseline] (643.569 µs) : 0, 644
Remote Config [candidate] (633.821 µs) : 0, 634
Telemetry [baseline] (9.08 ms) : 0, 9080
Telemetry [candidate] (9.199 ms) : 0, 9199
Flare Poller [baseline] (3.781 ms) : 0, 3781
Flare Poller [candidate] (3.769 ms) : 0, 3769
Profiling [baseline] (100.089 ms) : 0, 100089
Profiling [candidate] (100.603 ms) : 0, 100603
Startup time reports for insecure-bankgantt
title insecure-bank - global startup overhead: candidate=1.55.0-SNAPSHOT~e5e7faffed, baseline=1.60.0-SNAPSHOT~af8b84438c
dateFormat X
axisFormat %s
section tracing
Agent [baseline] (1.064 s) : 0, 1064334
Total [baseline] (8.721 s) : 0, 8720587
Agent [candidate] (1.066 s) : 0, 1066072
Total [candidate] (8.751 s) : 0, 8750886
section iast
Agent [baseline] (1.275 s) : 0, 1274847
Total [baseline] (9.51 s) : 0, 9510418
Agent [candidate] (1.235 s) : 0, 1234725
Total [candidate] (9.42 s) : 0, 9420398
gantt
title insecure-bank - break down per module: candidate=1.55.0-SNAPSHOT~e5e7faffed, baseline=1.60.0-SNAPSHOT~af8b84438c
dateFormat X
axisFormat %s
section tracing
crashtracking [baseline] (1.2 ms) : 0, 1200
crashtracking [candidate] (1.204 ms) : 0, 1204
BytebuddyAgent [baseline] (626.621 ms) : 0, 626621
BytebuddyAgent [candidate] (628.409 ms) : 0, 628409
AgentMeter [baseline] (29.104 ms) : 0, 29104
AgentMeter [candidate] (29.146 ms) : 0, 29146
GlobalTracer [baseline] (257.398 ms) : 0, 257398
GlobalTracer [candidate] (258.111 ms) : 0, 258111
AppSec [baseline] (33.08 ms) : 0, 33080
AppSec [candidate] (33.078 ms) : 0, 33078
Debugger [baseline] (64.004 ms) : 0, 64004
Debugger [candidate] (63.313 ms) : 0, 63313
Remote Config [baseline] (618.672 µs) : 0, 619
Remote Config [candidate] (632.06 µs) : 0, 632
Telemetry [baseline] (9.191 ms) : 0, 9191
Telemetry [candidate] (11.461 ms) : 0, 11461
Flare Poller [baseline] (6.935 ms) : 0, 6935
Flare Poller [candidate] (4.554 ms) : 0, 4554
section iast
crashtracking [baseline] (1.256 ms) : 0, 1256
crashtracking [candidate] (1.205 ms) : 0, 1205
BytebuddyAgent [baseline] (825.934 ms) : 0, 825934
BytebuddyAgent [candidate] (798.354 ms) : 0, 798354
AgentMeter [baseline] (12.532 ms) : 0, 12532
AgentMeter [candidate] (11.359 ms) : 0, 11359
GlobalTracer [baseline] (254.541 ms) : 0, 254541
GlobalTracer [candidate] (248.736 ms) : 0, 248736
IAST [baseline] (28.129 ms) : 0, 28129
IAST [candidate] (27.089 ms) : 0, 27089
AppSec [baseline] (33.471 ms) : 0, 33471
AppSec [candidate] (33.153 ms) : 0, 33153
Debugger [baseline] (69.428 ms) : 0, 69428
Debugger [candidate] (66.147 ms) : 0, 66147
Remote Config [baseline] (563.886 µs) : 0, 564
Remote Config [candidate] (536.279 µs) : 0, 536
Telemetry [baseline] (8.721 ms) : 0, 8721
Telemetry [candidate] (8.616 ms) : 0, 8616
Flare Poller [baseline] (3.53 ms) : 0, 3530
Flare Poller [candidate] (3.449 ms) : 0, 3449
LoadParameters
See matching parameters
SummaryFound 0 performance improvements and 3 performance regressions! Performance is the same for 17 metrics, 16 unstable metrics.
Request duration reports for insecure-bankgantt
title insecure-bank - request duration [CI 0.99] : candidate=1.55.0-SNAPSHOT~e5e7faffed, baseline=1.60.0-SNAPSHOT~af8b84438c
dateFormat X
axisFormat %s
section baseline
no_agent (1.197 ms) : 1185, 1209
. : milestone, 1197,
iast (3.002 ms) : 2966, 3038
. : milestone, 3002,
iast_FULL (5.912 ms) : 5853, 5972
. : milestone, 5912,
iast_GLOBAL (3.617 ms) : 3558, 3675
. : milestone, 3617,
profiling (2.059 ms) : 2040, 2077
. : milestone, 2059,
tracing (1.861 ms) : 1844, 1878
. : milestone, 1861,
section candidate
no_agent (1.183 ms) : 1172, 1195
. : milestone, 1183,
iast (3.168 ms) : 3125, 3212
. : milestone, 3168,
iast_FULL (5.881 ms) : 5822, 5941
. : milestone, 5881,
iast_GLOBAL (3.479 ms) : 3429, 3530
. : milestone, 3479,
profiling (2.269 ms) : 2250, 2289
. : milestone, 2269,
tracing (1.78 ms) : 1764, 1795
. : milestone, 1780,
Request duration reports for petclinicgantt
title petclinic - request duration [CI 0.99] : candidate=1.55.0-SNAPSHOT~e5e7faffed, baseline=1.60.0-SNAPSHOT~af8b84438c
dateFormat X
axisFormat %s
section baseline
no_agent (17.374 ms) : 17201, 17547
. : milestone, 17374,
appsec (18.749 ms) : 18556, 18941
. : milestone, 18749,
code_origins (17.662 ms) : 17483, 17842
. : milestone, 17662,
iast (17.619 ms) : 17442, 17796
. : milestone, 17619,
profiling (18.308 ms) : 18126, 18491
. : milestone, 18308,
tracing (17.489 ms) : 17318, 17660
. : milestone, 17489,
section candidate
no_agent (19.38 ms) : 19182, 19578
. : milestone, 19380,
appsec (18.858 ms) : 18669, 19047
. : milestone, 18858,
code_origins (17.769 ms) : 17592, 17945
. : milestone, 17769,
iast (17.826 ms) : 17645, 18007
. : milestone, 17826,
profiling (18.582 ms) : 18390, 18774
. : milestone, 18582,
tracing (17.542 ms) : 17370, 17715
. : milestone, 17542,
DacapoParameters
See matching parameters
SummaryFound 1 performance improvements and 0 performance regressions! Performance is the same for 11 metrics, 0 unstable metrics.
Execution time for biojavagantt
title biojava - execution time [CI 0.99] : candidate=1.55.0-SNAPSHOT~e5e7faffed, baseline=1.60.0-SNAPSHOT~af8b84438c
dateFormat X
axisFormat %s
section baseline
no_agent (15.028 s) : 15028000, 15028000
. : milestone, 15028000,
appsec (14.99 s) : 14990000, 14990000
. : milestone, 14990000,
iast (18.215 s) : 18215000, 18215000
. : milestone, 18215000,
iast_GLOBAL (17.885 s) : 17885000, 17885000
. : milestone, 17885000,
profiling (15.123 s) : 15123000, 15123000
. : milestone, 15123000,
tracing (14.515 s) : 14515000, 14515000
. : milestone, 14515000,
section candidate
no_agent (15.525 s) : 15525000, 15525000
. : milestone, 15525000,
appsec (14.757 s) : 14757000, 14757000
. : milestone, 14757000,
iast (17.976 s) : 17976000, 17976000
. : milestone, 17976000,
iast_GLOBAL (17.849 s) : 17849000, 17849000
. : milestone, 17849000,
profiling (15.088 s) : 15088000, 15088000
. : milestone, 15088000,
tracing (14.86 s) : 14860000, 14860000
. : milestone, 14860000,
Execution time for tomcatgantt
title tomcat - execution time [CI 0.99] : candidate=1.55.0-SNAPSHOT~e5e7faffed, baseline=1.60.0-SNAPSHOT~af8b84438c
dateFormat X
axisFormat %s
section baseline
no_agent (1.478 ms) : 1466, 1489
. : milestone, 1478,
appsec (3.787 ms) : 3566, 4008
. : milestone, 3787,
iast (2.244 ms) : 2175, 2313
. : milestone, 2244,
iast_GLOBAL (2.292 ms) : 2222, 2361
. : milestone, 2292,
profiling (2.097 ms) : 2041, 2153
. : milestone, 2097,
tracing (2.052 ms) : 1999, 2106
. : milestone, 2052,
section candidate
no_agent (1.477 ms) : 1465, 1489
. : milestone, 1477,
appsec (2.51 ms) : 2455, 2564
. : milestone, 2510,
iast (2.245 ms) : 2176, 2314
. : milestone, 2245,
iast_GLOBAL (2.292 ms) : 2223, 2362
. : milestone, 2292,
profiling (2.099 ms) : 2043, 2156
. : milestone, 2099,
tracing (2.06 ms) : 2007, 2113
. : milestone, 2060,
|
...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.