Repository: quarkusio/quarkus
Issue: Can't run OpenTelemetry JDBC instrumentation with Quarkus integration tests

### Describe the bug

I'm following the [JDBC example from the OpenTelemetry guide](https://quarkus.io/guides/opentelemetry#jdbc). When I try to integrate it and then run tests using `@QuarkusIntegrationTest` it does not work. Dev services does not adjust the jdbc URL to include the `otel` part. It seems to do that fine when running `@QuarkusTest`s.

### Expected behavior

I would expect to be able to run `@QuarkusIntegrationTests` with OpenTelemetry configured.

### Actual behavior

When running `./mvnw clean verify` with integration tests enabled & the OpenTelemetry JDBC, the Quarkus tests fail. Here is the console output.

You can clearly see from ` Executing "/Users/edeandre/.sdkman/candidates/java/17.0.3-tem/bin/java -Dquarkus.http.port=8081 -Dquarkus.http.ssl-port=8444 -Dtest.url=http://localhost:8081 -Dquarkus.log.file.path=/Users/edeandre/Desktop/temp/opentelemetry-quickstart/target/quarkus.log -Dquarkus.log.file.enable=true -Dquarkus.datasource.password=quarkus -Dquarkus.datasource.db-kind=postgresql -Dquarkus.datasource.jdbc.url=jdbc:postgresql://localhost:51217/default?loggerLevel=OFF -Dquarkus.datasource.username=quarkus -jar /Users/edeandre/Desktop/temp/opentelemetry-quickstart/target/quarkus-app/quarkus-run.jar"` that the `quarkus.datasource.jdbc.url` does not include the `otel` part:

