-
Notifications
You must be signed in to change notification settings - Fork 2.7k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #31567 from michalvavrik/feature/opentelemetry-tra…
…cing-enabled Use a property to enable OpenTelemetry for JDBC and use the OpenTelemetry datasource instead of the OpenTelemetry driver
- Loading branch information
Showing
20 changed files
with
305 additions
and
179 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
13 changes: 13 additions & 0 deletions
13
...ns/agroal/runtime/src/main/java/io/quarkus/agroal/runtime/AgroalOpenTelemetryWrapper.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
package io.quarkus.agroal.runtime; | ||
|
||
import java.util.function.Function; | ||
|
||
import io.agroal.api.AgroalDataSource; | ||
|
||
public class AgroalOpenTelemetryWrapper implements Function<AgroalDataSource, AgroalDataSource> { | ||
|
||
@Override | ||
public AgroalDataSource apply(AgroalDataSource originalDataSource) { | ||
return new OpenTelemetryAgroalDataSource(originalDataSource); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
66 changes: 66 additions & 0 deletions
66
...agroal/runtime/src/main/java/io/quarkus/agroal/runtime/OpenTelemetryAgroalDataSource.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,66 @@ | ||
package io.quarkus.agroal.runtime; | ||
|
||
import java.sql.SQLException; | ||
import java.sql.ShardingKeyBuilder; | ||
import java.util.Collection; | ||
import java.util.List; | ||
|
||
import io.agroal.api.AgroalDataSource; | ||
import io.agroal.api.AgroalDataSourceMetrics; | ||
import io.agroal.api.AgroalPoolInterceptor; | ||
import io.agroal.api.configuration.AgroalDataSourceConfiguration; | ||
import io.opentelemetry.api.GlobalOpenTelemetry; | ||
import io.opentelemetry.instrumentation.jdbc.datasource.OpenTelemetryDataSource; | ||
|
||
/** | ||
* The {@link AgroalDataSource} wrapper that activates OpenTelemetry JDBC instrumentation. | ||
*/ | ||
public class OpenTelemetryAgroalDataSource extends OpenTelemetryDataSource implements AgroalDataSource { | ||
|
||
private final AgroalDataSource delegate; | ||
|
||
public OpenTelemetryAgroalDataSource(AgroalDataSource delegate) { | ||
super(delegate, GlobalOpenTelemetry.get()); | ||
this.delegate = delegate; | ||
} | ||
|
||
@Override | ||
public boolean isHealthy(boolean newConnection) throws SQLException { | ||
return delegate.isHealthy(newConnection); | ||
} | ||
|
||
@Override | ||
public AgroalDataSourceConfiguration getConfiguration() { | ||
return delegate.getConfiguration(); | ||
} | ||
|
||
@Override | ||
public AgroalDataSourceMetrics getMetrics() { | ||
return delegate.getMetrics(); | ||
} | ||
|
||
@Override | ||
public void flush(FlushMode mode) { | ||
delegate.flush(mode); | ||
} | ||
|
||
@Override | ||
public void setPoolInterceptors(Collection<? extends AgroalPoolInterceptor> interceptors) { | ||
delegate.setPoolInterceptors(interceptors); | ||
} | ||
|
||
@Override | ||
public List<AgroalPoolInterceptor> getPoolInterceptors() { | ||
return delegate.getPoolInterceptors(); | ||
} | ||
|
||
@Override | ||
public ShardingKeyBuilder createShardingKeyBuilder() throws SQLException { | ||
return delegate.createShardingKeyBuilder(); | ||
} | ||
|
||
@Override | ||
public void close() { | ||
delegate.close(); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
18 changes: 0 additions & 18 deletions
18
...java/io/quarkus/opentelemetry/deployment/OpenTelemetryDriverJdbcDataSourcesBuildItem.java
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.