diff --git a/.github/workflows/run-tests.yaml b/.github/workflows/run-tests.yaml index f966a281..620057aa 100644 --- a/.github/workflows/run-tests.yaml +++ b/.github/workflows/run-tests.yaml @@ -16,11 +16,11 @@ jobs: steps: - name: Checkout the repository uses: actions/checkout@v4 - - name: Set up JDK 17 + - name: Set up JDK 21 uses: actions/setup-java@v5 with: distribution: 'oracle' - java-version: '17' + java-version: '21' - name: Cache Maven packages uses: actions/cache@v4 with: diff --git a/README.md b/README.md index 07c7098f..d6a0d6ad 100644 --- a/README.md +++ b/README.md @@ -20,10 +20,12 @@ Each module of this project contains a set of providers.
Complements JFR's own {@code startTime} — preserved for correlation. + */ + @Label("UCP Timestamp (ms)") + private long ucpTimestamp; + + /** Maximum configured pool size */ + @Label("Max Pool Size") + private int maxPoolSize; + + /** Minimum configured pool size */ + @Label("Min Pool Size") + private int minPoolSize; + + /** Current count of borrowed connections */ + @Label("Borrowed Connections") + private int borrowedConnections; + + /** Current count of available connections */ + @Label("Available Connections") + private int availableConnections; + + /** Total active connections (borrowed + available) */ + @Label("Total Connections") + private int totalConnections; + + /** Lifetime count of closed connections */ + @Label("Closed Connections") + private int closedConnections; + + /** Lifetime count of created connections */ + @Label("Created Connections") + private int createdConnections; + + /** Average connection wait time in milliseconds */ + @Label("Average Wait Time (ms)") + @Timespan(Timespan.MILLISECONDS) + private long avgWaitTime; + + /** + * Initializes common fields from UCP event context. + * + * @param ctx event context containing pool metrics + * @throws NullPointerException if ctx is null + */ + protected void initCommonFields(UCPEventContext ctx) { + Objects.requireNonNull(ctx, "UCPEventContext cannot be null"); + + String name = ctx.poolName(); + this.poolName = name != null ? name : ""; + this.ucpTimestamp = ctx.timestamp(); + this.maxPoolSize = ctx.maxPoolSize(); + this.minPoolSize = ctx.minPoolSize(); + this.borrowedConnections = ctx.borrowedConnectionsCount(); + this.availableConnections = ctx.availableConnectionsCount(); + this.totalConnections = ctx.totalConnections(); + this.closedConnections = ctx.closedConnections(); + this.createdConnections = ctx.createdConnections(); + this.avgWaitTime = ctx.getAverageConnectionWaitTime(); + } +} \ No newline at end of file diff --git a/ojdbc-provider-ucp-observability/src/main/java/oracle/ucp/provider/observability/jfr/core/UCPEventFactory.java b/ojdbc-provider-ucp-observability/src/main/java/oracle/ucp/provider/observability/jfr/core/UCPEventFactory.java new file mode 100644 index 00000000..33d1b5f5 --- /dev/null +++ b/ojdbc-provider-ucp-observability/src/main/java/oracle/ucp/provider/observability/jfr/core/UCPEventFactory.java @@ -0,0 +1,127 @@ +/* + ** Copyright (c) 2026 Oracle and/or its affiliates. + ** + ** The Universal Permissive License (UPL), Version 1.0 + ** + ** Subject to the condition set forth below, permission is hereby granted to any + ** person obtaining a copy of this software, associated documentation and/or data + ** (collectively the "Software"), free of charge and under any and all copyright + ** rights in the Software, and any and all patent rights owned or freely + ** licensable by each licensor hereunder covering either (i) the unmodified + ** Software as contributed to or provided by such licensor, or (ii) the Larger + ** Works (as defined below), to deal in both + ** + ** (a) the Software, and + ** (b) any piece of software and/or hardware listed in the lrgrwrks.txt file if + ** one is included with the Software (each a "Larger Work" to which the Software + ** is contributed by such licensors), + ** + ** without restriction, including without limitation the rights to copy, create + ** derivative works of, display, perform, and distribute the Software and make, + ** use, sell, offer for sale, import, export, have made, and have sold the + ** Software and the Larger Work(s), and to sublicense the foregoing rights on + ** either these or other terms. + ** + ** This license is subject to the following condition: + ** The above copyright notice and either this complete permission notice or at + ** a minimum a reference to the UPL must be included in all copies or + ** substantial portions of the Software. + ** + ** THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + ** IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + ** FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + ** AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + ** LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + ** OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + ** SOFTWARE. + */ + +package oracle.ucp.provider.observability.jfr.core; + +import jdk.jfr.Event; +import oracle.ucp.events.core.UCPEventContext; +import oracle.ucp.events.core.UCPEventListener; +import oracle.ucp.provider.observability.jfr.events.connection.*; +import oracle.ucp.provider.observability.jfr.events.lifecycle.*; +import oracle.ucp.provider.observability.jfr.events.maintenance.*; + +import java.util.Objects; +import java.util.logging.Logger; + +/** + * Factory for creating and recording JFR events from UCP operations. + * Maps UCP event types to specific JFR event classes and handles + * recording. + */ +public final class UCPEventFactory { + + private UCPEventFactory() {} + + private static final Logger LOGGER = + Logger.getLogger(UCPEventFactory.class.getName()); + + /** + * Creates a JFR event instance for the specified UCP event type. + * + * @param type UCP event type + * @param ctx event context with pool metrics + * @return configured JFR event, or {@code null} for unrecognized types + * @throws NullPointerException if parameters are null + */ + static Event createEvent( + UCPEventListener.EventType type, UCPEventContext ctx) { + Objects.requireNonNull(type, "EventType cannot be null"); + Objects.requireNonNull(ctx, "UCPEventContext cannot be null"); + + switch (type) { + // Pool Lifecycle Events + case POOL_CREATED: return new PoolCreatedEvent(ctx); + case POOL_STARTING: return new PoolStartingEvent(ctx); + case POOL_STARTED: return new PoolStartedEvent(ctx); + case POOL_STOPPED: return new PoolStoppedEvent(ctx); + case POOL_DESTROYED: return new PoolDestroyedEvent(ctx); + + // Connection Lifecycle Events + case CONNECTION_CREATED: return new ConnectionCreatedEvent(ctx); + case CONNECTION_BORROWED: return new ConnectionBorrowedEvent(ctx); + case CONNECTION_RETURNED: return new ConnectionReturnedEvent(ctx); + case CONNECTION_CLOSED: return new ConnectionClosedEvent(ctx); + + // Maintenance Operations + case POOL_REFRESHED: return new PoolRefreshedEvent(ctx); + case POOL_RECYCLED: return new PoolRecycledEvent(ctx); + case POOL_PURGED: return new PoolPurgedEvent(ctx); + + default: + LOGGER.fine(() -> + "Unrecognized UCP EventType ignored by JFR provider: " + type); + return null; + } + } + + /** + * Creates and records a JFR event for the given UCP operation. + * + *
Skips {@link Event#commit()} when JFR has no active recording for + * this event type, avoiding serialisation overhead on the hot path. + * + * @param type UCP event type to record + * @param ctx event context with pool metrics + * @throws NullPointerException if parameters are null + */ + public static void recordEvent( + UCPEventListener.EventType type, UCPEventContext ctx) { + Objects.requireNonNull(type, "EventType cannot be null"); + Objects.requireNonNull(ctx, "UCPEventContext cannot be null"); + + Event event = createEvent(type, ctx); + + if (event == null) { + return; + } + + if (event.isEnabled()) { + event.commit(); + } + } +} \ No newline at end of file diff --git a/ojdbc-provider-ucp-observability/src/main/java/oracle/ucp/provider/observability/jfr/events/connection/ConnectionBorrowedEvent.java b/ojdbc-provider-ucp-observability/src/main/java/oracle/ucp/provider/observability/jfr/events/connection/ConnectionBorrowedEvent.java new file mode 100644 index 00000000..622e9fb1 --- /dev/null +++ b/ojdbc-provider-ucp-observability/src/main/java/oracle/ucp/provider/observability/jfr/events/connection/ConnectionBorrowedEvent.java @@ -0,0 +1,57 @@ +/* + ** Copyright (c) 2026 Oracle and/or its affiliates. + ** + ** The Universal Permissive License (UPL), Version 1.0 + ** + ** Subject to the condition set forth below, permission is hereby granted to any + ** person obtaining a copy of this software, associated documentation and/or data + ** (collectively the "Software"), free of charge and under any and all copyright + ** rights in the Software, and any and all patent rights owned or freely + ** licensable by each licensor hereunder covering either (i) the unmodified + ** Software as contributed to or provided by such licensor, or (ii) the Larger + ** Works (as defined below), to deal in both + ** + ** (a) the Software, and + ** (b) any piece of software and/or hardware listed in the lrgrwrks.txt file if + ** one is included with the Software (each a "Larger Work" to which the Software + ** is contributed by such licensors), + ** + ** without restriction, including without limitation the rights to copy, create + ** derivative works of, display, perform, and distribute the Software and make, + ** use, sell, offer for sale, import, export, have made, and have sold the + ** Software and the Larger Work(s), and to sublicense the foregoing rights on + ** either these or other terms. + ** + ** This license is subject to the following condition: + ** The above copyright notice and either this complete permission notice or at + ** a minimum a reference to the UPL must be included in all copies or + ** substantial portions of the Software. + ** + ** THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + ** IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + ** FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + ** AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + ** LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + ** OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + ** SOFTWARE. + */ + +package oracle.ucp.provider.observability.jfr.events.connection; + +import jdk.jfr.Category; +import jdk.jfr.Label; +import jdk.jfr.Description; +import jdk.jfr.Name; +import oracle.ucp.events.core.UCPEventContext; +import oracle.ucp.provider.observability.jfr.core.UCPBaseEvent; + +@Name("ucp.ConnectionBorrowed") +@Label("Connection Borrowed") +@Description("Emitted when a connection is borrowed from the pool") +@Category({"UCP Events", "Connection Lifecycle Events"}) +public class ConnectionBorrowedEvent extends UCPBaseEvent { + + public ConnectionBorrowedEvent(UCPEventContext ctx) { + initCommonFields(ctx); + } +} \ No newline at end of file diff --git a/ojdbc-provider-ucp-observability/src/main/java/oracle/ucp/provider/observability/jfr/events/connection/ConnectionClosedEvent.java b/ojdbc-provider-ucp-observability/src/main/java/oracle/ucp/provider/observability/jfr/events/connection/ConnectionClosedEvent.java new file mode 100644 index 00000000..52059252 --- /dev/null +++ b/ojdbc-provider-ucp-observability/src/main/java/oracle/ucp/provider/observability/jfr/events/connection/ConnectionClosedEvent.java @@ -0,0 +1,57 @@ +/* + ** Copyright (c) 2026 Oracle and/or its affiliates. + ** + ** The Universal Permissive License (UPL), Version 1.0 + ** + ** Subject to the condition set forth below, permission is hereby granted to any + ** person obtaining a copy of this software, associated documentation and/or data + ** (collectively the "Software"), free of charge and under any and all copyright + ** rights in the Software, and any and all patent rights owned or freely + ** licensable by each licensor hereunder covering either (i) the unmodified + ** Software as contributed to or provided by such licensor, or (ii) the Larger + ** Works (as defined below), to deal in both + ** + ** (a) the Software, and + ** (b) any piece of software and/or hardware listed in the lrgrwrks.txt file if + ** one is included with the Software (each a "Larger Work" to which the Software + ** is contributed by such licensors), + ** + ** without restriction, including without limitation the rights to copy, create + ** derivative works of, display, perform, and distribute the Software and make, + ** use, sell, offer for sale, import, export, have made, and have sold the + ** Software and the Larger Work(s), and to sublicense the foregoing rights on + ** either these or other terms. + ** + ** This license is subject to the following condition: + ** The above copyright notice and either this complete permission notice or at + ** a minimum a reference to the UPL must be included in all copies or + ** substantial portions of the Software. + ** + ** THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + ** IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + ** FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + ** AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + ** LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + ** OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + ** SOFTWARE. + */ + +package oracle.ucp.provider.observability.jfr.events.connection; + +import jdk.jfr.Category; +import jdk.jfr.Label; +import jdk.jfr.Description; +import jdk.jfr.Name; +import oracle.ucp.events.core.UCPEventContext; +import oracle.ucp.provider.observability.jfr.core.UCPBaseEvent; + +@Name("ucp.ConnectionClosed") +@Label("Connection Closed") +@Description("Emitted when a connection is closed") +@Category({"UCP Events", "Connection Lifecycle Events"}) +public class ConnectionClosedEvent extends UCPBaseEvent { + + public ConnectionClosedEvent(UCPEventContext ctx) { + initCommonFields(ctx); + } +} \ No newline at end of file diff --git a/ojdbc-provider-ucp-observability/src/main/java/oracle/ucp/provider/observability/jfr/events/connection/ConnectionCreatedEvent.java b/ojdbc-provider-ucp-observability/src/main/java/oracle/ucp/provider/observability/jfr/events/connection/ConnectionCreatedEvent.java new file mode 100644 index 00000000..089b6631 --- /dev/null +++ b/ojdbc-provider-ucp-observability/src/main/java/oracle/ucp/provider/observability/jfr/events/connection/ConnectionCreatedEvent.java @@ -0,0 +1,57 @@ +/* + ** Copyright (c) 2026 Oracle and/or its affiliates. + ** + ** The Universal Permissive License (UPL), Version 1.0 + ** + ** Subject to the condition set forth below, permission is hereby granted to any + ** person obtaining a copy of this software, associated documentation and/or data + ** (collectively the "Software"), free of charge and under any and all copyright + ** rights in the Software, and any and all patent rights owned or freely + ** licensable by each licensor hereunder covering either (i) the unmodified + ** Software as contributed to or provided by such licensor, or (ii) the Larger + ** Works (as defined below), to deal in both + ** + ** (a) the Software, and + ** (b) any piece of software and/or hardware listed in the lrgrwrks.txt file if + ** one is included with the Software (each a "Larger Work" to which the Software + ** is contributed by such licensors), + ** + ** without restriction, including without limitation the rights to copy, create + ** derivative works of, display, perform, and distribute the Software and make, + ** use, sell, offer for sale, import, export, have made, and have sold the + ** Software and the Larger Work(s), and to sublicense the foregoing rights on + ** either these or other terms. + ** + ** This license is subject to the following condition: + ** The above copyright notice and either this complete permission notice or at + ** a minimum a reference to the UPL must be included in all copies or + ** substantial portions of the Software. + ** + ** THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + ** IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + ** FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + ** AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + ** LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + ** OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + ** SOFTWARE. + */ + +package oracle.ucp.provider.observability.jfr.events.connection; + +import jdk.jfr.Category; +import jdk.jfr.Label; +import jdk.jfr.Description; +import jdk.jfr.Name; +import oracle.ucp.events.core.UCPEventContext; +import oracle.ucp.provider.observability.jfr.core.UCPBaseEvent; + +@Name("ucp.ConnectionCreated") +@Label("Connection Created") +@Description("Emitted when a new connection is created") +@Category({"UCP Events", "Connection Lifecycle Events"}) +public class ConnectionCreatedEvent extends UCPBaseEvent { + + public ConnectionCreatedEvent(UCPEventContext ctx) { + initCommonFields(ctx); + } +} \ No newline at end of file diff --git a/ojdbc-provider-ucp-observability/src/main/java/oracle/ucp/provider/observability/jfr/events/connection/ConnectionReturnedEvent.java b/ojdbc-provider-ucp-observability/src/main/java/oracle/ucp/provider/observability/jfr/events/connection/ConnectionReturnedEvent.java new file mode 100644 index 00000000..f760f670 --- /dev/null +++ b/ojdbc-provider-ucp-observability/src/main/java/oracle/ucp/provider/observability/jfr/events/connection/ConnectionReturnedEvent.java @@ -0,0 +1,57 @@ +/* + ** Copyright (c) 2026 Oracle and/or its affiliates. + ** + ** The Universal Permissive License (UPL), Version 1.0 + ** + ** Subject to the condition set forth below, permission is hereby granted to any + ** person obtaining a copy of this software, associated documentation and/or data + ** (collectively the "Software"), free of charge and under any and all copyright + ** rights in the Software, and any and all patent rights owned or freely + ** licensable by each licensor hereunder covering either (i) the unmodified + ** Software as contributed to or provided by such licensor, or (ii) the Larger + ** Works (as defined below), to deal in both + ** + ** (a) the Software, and + ** (b) any piece of software and/or hardware listed in the lrgrwrks.txt file if + ** one is included with the Software (each a "Larger Work" to which the Software + ** is contributed by such licensors), + ** + ** without restriction, including without limitation the rights to copy, create + ** derivative works of, display, perform, and distribute the Software and make, + ** use, sell, offer for sale, import, export, have made, and have sold the + ** Software and the Larger Work(s), and to sublicense the foregoing rights on + ** either these or other terms. + ** + ** This license is subject to the following condition: + ** The above copyright notice and either this complete permission notice or at + ** a minimum a reference to the UPL must be included in all copies or + ** substantial portions of the Software. + ** + ** THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + ** IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + ** FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + ** AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + ** LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + ** OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + ** SOFTWARE. + */ + +package oracle.ucp.provider.observability.jfr.events.connection; + +import jdk.jfr.Category; +import jdk.jfr.Label; +import jdk.jfr.Description; +import jdk.jfr.Name; +import oracle.ucp.events.core.UCPEventContext; +import oracle.ucp.provider.observability.jfr.core.UCPBaseEvent; + +@Name("ucp.ConnectionReturned") +@Label("Connection Returned") +@Description("Emitted when a connection is returned to the pool") +@Category({"UCP Events", "Connection Lifecycle Events"}) +public class ConnectionReturnedEvent extends UCPBaseEvent { + + public ConnectionReturnedEvent(UCPEventContext ctx) { + initCommonFields(ctx); + } +} \ No newline at end of file diff --git a/ojdbc-provider-ucp-observability/src/main/java/oracle/ucp/provider/observability/jfr/events/lifecycle/PoolCreatedEvent.java b/ojdbc-provider-ucp-observability/src/main/java/oracle/ucp/provider/observability/jfr/events/lifecycle/PoolCreatedEvent.java new file mode 100644 index 00000000..9c9ff667 --- /dev/null +++ b/ojdbc-provider-ucp-observability/src/main/java/oracle/ucp/provider/observability/jfr/events/lifecycle/PoolCreatedEvent.java @@ -0,0 +1,57 @@ +/* + ** Copyright (c) 2026 Oracle and/or its affiliates. + ** + ** The Universal Permissive License (UPL), Version 1.0 + ** + ** Subject to the condition set forth below, permission is hereby granted to any + ** person obtaining a copy of this software, associated documentation and/or data + ** (collectively the "Software"), free of charge and under any and all copyright + ** rights in the Software, and any and all patent rights owned or freely + ** licensable by each licensor hereunder covering either (i) the unmodified + ** Software as contributed to or provided by such licensor, or (ii) the Larger + ** Works (as defined below), to deal in both + ** + ** (a) the Software, and + ** (b) any piece of software and/or hardware listed in the lrgrwrks.txt file if + ** one is included with the Software (each a "Larger Work" to which the Software + ** is contributed by such licensors), + ** + ** without restriction, including without limitation the rights to copy, create + ** derivative works of, display, perform, and distribute the Software and make, + ** use, sell, offer for sale, import, export, have made, and have sold the + ** Software and the Larger Work(s), and to sublicense the foregoing rights on + ** either these or other terms. + ** + ** This license is subject to the following condition: + ** The above copyright notice and either this complete permission notice or at + ** a minimum a reference to the UPL must be included in all copies or + ** substantial portions of the Software. + ** + ** THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + ** IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + ** FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + ** AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + ** LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + ** OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + ** SOFTWARE. + */ + +package oracle.ucp.provider.observability.jfr.events.lifecycle; + +import jdk.jfr.Category; +import jdk.jfr.Label; +import jdk.jfr.Description; +import jdk.jfr.Name; +import oracle.ucp.events.core.UCPEventContext; +import oracle.ucp.provider.observability.jfr.core.UCPBaseEvent; + +@Name("ucp.PoolCreated") +@Label("Pool Created") +@Description("Emitted when the connection pool is successfully created") +@Category({"UCP Events", "Pool Lifecycle Events"}) +public class PoolCreatedEvent extends UCPBaseEvent { + + public PoolCreatedEvent(UCPEventContext ctx) { + initCommonFields(ctx); + } +} \ No newline at end of file diff --git a/ojdbc-provider-ucp-observability/src/main/java/oracle/ucp/provider/observability/jfr/events/lifecycle/PoolDestroyedEvent.java b/ojdbc-provider-ucp-observability/src/main/java/oracle/ucp/provider/observability/jfr/events/lifecycle/PoolDestroyedEvent.java new file mode 100644 index 00000000..2cbfe7d6 --- /dev/null +++ b/ojdbc-provider-ucp-observability/src/main/java/oracle/ucp/provider/observability/jfr/events/lifecycle/PoolDestroyedEvent.java @@ -0,0 +1,57 @@ +/* + ** Copyright (c) 2026 Oracle and/or its affiliates. + ** + ** The Universal Permissive License (UPL), Version 1.0 + ** + ** Subject to the condition set forth below, permission is hereby granted to any + ** person obtaining a copy of this software, associated documentation and/or data + ** (collectively the "Software"), free of charge and under any and all copyright + ** rights in the Software, and any and all patent rights owned or freely + ** licensable by each licensor hereunder covering either (i) the unmodified + ** Software as contributed to or provided by such licensor, or (ii) the Larger + ** Works (as defined below), to deal in both + ** + ** (a) the Software, and + ** (b) any piece of software and/or hardware listed in the lrgrwrks.txt file if + ** one is included with the Software (each a "Larger Work" to which the Software + ** is contributed by such licensors), + ** + ** without restriction, including without limitation the rights to copy, create + ** derivative works of, display, perform, and distribute the Software and make, + ** use, sell, offer for sale, import, export, have made, and have sold the + ** Software and the Larger Work(s), and to sublicense the foregoing rights on + ** either these or other terms. + ** + ** This license is subject to the following condition: + ** The above copyright notice and either this complete permission notice or at + ** a minimum a reference to the UPL must be included in all copies or + ** substantial portions of the Software. + ** + ** THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + ** IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + ** FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + ** AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + ** LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + ** OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + ** SOFTWARE. + */ + +package oracle.ucp.provider.observability.jfr.events.lifecycle; + +import jdk.jfr.Category; +import jdk.jfr.Label; +import jdk.jfr.Description; +import jdk.jfr.Name; +import oracle.ucp.events.core.UCPEventContext; +import oracle.ucp.provider.observability.jfr.core.UCPBaseEvent; + +@Name("ucp.PoolDestroyed") +@Label("Pool Destroyed") +@Description("Emitted when the connection pool is successfully destroyed") +@Category({"UCP Events", "Pool Lifecycle Events"}) +public class PoolDestroyedEvent extends UCPBaseEvent { + + public PoolDestroyedEvent(UCPEventContext ctx) { + initCommonFields(ctx); + } +} \ No newline at end of file diff --git a/ojdbc-provider-ucp-observability/src/main/java/oracle/ucp/provider/observability/jfr/events/lifecycle/PoolStartedEvent.java b/ojdbc-provider-ucp-observability/src/main/java/oracle/ucp/provider/observability/jfr/events/lifecycle/PoolStartedEvent.java new file mode 100644 index 00000000..a79c471c --- /dev/null +++ b/ojdbc-provider-ucp-observability/src/main/java/oracle/ucp/provider/observability/jfr/events/lifecycle/PoolStartedEvent.java @@ -0,0 +1,57 @@ +/* + ** Copyright (c) 2026 Oracle and/or its affiliates. + ** + ** The Universal Permissive License (UPL), Version 1.0 + ** + ** Subject to the condition set forth below, permission is hereby granted to any + ** person obtaining a copy of this software, associated documentation and/or data + ** (collectively the "Software"), free of charge and under any and all copyright + ** rights in the Software, and any and all patent rights owned or freely + ** licensable by each licensor hereunder covering either (i) the unmodified + ** Software as contributed to or provided by such licensor, or (ii) the Larger + ** Works (as defined below), to deal in both + ** + ** (a) the Software, and + ** (b) any piece of software and/or hardware listed in the lrgrwrks.txt file if + ** one is included with the Software (each a "Larger Work" to which the Software + ** is contributed by such licensors), + ** + ** without restriction, including without limitation the rights to copy, create + ** derivative works of, display, perform, and distribute the Software and make, + ** use, sell, offer for sale, import, export, have made, and have sold the + ** Software and the Larger Work(s), and to sublicense the foregoing rights on + ** either these or other terms. + ** + ** This license is subject to the following condition: + ** The above copyright notice and either this complete permission notice or at + ** a minimum a reference to the UPL must be included in all copies or + ** substantial portions of the Software. + ** + ** THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + ** IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + ** FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + ** AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + ** LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + ** OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + ** SOFTWARE. + */ + +package oracle.ucp.provider.observability.jfr.events.lifecycle; + +import jdk.jfr.Category; +import jdk.jfr.Label; +import jdk.jfr.Description; +import jdk.jfr.Name; +import oracle.ucp.events.core.UCPEventContext; +import oracle.ucp.provider.observability.jfr.core.UCPBaseEvent; + +@Name("ucp.PoolStarted") +@Label("Pool Started") +@Description("Emitted when the connection pool is successfully started") +@Category({"UCP Events", "Pool Lifecycle Events"}) +public class PoolStartedEvent extends UCPBaseEvent { + + public PoolStartedEvent(UCPEventContext ctx) { + initCommonFields(ctx); + } +} \ No newline at end of file diff --git a/ojdbc-provider-ucp-observability/src/main/java/oracle/ucp/provider/observability/jfr/events/lifecycle/PoolStartingEvent.java b/ojdbc-provider-ucp-observability/src/main/java/oracle/ucp/provider/observability/jfr/events/lifecycle/PoolStartingEvent.java new file mode 100644 index 00000000..5cafebcf --- /dev/null +++ b/ojdbc-provider-ucp-observability/src/main/java/oracle/ucp/provider/observability/jfr/events/lifecycle/PoolStartingEvent.java @@ -0,0 +1,57 @@ +/* + ** Copyright (c) 2026 Oracle and/or its affiliates. + ** + ** The Universal Permissive License (UPL), Version 1.0 + ** + ** Subject to the condition set forth below, permission is hereby granted to any + ** person obtaining a copy of this software, associated documentation and/or data + ** (collectively the "Software"), free of charge and under any and all copyright + ** rights in the Software, and any and all patent rights owned or freely + ** licensable by each licensor hereunder covering either (i) the unmodified + ** Software as contributed to or provided by such licensor, or (ii) the Larger + ** Works (as defined below), to deal in both + ** + ** (a) the Software, and + ** (b) any piece of software and/or hardware listed in the lrgrwrks.txt file if + ** one is included with the Software (each a "Larger Work" to which the Software + ** is contributed by such licensors), + ** + ** without restriction, including without limitation the rights to copy, create + ** derivative works of, display, perform, and distribute the Software and make, + ** use, sell, offer for sale, import, export, have made, and have sold the + ** Software and the Larger Work(s), and to sublicense the foregoing rights on + ** either these or other terms. + ** + ** This license is subject to the following condition: + ** The above copyright notice and either this complete permission notice or at + ** a minimum a reference to the UPL must be included in all copies or + ** substantial portions of the Software. + ** + ** THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + ** IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + ** FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + ** AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + ** LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + ** OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + ** SOFTWARE. + */ + +package oracle.ucp.provider.observability.jfr.events.lifecycle; + +import jdk.jfr.Category; +import jdk.jfr.Label; +import jdk.jfr.Description; +import jdk.jfr.Name; +import oracle.ucp.events.core.UCPEventContext; +import oracle.ucp.provider.observability.jfr.core.UCPBaseEvent; + +@Name("ucp.PoolStarting") +@Label("Pool Starting") +@Description("Emitted when pool startup begins") +@Category({"UCP Events", "Pool Lifecycle Events"}) +public class PoolStartingEvent extends UCPBaseEvent { + + public PoolStartingEvent(UCPEventContext ctx) { + initCommonFields(ctx); + } +} \ No newline at end of file diff --git a/ojdbc-provider-ucp-observability/src/main/java/oracle/ucp/provider/observability/jfr/events/lifecycle/PoolStoppedEvent.java b/ojdbc-provider-ucp-observability/src/main/java/oracle/ucp/provider/observability/jfr/events/lifecycle/PoolStoppedEvent.java new file mode 100644 index 00000000..83b0bf18 --- /dev/null +++ b/ojdbc-provider-ucp-observability/src/main/java/oracle/ucp/provider/observability/jfr/events/lifecycle/PoolStoppedEvent.java @@ -0,0 +1,57 @@ +/* + ** Copyright (c) 2026 Oracle and/or its affiliates. + ** + ** The Universal Permissive License (UPL), Version 1.0 + ** + ** Subject to the condition set forth below, permission is hereby granted to any + ** person obtaining a copy of this software, associated documentation and/or data + ** (collectively the "Software"), free of charge and under any and all copyright + ** rights in the Software, and any and all patent rights owned or freely + ** licensable by each licensor hereunder covering either (i) the unmodified + ** Software as contributed to or provided by such licensor, or (ii) the Larger + ** Works (as defined below), to deal in both + ** + ** (a) the Software, and + ** (b) any piece of software and/or hardware listed in the lrgrwrks.txt file if + ** one is included with the Software (each a "Larger Work" to which the Software + ** is contributed by such licensors), + ** + ** without restriction, including without limitation the rights to copy, create + ** derivative works of, display, perform, and distribute the Software and make, + ** use, sell, offer for sale, import, export, have made, and have sold the + ** Software and the Larger Work(s), and to sublicense the foregoing rights on + ** either these or other terms. + ** + ** This license is subject to the following condition: + ** The above copyright notice and either this complete permission notice or at + ** a minimum a reference to the UPL must be included in all copies or + ** substantial portions of the Software. + ** + ** THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + ** IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + ** FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + ** AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + ** LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + ** OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + ** SOFTWARE. + */ + +package oracle.ucp.provider.observability.jfr.events.lifecycle; + +import jdk.jfr.Category; +import jdk.jfr.Label; +import jdk.jfr.Description; +import jdk.jfr.Name; +import oracle.ucp.events.core.UCPEventContext; +import oracle.ucp.provider.observability.jfr.core.UCPBaseEvent; + +@Name("ucp.PoolStopped") +@Label("Pool Stopped") +@Description("Emitted when the connection pool is successfully stopped") +@Category({"UCP Events", "Pool Lifecycle Events"}) +public class PoolStoppedEvent extends UCPBaseEvent { + + public PoolStoppedEvent(UCPEventContext ctx) { + initCommonFields(ctx); + } +} \ No newline at end of file diff --git a/ojdbc-provider-ucp-observability/src/main/java/oracle/ucp/provider/observability/jfr/events/maintenance/PoolPurgedEvent.java b/ojdbc-provider-ucp-observability/src/main/java/oracle/ucp/provider/observability/jfr/events/maintenance/PoolPurgedEvent.java new file mode 100644 index 00000000..21bb6f6b --- /dev/null +++ b/ojdbc-provider-ucp-observability/src/main/java/oracle/ucp/provider/observability/jfr/events/maintenance/PoolPurgedEvent.java @@ -0,0 +1,57 @@ +/* + ** Copyright (c) 2026 Oracle and/or its affiliates. + ** + ** The Universal Permissive License (UPL), Version 1.0 + ** + ** Subject to the condition set forth below, permission is hereby granted to any + ** person obtaining a copy of this software, associated documentation and/or data + ** (collectively the "Software"), free of charge and under any and all copyright + ** rights in the Software, and any and all patent rights owned or freely + ** licensable by each licensor hereunder covering either (i) the unmodified + ** Software as contributed to or provided by such licensor, or (ii) the Larger + ** Works (as defined below), to deal in both + ** + ** (a) the Software, and + ** (b) any piece of software and/or hardware listed in the lrgrwrks.txt file if + ** one is included with the Software (each a "Larger Work" to which the Software + ** is contributed by such licensors), + ** + ** without restriction, including without limitation the rights to copy, create + ** derivative works of, display, perform, and distribute the Software and make, + ** use, sell, offer for sale, import, export, have made, and have sold the + ** Software and the Larger Work(s), and to sublicense the foregoing rights on + ** either these or other terms. + ** + ** This license is subject to the following condition: + ** The above copyright notice and either this complete permission notice or at + ** a minimum a reference to the UPL must be included in all copies or + ** substantial portions of the Software. + ** + ** THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + ** IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + ** FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + ** AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + ** LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + ** OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + ** SOFTWARE. + */ + +package oracle.ucp.provider.observability.jfr.events.maintenance; + +import jdk.jfr.Category; +import jdk.jfr.Label; +import jdk.jfr.Description; +import jdk.jfr.Name; +import oracle.ucp.events.core.UCPEventContext; +import oracle.ucp.provider.observability.jfr.core.UCPBaseEvent; + +@Name("ucp.PoolPurged") +@Label("Pool Purged") +@Description("Emitted when a pool purge operation completes") +@Category({"UCP Events", "Maintenance Operations Events"}) +public class PoolPurgedEvent extends UCPBaseEvent { + + public PoolPurgedEvent(UCPEventContext ctx) { + initCommonFields(ctx); + } +} \ No newline at end of file diff --git a/ojdbc-provider-ucp-observability/src/main/java/oracle/ucp/provider/observability/jfr/events/maintenance/PoolRecycledEvent.java b/ojdbc-provider-ucp-observability/src/main/java/oracle/ucp/provider/observability/jfr/events/maintenance/PoolRecycledEvent.java new file mode 100644 index 00000000..6e609c64 --- /dev/null +++ b/ojdbc-provider-ucp-observability/src/main/java/oracle/ucp/provider/observability/jfr/events/maintenance/PoolRecycledEvent.java @@ -0,0 +1,57 @@ +/* + ** Copyright (c) 2026 Oracle and/or its affiliates. + ** + ** The Universal Permissive License (UPL), Version 1.0 + ** + ** Subject to the condition set forth below, permission is hereby granted to any + ** person obtaining a copy of this software, associated documentation and/or data + ** (collectively the "Software"), free of charge and under any and all copyright + ** rights in the Software, and any and all patent rights owned or freely + ** licensable by each licensor hereunder covering either (i) the unmodified + ** Software as contributed to or provided by such licensor, or (ii) the Larger + ** Works (as defined below), to deal in both + ** + ** (a) the Software, and + ** (b) any piece of software and/or hardware listed in the lrgrwrks.txt file if + ** one is included with the Software (each a "Larger Work" to which the Software + ** is contributed by such licensors), + ** + ** without restriction, including without limitation the rights to copy, create + ** derivative works of, display, perform, and distribute the Software and make, + ** use, sell, offer for sale, import, export, have made, and have sold the + ** Software and the Larger Work(s), and to sublicense the foregoing rights on + ** either these or other terms. + ** + ** This license is subject to the following condition: + ** The above copyright notice and either this complete permission notice or at + ** a minimum a reference to the UPL must be included in all copies or + ** substantial portions of the Software. + ** + ** THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + ** IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + ** FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + ** AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + ** LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + ** OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + ** SOFTWARE. + */ + +package oracle.ucp.provider.observability.jfr.events.maintenance; + +import jdk.jfr.Category; +import jdk.jfr.Label; +import jdk.jfr.Description; +import jdk.jfr.Name; +import oracle.ucp.events.core.UCPEventContext; +import oracle.ucp.provider.observability.jfr.core.UCPBaseEvent; + +@Name("ucp.PoolRecycled") +@Label("Pool Recycled") +@Description("Emitted when a pool recycle operation completes") +@Category({"UCP Events", "Maintenance Operations Events"}) +public class PoolRecycledEvent extends UCPBaseEvent { + + public PoolRecycledEvent(UCPEventContext ctx) { + initCommonFields(ctx); + } +} \ No newline at end of file diff --git a/ojdbc-provider-ucp-observability/src/main/java/oracle/ucp/provider/observability/jfr/events/maintenance/PoolRefreshedEvent.java b/ojdbc-provider-ucp-observability/src/main/java/oracle/ucp/provider/observability/jfr/events/maintenance/PoolRefreshedEvent.java new file mode 100644 index 00000000..f288759f --- /dev/null +++ b/ojdbc-provider-ucp-observability/src/main/java/oracle/ucp/provider/observability/jfr/events/maintenance/PoolRefreshedEvent.java @@ -0,0 +1,57 @@ +/* + ** Copyright (c) 2026 Oracle and/or its affiliates. + ** + ** The Universal Permissive License (UPL), Version 1.0 + ** + ** Subject to the condition set forth below, permission is hereby granted to any + ** person obtaining a copy of this software, associated documentation and/or data + ** (collectively the "Software"), free of charge and under any and all copyright + ** rights in the Software, and any and all patent rights owned or freely + ** licensable by each licensor hereunder covering either (i) the unmodified + ** Software as contributed to or provided by such licensor, or (ii) the Larger + ** Works (as defined below), to deal in both + ** + ** (a) the Software, and + ** (b) any piece of software and/or hardware listed in the lrgrwrks.txt file if + ** one is included with the Software (each a "Larger Work" to which the Software + ** is contributed by such licensors), + ** + ** without restriction, including without limitation the rights to copy, create + ** derivative works of, display, perform, and distribute the Software and make, + ** use, sell, offer for sale, import, export, have made, and have sold the + ** Software and the Larger Work(s), and to sublicense the foregoing rights on + ** either these or other terms. + ** + ** This license is subject to the following condition: + ** The above copyright notice and either this complete permission notice or at + ** a minimum a reference to the UPL must be included in all copies or + ** substantial portions of the Software. + ** + ** THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + ** IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + ** FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + ** AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + ** LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + ** OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + ** SOFTWARE. + */ + +package oracle.ucp.provider.observability.jfr.events.maintenance; + +import jdk.jfr.Category; +import jdk.jfr.Label; +import jdk.jfr.Description; +import jdk.jfr.Name; +import oracle.ucp.events.core.UCPEventContext; +import oracle.ucp.provider.observability.jfr.core.UCPBaseEvent; + +@Name("ucp.PoolRefreshed") +@Label("Pool Refreshed") +@Description("Emitted when a pool refresh operation completes") +@Category({"UCP Events", "Maintenance Operations Events"}) +public class PoolRefreshedEvent extends UCPBaseEvent { + + public PoolRefreshedEvent(UCPEventContext ctx) { + initCommonFields(ctx); + } +} \ No newline at end of file diff --git a/ojdbc-provider-ucp-observability/src/main/java/oracle/ucp/provider/observability/otel/OtelUCPEventListenerProvider.java b/ojdbc-provider-ucp-observability/src/main/java/oracle/ucp/provider/observability/otel/OtelUCPEventListenerProvider.java new file mode 100644 index 00000000..76f572c5 --- /dev/null +++ b/ojdbc-provider-ucp-observability/src/main/java/oracle/ucp/provider/observability/otel/OtelUCPEventListenerProvider.java @@ -0,0 +1,288 @@ +/* + ** Copyright (c) 2026 Oracle and/or its affiliates. + ** + ** The Universal Permissive License (UPL), Version 1.0 + ** + ** Subject to the condition set forth below, permission is hereby granted to any + ** person obtaining a copy of this software, associated documentation and/or data + ** (collectively the "Software"), free of charge and under any and all copyright + ** rights in the Software, and any and all patent rights owned or freely + ** licensable by each licensor hereunder covering either (i) the unmodified + ** Software as contributed to or provided by such licensor, or (ii) the Larger + ** Works (as defined below), to deal in both + ** + ** (a) the Software, and + ** (b) any piece of software and/or hardware listed in the lrgrwrks.txt file if + ** one is included with the Software (each a "Larger Work" to which the Software + ** is contributed by such licensors), + ** + ** without restriction, including without limitation the rights to copy, create + ** derivative works of, display, perform, and distribute the Software and make, + ** use, sell, offer for sale, import, export, have made, and have sold the + ** Software and the Larger Work(s), and to sublicense the foregoing rights on + ** either these or other terms. + ** + ** This license is subject to the following condition: + ** The above copyright notice and either this complete permission notice or at + ** a minimum a reference to the UPL must be included in all copies or + ** substantial portions of the Software. + ** + ** THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + ** IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + ** FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + ** AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + ** LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + ** OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + ** SOFTWARE. + */ + +package oracle.ucp.provider.observability.otel; + +import io.opentelemetry.api.GlobalOpenTelemetry; +import io.opentelemetry.api.common.AttributeKey; +import io.opentelemetry.api.common.Attributes; +import io.opentelemetry.api.metrics.*; +import oracle.ucp.events.core.UCPEventContext; +import oracle.ucp.events.core.UCPEventListener; +import oracle.ucp.events.core.UCPEventListenerProvider; + +import java.io.IOException; +import java.io.NotSerializableException; +import java.io.ObjectOutputStream; +import java.util.Map; +import java.util.concurrent.ConcurrentHashMap; + +/** + * OpenTelemetry provider for UCP connection pool metrics. + * + *
Metrics follow the + * + * OTel semantic conventions for database client connection pools. + * + *