```
[INFO] --- maven-failsafe-plugin:3.0.0-M7:integration-test (default) @ opentelemetry-quickstart ---
[INFO] Using auto detected provider org.apache.maven.surefire.junitplatform.JUnitPlatformProvider
[INFO] 
[INFO] -------------------------------------------------------
[INFO]  T E S T S
[INFO] -------------------------------------------------------
[INFO] Running org.acme.opentelemetry.TracedResourceIT
15:27:48 INFO  traceId=, parentId=, spanId=, sampled= [or.jb.threads] (main) JBoss Threads version 3.4.2.Final
  15:27:49 INFO  traceId=, parentId=, spanId=, sampled= [or.te.do.DockerClientProviderStrategy] (build-11) Loaded org.testcontainers.dockerclient.UnixSocketClientProviderStrategy from ~/.testcontainers.properties, will try it first
  15:27:49 WARN  traceId=, parentId=, spanId=, sampled= [or.te.do.DockerClientProviderStrategy] (build-11) DOCKER_HOST tcp://127.0.0.1:49951 is not listening
  15:27:49 INFO  traceId=, parentId=, spanId=, sampled= [or.te.do.DockerClientProviderStrategy] (build-11) Found Docker environment with local Unix socket (unix:///var/run/docker.sock)
  15:27:49 INFO  traceId=, parentId=, spanId=, sampled= [or.te.DockerClientFactory] (build-11) Docker host IP address is localhost
  15:27:49 INFO  traceId=, parentId=, spanId=, sampled= [or.te.DockerClientFactory] (build-11) Connected to docker: 
  Server Version: 20.10.16
  API Version: 1.41
  Operating System: Docker Desktop
  Total Memory: 5939 MB
  15:27:49 INFO  traceId=, parentId=, spanId=, sampled= [or.te.DockerClientFactory] (build-11) Checking the system...
  15:27:49 INFO  traceId=, parentId=, spanId=, sampled= [or.te.DockerClientFactory] (build-11) ✔︎ Docker server version should be at least 1.6.0
  15:27:49 INFO  traceId=, parentId=, spanId=, sampled= [or.te.ut.ImageNameSubstitutor] (build-11) Image name substitution will be performed by: DefaultImageNameSubstitutor (composite of 'ConfigurationFileImageNameSubstitutor' and 'PrefixingImageNameSubstitutor')
  15:27:49 INFO  traceId=, parentId=, spanId=, sampled= [🐳.io.2]] (build-11) Creating container for image: docker.io/postgres:14.2
  15:27:49 INFO  traceId=, parentId=, spanId=, sampled= [or.te.ut.RegistryAuthLocator] (build-11) Credential helper/store (docker-credential-desktop) does not have credentials for docker.io
  15:27:49 WARN  traceId=, parentId=, spanId=, sampled= [🐳.io.2]] (build-11) Reuse was requested but the environment does not support the reuse of containers
To enable reuse of containers, you must set 'testcontainers.reuse.enable=true' in a file located at /Users/edeandre/.testcontainers.properties
  15:27:49 INFO  traceId=, parentId=, spanId=, sampled= [🐳.io.2]] (build-11) Container docker.io/postgres:14.2 is starting: 9268e329708f5772c844eee81a31de1e24857bfadb7061e4813a26450360c444
  15:27:50 INFO  traceId=, parentId=, spanId=, sampled= [🐳.io.2]] (build-11) Container docker.io/postgres:14.2 started in PT1.258444S
  15:27:50 INFO  traceId=, parentId=, spanId=, sampled= [io.qu.de.po.de.PostgresqlDevServicesProcessor] (build-11) Dev Services for PostgreSQL started.
  15:27:50 INFO  traceId=, parentId=, spanId=, sampled= [io.qu.da.de.de.DevServicesDatasourceProcessor] (build-11) Dev Services for the default datasource (postgresql) started.
  Executing "/Users/edeandre/.sdkman/candidates/java/17.0.3-tem/bin/java -Dquarkus.http.port=8081 -Dquarkus.http.ssl-port=8444 -Dtest.url=http://localhost:8081 -Dquarkus.log.file.path=/Users/edeandre/Desktop/temp/opentelemetry-quickstart/target/quarkus.log -Dquarkus.log.file.enable=true -Dquarkus.datasource.password=quarkus -Dquarkus.datasource.db-kind=postgresql -Dquarkus.datasource.jdbc.url=jdbc:postgresql://localhost:51217/default?loggerLevel=OFF -Dquarkus.datasource.username=quarkus -jar /Users/edeandre/Desktop/temp/opentelemetry-quickstart/target/quarkus-app/quarkus-run.jar"
__  ____  __  _____   ___  __ ____  ______ 
 --/ __ \\/ / / / _ | / _ \\/ //_/ / / / __/ 
 -/ /_/ / /_/ / __ |/ , _/ ,< / /_/ /\\ \\   
--\\___\\_\\____/_/ |_/_/|_/_/|_|\\____/___/   
15:27:51 WARN  traceId=, parentId=, spanId=, sampled= [io.ag.pool] (main) Datasource '<default>': Driver does not support the provided URL: jdbc:postgresql://localhost:51217/default?loggerLevel=OFF
  15:27:51 WARN  traceId=, parentId=, spanId=, sampled= [io.ag.pool] (agroal-11) Datasource '<default>': Driver does not support the provided URL: jdbc:postgresql://localhost:51217/default?loggerLevel=OFF
  15:27:51 WARN  traceId=, parentId=, spanId=, sampled= [or.hi.en.jd.en.in.JdbcEnvironmentInitiator] (JPA Startup Thread: <default>) HHH000342: Could not obtain connection to query metadata: java.sql.SQLException: Driver does not support the provided URL: jdbc:postgresql://localhost:51217/default?loggerLevel=OFF
        at io.agroal.pool.ConnectionFactory.connectionSetup(ConnectionFactory.java:242)
        at io.agroal.pool.ConnectionFactory.createConnection(ConnectionFactory.java:226)
        at io.agroal.pool.ConnectionPool$CreateConnectionTask.call(ConnectionPool.java:535)
        at io.agroal.pool.ConnectionPool$CreateConnectionTask.call(ConnectionPool.java:516)
        at java.base/java.util.concurrent.FutureTask.run(FutureTask.java:264)
        at io.agroal.pool.util.PriorityScheduledExecutor.beforeExecute(PriorityScheduledExecutor.java:75)
        at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1134)
        at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:635)
        at java.base/java.lang.Thread.run(Thread.java:833)

  15:27:51 WARN  traceId=, parentId=, spanId=, sampled= [io.ag.pool] (agroal-11) Datasource '<default>': Driver does not support the provided URL: jdbc:postgresql://localhost:51217/default?loggerLevel=OFF
  15:27:51 WARN  traceId=, parentId=, spanId=, sampled= [or.hi.en.jd.sp.SqlExceptionHelper] (JPA Startup Thread: <default>) SQL Error: 0, SQLState: null
  15:27:51 ERROR traceId=, parentId=, spanId=, sampled= [or.hi.en.jd.sp.SqlExceptionHelper] (JPA Startup Thread: <default>) Driver does not support the provided URL: jdbc:postgresql://localhost:51217/default?loggerLevel=OFF
  15:27:51 ERROR traceId=, parentId=, spanId=, sampled= [io.qu.ru.Application] (main) Failed to start application (with profile prod): java.sql.SQLException: Driver does not support the provided URL: jdbc:postgresql://localhost:51217/default?loggerLevel=OFF
        at io.agroal.pool.ConnectionFactory.connectionSetup(ConnectionFactory.java:242)
        at io.agroal.pool.ConnectionFactory.createConnection(ConnectionFactory.java:226)
        at io.agroal.pool.ConnectionPool$CreateConnectionTask.call(ConnectionPool.java:535)
        at io.agroal.pool.ConnectionPool$CreateConnectionTask.call(ConnectionPool.java:516)
        at java.base/java.util.concurrent.FutureTask.run(FutureTask.java:264)
        at io.agroal.pool.util.PriorityScheduledExecutor.beforeExecute(PriorityScheduledExecutor.java:75)
        at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1134)
        at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:635)
        at java.base/java.lang.Thread.run(Thread.java:833)

  Application was not started: 2022-06-22 15:27:51,354 edeandrea-m1pro quarkus-run.jar[4225] ERROR [io.qua.run.Application] (main) Failed to start application (with profile prod): java.sql.SQLException: Driver does not support the provided URL: jdbc:postgresql://localhost:51217/default?loggerLevel=OFF
```

