-
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 #45359 from brunobat/disable-jdbc-span
Ensure there are no jdbc spans if otel sdk is disabled
- Loading branch information
Showing
19 changed files
with
213 additions
and
25 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
9 changes: 0 additions & 9 deletions
9
extensions/agroal/spi/src/main/java/io/quarkus/agroal/spi/OpenTelemetryInitBuildItem.java
This file was deleted.
Oops, something went wrong.
27 changes: 27 additions & 0 deletions
27
...ons/arc/deployment/src/main/java/io/quarkus/arc/deployment/OpenTelemetrySdkBuildItem.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,27 @@ | ||
package io.quarkus.arc.deployment; | ||
|
||
import java.util.Optional; | ||
|
||
import io.quarkus.builder.item.SimpleBuildItem; | ||
import io.quarkus.runtime.RuntimeValue; | ||
|
||
public final class OpenTelemetrySdkBuildItem extends SimpleBuildItem { | ||
|
||
private final RuntimeValue<Boolean> runtimeEnabled; | ||
|
||
public OpenTelemetrySdkBuildItem(RuntimeValue<Boolean> sdkEnabled) { | ||
this.runtimeEnabled = sdkEnabled; | ||
} | ||
|
||
/** | ||
* True if the OpenTelemetry SDK is enabled at build and runtime. | ||
*/ | ||
public RuntimeValue<Boolean> isRuntimeEnabled() { | ||
return runtimeEnabled; | ||
} | ||
|
||
public static Optional<RuntimeValue<Boolean>> isOtelSdkEnabled(Optional<OpenTelemetrySdkBuildItem> buildItem) { | ||
// optional is empty if the extension is disabled at build time | ||
return buildItem.isPresent() ? Optional.of(buildItem.get().isRuntimeEnabled()) : Optional.empty(); | ||
} | ||
} |
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
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
36 changes: 36 additions & 0 deletions
36
...emetry-jdbc-instrumentation/src/main/java/io/quarkus/it/opentelemetry/model/h2/H2Hit.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,36 @@ | ||
package io.quarkus.it.opentelemetry.model.h2; | ||
|
||
import jakarta.persistence.Entity; | ||
import jakarta.persistence.Id; | ||
|
||
import io.quarkus.hibernate.orm.panache.PanacheEntityBase; | ||
import io.quarkus.it.opentelemetry.model.Hit; | ||
|
||
@Entity | ||
public class H2Hit extends PanacheEntityBase implements Hit { | ||
|
||
@Id | ||
public Long id; | ||
|
||
public String message; | ||
|
||
@Override | ||
public Long getId() { | ||
return id; | ||
} | ||
|
||
@Override | ||
public String getMessage() { | ||
return message; | ||
} | ||
|
||
@Override | ||
public void setId(Long id) { | ||
this.id = id; | ||
} | ||
|
||
@Override | ||
public void setMessage(String message) { | ||
this.message = message; | ||
} | ||
} |
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
52 changes: 52 additions & 0 deletions
52
...dbc-instrumentation/src/test/java/io/quarkus/it/opentelemetry/H2DatabaseTestResource.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,52 @@ | ||
package io.quarkus.it.opentelemetry; | ||
|
||
import java.sql.SQLException; | ||
import java.util.HashMap; | ||
import java.util.Map; | ||
|
||
import org.h2.tools.Server; | ||
|
||
import io.quarkus.test.common.QuarkusTestResourceLifecycleManager; | ||
|
||
public class H2DatabaseTestResource implements QuarkusTestResourceLifecycleManager { | ||
|
||
public static final String QUARKUS_OTEL_SDK_DISABLED = "quarkus.otel.sdk.disabled"; | ||
private Server tcpServer; | ||
private Map<String, String> initProperties; | ||
|
||
@Override | ||
public void init(Map<String, String> initArgs) { | ||
initProperties = initArgs; | ||
} | ||
|
||
@Override | ||
public Map<String, String> start() { | ||
|
||
try { | ||
tcpServer = Server.createTcpServer("-ifNotExists"); | ||
tcpServer.start(); | ||
System.out.println("[INFO] H2 database started in TCP server mode; server status: " + tcpServer.getStatus()); | ||
} catch (SQLException e) { | ||
throw new RuntimeException(e); | ||
} | ||
|
||
Map<String, String> properties = new HashMap<>(initProperties); | ||
properties.put("quarkus.datasource.h2.jdbc.url", "jdbc:h2:tcp://localhost/mem:test"); | ||
properties.put("quarkus.hibernate-orm.h2.database.generation", "drop-and-create"); | ||
properties.put("quarkus.hibernate-orm.postgresql.active", "false"); | ||
properties.put("quarkus.hibernate-orm.oracle.active", "false"); | ||
properties.put("quarkus.hibernate-orm.mariadb.active", "false"); | ||
properties.put("quarkus.hibernate-orm.db2.active", "false"); | ||
|
||
return properties; | ||
} | ||
|
||
@Override | ||
public synchronized void stop() { | ||
if (tcpServer != null) { | ||
tcpServer.stop(); | ||
System.out.println("[INFO] H2 database was shut down; server status: " + tcpServer.getStatus()); | ||
tcpServer = null; | ||
} | ||
} | ||
} |
Oops, something went wrong.