Class OpenTelemetryDriver
java.lang.Object
io.opentelemetry.instrumentation.jdbc.OpenTelemetryDriver
- All Implemented Interfaces:
Driver
JDBC driver for OpenTelemetry.
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionbooleanacceptsURL(String url) static voidaddDriverCandidate(Driver driver) Add driver candidate that wasn't registered againstDriverManager.connect(String url, Properties info) static voidAccording to JDBC specification, this driver is registered againstDriverManagerwhen the class is loaded.intintgetPropertyInfo(String url, Properties info) static voidinstall(io.opentelemetry.api.OpenTelemetry openTelemetry) Installs theOpenTelemetryinstance on theOpenTelemetryDriver.static booleanReturnstrueif the driver is registered againstDriverManager.booleanReturns false because not all delegated drivers are JDBC compliant.static voidregister()Register the driver againstDriverManager.static booleanremoveDriverCandidate(Driver driver) Remove driver added viaaddDriverCandidate(Driver).voidsetOpenTelemetry(io.opentelemetry.api.OpenTelemetry openTelemetry) Configures theOpenTelemetry.
-
Constructor Details
-
OpenTelemetryDriver
public OpenTelemetryDriver()
-
-
Method Details
-
register
Register the driver againstDriverManager. This is done automatically when the class is loaded. Dropping the driver from DriverManager's list is possible usingderegister()method.- Throws:
IllegalStateException- if the driver is already registeredSQLException- if registering the driver fails
-
deregister
According to JDBC specification, this driver is registered againstDriverManagerwhen the class is loaded. To avoid leaks, this method allow unregistering the driver so that the class can be gc'ed if necessary.- Throws:
IllegalStateException- if the driver is not registeredSQLException- if deregistering the driver fails
-
isRegistered
public static boolean isRegistered()Returnstrueif the driver is registered againstDriverManager. -
addDriverCandidate
Add driver candidate that wasn't registered againstDriverManager. This is mainly useful when drivers are initialized at native image build time, and you don't want to postpone class initialization, for runtime initialization could make driver incompatible with other systems. Drivers registered with this method have higher priority over those registered againstDriverManager.- Parameters:
driver-Driverthat should be registered
-
removeDriverCandidate
Remove driver added viaaddDriverCandidate(Driver).- Parameters:
driver-Driverthat should be unregistered- Returns:
- true if the driver was unregistered
-
install
public static void install(io.opentelemetry.api.OpenTelemetry openTelemetry) Installs theOpenTelemetryinstance on theOpenTelemetryDriver. OpenTelemetry has to be set before the initialization of the database connection pool. -
setOpenTelemetry
public void setOpenTelemetry(io.opentelemetry.api.OpenTelemetry openTelemetry) Configures theOpenTelemetry. Seeinstall(OpenTelemetry)for simple installation option. OpenTelemetry has to be set before the initialization of the database connection pool. -
connect
- Specified by:
connectin interfaceDriver- Throws:
SQLException
-
acceptsURL
- Specified by:
acceptsURLin interfaceDriver
-
getPropertyInfo
- Specified by:
getPropertyInfoin interfaceDriver- Throws:
SQLException
-
getMajorVersion
public int getMajorVersion()- Specified by:
getMajorVersionin interfaceDriver
-
getMinorVersion
public int getMinorVersion()- Specified by:
getMinorVersionin interfaceDriver
-
jdbcCompliant
public boolean jdbcCompliant()Returns false because not all delegated drivers are JDBC compliant.- Specified by:
jdbcCompliantin interfaceDriver
-
getParentLogger
- Specified by:
getParentLoggerin interfaceDriver- Throws:
SQLFeatureNotSupportedException
-