### How to Reproduce?

Reproducer:
[opentelemetry-quickstart.zip](https://github.com/quarkusio/quarkus/files/8961164/opentelemetry-quickstart.zip)

1. Unzip
2. `cd opentelemetry-quickstart`
3. `./mvnw clean verify` 

### Output of `uname -a` or `ver`

Darwin edeandrea-m1pro 21.5.0 Darwin Kernel Version 21.5.0: Tue Apr 26 21:08:37 PDT 2022; root:xnu-8020.121.3~4/RELEASE_ARM64_T6000 arm64

### Output of `java -version`

```
openjdk version "17.0.3" 2022-04-19
OpenJDK Runtime Environment Temurin-17.0.3+7 (build 17.0.3+7)
OpenJDK 64-Bit Server VM Temurin-17.0.3+7 (build 17.0.3+7, mixed mode)
```

### GraalVM version (if different from Java)

_No response_

### Quarkus version or git rev

2.10.0.Final

### Build tool (ie. output of `mvnw --version` or `gradlew --version`)

```
Apache Maven 3.8.4 (9b656c72d54e5bacbed989b64718c159fe39b537)
Maven home: /Users/edeandre/.m2/wrapper/dists/apache-maven-3.8.4-bin/52ccbt68d252mdldqsfsn03jlf/apache-maven-3.8.4
Java version: 17.0.3, vendor: Eclipse Adoptium, runtime: /Users/edeandre/.sdkman/candidates/java/17.0.3-tem
Default locale: en_US, platform encoding: UTF-8
OS name: "mac os x", version: "12.4", arch: "aarch64", family: "mac"
```

### Additional information

_No response_

Changed files:
extensions/opentelemetry/opentelemetry/runtime/src/main/java/io/quarkus/opentelemetry/runtime/dev/OpenTelemetryDevServicesConfigBuilder.java
extensions/opentelemetry/opentelemetry/deployment/src/main/java/io/quarkus/opentelemetry/deployment/dev/DevServicesOpenTelemetryProcessor.java

diff --git a/extensions/opentelemetry/opentelemetry/deployment/src/main/java/io/quarkus/opentelemetry/deployment/dev/DevServicesOpenTelemetryProcessor.java b/extensions/opentelemetry/opentelemetry/deployment/src/main/java/io/quarkus/opentelemetry/deployment/dev/DevServicesOpenTelemetryProcessor.java
index 8ac7144a4f9..4ce75156be6 100644
--- a/extensions/opentelemetry/opentelemetry/deployment/src/main/java/io/quarkus/opentelemetry/deployment/dev/DevServicesOpenTelemetryProcessor.java
+++ b/extensions/opentelemetry/opentelemetry/deployment/src/main/java/io/quarkus/opentelemetry/deployment/dev/DevServicesOpenTelemetryProcessor.java
@@ -1,11 +1,8 @@
 package io.quarkus.opentelemetry.deployment.dev;
 
-import static io.quarkus.opentelemetry.runtime.dev.OpenTelemetryDevServicesConfigBuilder.OPENTELEMETRY_DEVSERVICES_CONFIG;
-
-import java.io.ByteArrayOutputStream;
+import java.util.HashMap;
 import java.util.Map;
 import java.util.Optional;
-import java.util.Properties;
 
 import org.eclipse.microprofile.config.ConfigProvider;
 import org.eclipse.microprofile.config.ConfigValue;
@@ -14,22 +11,19 @@
 import io.quarkus.deployment.IsNormal;
 import io.quarkus.deployment.annotations.BuildProducer;
 import io.quarkus.deployment.annotations.BuildStep;
-import io.quarkus.deployment.builditem.GeneratedResourceBuildItem;
-import io.quarkus.deployment.builditem.RunTimeConfigBuilderBuildItem;
+import io.quarkus.deployment.builditem.DevServicesAdditionalConfigBuildItem;
 import io.quarkus.deployment.dev.devservices.GlobalDevServicesConfig;
 import io.quarkus.opentelemetry.deployment.OpenTelemetryEnabled;
-import io.quarkus.opentelemetry.runtime.dev.OpenTelemetryDevServicesConfigBuilder;
 
 public class DevServicesOpenTelemetryProcessor {
 
     @BuildStep(onlyIfNot = IsNormal.class, onlyIf = { OpenTelemetryEnabled.class, GlobalDevServicesConfig.Enabled.class })
     void devServicesDatasources(
             Optional<DevServicesDatasourceResultBuildItem> devServicesDatasources,
-            BuildProducer<GeneratedResourceBuildItem> generatedResource,
-            BuildProducer<RunTimeConfigBuilderBuildItem> runtimeConfigBuilder) throws Exception {
+            BuildProducer<DevServicesAdditionalConfigBuildItem> devServicesAdditionalConfig) {
 
         if (devServicesDatasources.isPresent()) {
-            Properties properties = new Properties();
+            Map<String, String> properties = new HashMap<>();
             DevServicesDatasourceResultBuildItem.DbResult defaultDatasource = devServicesDatasources.get()
                     .getDefaultDatasource();
             if (defaultDatasource != null) {
@@ -47,28 +41,20 @@ void devServicesDatasources(
             }
 
             // if we find a dev service datasource and the OTel driver, we rewrite the jdbc url to add the otel prefix
-            for (Map.Entry<Object, Object> property : properties.entrySet()) {
-                String key = (String) property.getKey();
-                String value = (String) property.getValue();
+            for (Map.Entry<String, String> property : properties.entrySet()) {
+                String key = property.getKey();
+                String value = property.getValue();
                 if (key.endsWith(".url") && value.startsWith("jdbc:")) {
                     String driverKey = key.substring(0, key.length() - 4) + ".driver";
                     ConfigValue driverValue = ConfigProvider.getConfig().getConfigValue(driverKey);
                     if (driverValue.getValue() != null
                             && driverValue.getValue().equals("io.opentelemetry.instrumentation.jdbc.OpenTelemetryDriver")) {
-                        properties.put(key, value.replaceFirst("jdbc:", "jdbc:otel:"));
+                        devServicesAdditionalConfig.produce(new DevServicesAdditionalConfigBuildItem(key, key,
+                                value.replaceFirst("jdbc:", "jdbc:otel:"), () -> {
+                                }));
                     }
                 }
             }
-
-            ByteArrayOutputStream out = new ByteArrayOutputStream();
-            properties.store(out, null);
-
-            // write the config with a slightly higher priority then runtime defaults
-            // see io.quarkus.deployment.steps.ConfigGenerationBuildStep#runtimeDefaultsConfig
-            generatedResource
-                    .produce(new GeneratedResourceBuildItem(OPENTELEMETRY_DEVSERVICES_CONFIG, out.toByteArray()));
-            runtimeConfigBuilder
-                    .produce(new RunTimeConfigBuilderBuildItem(OpenTelemetryDevServicesConfigBuilder.class.getName()));
         }
     }
 }
diff --git a/extensions/opentelemetry/opentelemetry/runtime/src/main/java/io/quarkus/opentelemetry/runtime/dev/OpenTelemetryDevServicesConfigBuilder.java b/extensions/opentelemetry/opentelemetry/runtime/src/main/java/io/quarkus/opentelemetry/runtime/dev/OpenTelemetryDevServicesConfigBuilder.java
deleted file mode 100644
index 0895c73fdc9..00000000000
--- a/extensions/opentelemetry/opentelemetry/runtime/src/main/java/io/quarkus/opentelemetry/runtime/dev/OpenTelemetryDevServicesConfigBuilder.java
+++ /dev/null
@@ -1,40 +0,0 @@
-package io.quarkus.opentelemetry.runtime.dev;
-
-import java.io.IOException;
-import java.net.URL;
-
-import org.eclipse.microprofile.config.spi.ConfigSource;
-import org.eclipse.microprofile.config.spi.ConfigSourceProvider;
-
-import io.quarkus.runtime.configuration.ConfigBuilder;
-import io.smallrye.config.AbstractLocationConfigSourceLoader;
-import io.smallrye.config.PropertiesConfigSource;
-import io.smallrye.config.SmallRyeConfigBuilder;
-
-public class OpenTelemetryDevServicesConfigBuilder implements ConfigBuilder {
-    public static final String OPENTELEMETRY_DEVSERVICES_CONFIG = "opentelemetry-devservices-config.properties";
-
-    @Override
-    public SmallRyeConfigBuilder configBuilder(final SmallRyeConfigBuilder builder) {
-        builder.withSources(new DevServicesConfigSourceFactory());
-        return builder;
-    }
-
-    private static class DevServicesConfigSourceFactory extends AbstractLocationConfigSourceLoader
-            implements ConfigSourceProvider {
-        @Override
-        protected String[] getFileExtensions() {
-            return new String[] { "properties" };
-        }
-
-        @Override
-        protected ConfigSource loadConfigSource(final URL url, final int ordinal) throws IOException {
-            return new PropertiesConfigSource(url, ordinal);
-        }
-
-        @Override
-        public Iterable<ConfigSource> getConfigSources(final ClassLoader forClassLoader) {
-            return loadConfigSources(OPENTELEMETRY_DEVSERVICES_CONFIG, Integer.MIN_VALUE + 500);
-        }
-    }
-}