Mateusz Rzeszutek afee828846 Use metrics batch API in connection pool instrumentations (#6231) 2 anni fa
..
src afee828846 Use metrics batch API in connection pool instrumentations (#6231) 2 anni fa
README.md ba912bc382 Implement C3P0 connection pool metrics (#6174) 2 anni fa
build.gradle.kts ba912bc382 Implement C3P0 connection pool metrics (#6174) 2 anni fa

README.md

Manual Instrumentation for C3P0

Provides OpenTelemetry instrumentation for C3P0.

Quickstart

Add these dependencies to your project:

Replace OPENTELEMETRY_VERSION with the latest stable release. Minimum version: 1.15.0

For Maven, add to your pom.xml dependencies:


<dependencies>
  <dependency>
    <groupId>io.opentelemetry.instrumentation</groupId>
    <artifactId>opentelemetry-c3p0-0.9</artifactId>
    <version>OPENTELEMETRY_VERSION</version>
  </dependency>
</dependencies>

For Gradle, add to your dependencies:

implementation("io.opentelemetry.instrumentation:opentelemetry-c3p0-0.9:OPENTELEMETRY_VERSION")

Usage

The instrumentation library allows registering PooledDataSource instances for collecting OpenTelemetry-based metrics.

C3p0Telemetry c3p0Telemetry;

void configure(OpenTelemetry openTelemetry, PooledDataSource dataSource) {
  c3p0Telemetry = C3p0Telemetry.create(openTelemetry);
  c3p0Telemetry.registerMetrics(dataSource);
}

void destroy(PooledDataSource dataSource) {
  c3p0Telemetry.unregisterMetrics(dataSource);
}