diff --git a/Dockerfile b/Dockerfile index b610920..ce0b341 100644 --- a/Dockerfile +++ b/Dockerfile @@ -42,9 +42,12 @@ ENV GOARCH=${GOARCH:-amd64} # second note: moved back to 21c drivers due to adb-s non-root connection issue. for 23ai, change rpm to # oracle-instantclient-release-23ai-el8 and paths below s/21/23/ RUN if [ "$GOARCH" = "amd64" ]; then \ - microdnf install -y oracle-instantclient-release-el8 && microdnf install -y oracle-instantclient-basic && \ + microdnf update && \ + microdnf install -y oracle-instantclient-release-el8 && \ + microdnf install -y oracle-instantclient-basic && \ microdnf install glibc-2.28-251.0.2.el8_10.4 \ ; else \ + microdnf update && \ microdnf install wget libaio && \ wget https://download.oracle.com/otn_software/linux/instantclient/instantclient-basic-linux-arm64.rpm && \ rpm -ivh instantclient-basic-linux-arm64.rpm && \ diff --git a/Makefile b/Makefile index 7502653..40d519b 100644 --- a/Makefile +++ b/Makefile @@ -3,7 +3,7 @@ OS_TYPE ?= $(shell uname -s | tr '[:upper:]' '[:lower:]') ARCH_TYPE ?= $(subst x86_64,amd64,$(patsubst i%86,386,$(ARCH))) GOOS ?= $(shell go env GOOS) GOARCH ?= $(shell go env GOARCH) -VERSION ?= 2.0.0 +VERSION ?= 2.0.1 LDFLAGS := -X main.Version=$(VERSION) GOFLAGS := -ldflags "$(LDFLAGS) -s -w" BUILD_ARGS = --build-arg VERSION=$(VERSION) diff --git a/README.md b/README.md index 36c0708..797fa42 100644 --- a/README.md +++ b/README.md @@ -2,6 +2,25 @@ This project aims to provide observability for the Oracle Database so that users can understand performance and diagnose issues easily across applications and database. Over time, this project will provide not just metrics, but also logging and tracing support, and integration into popular frameworks like Spring Boot. The project aims to deliver functionality to support both cloud and on-premises databases, including those running in Kubernetes and containers. +## Main Features + +The main features of the exporter are: + +- Exports Oracle Database metrics in de facto standard Prometheus format +- Works with many types of Oracle Database deployment including single instance and Oracle Autonomous Database +- Supports wallet-based authentication +- Supports both OCI and Azure Vault integration (for database username, password) +- Multiple database support allows a single instance of the exporter to connect to, and export metrics from, multiple databases +- Can export the Alert Log in JSON format for easy ingest by log aggregators +- Can run as a local binary, in a container, or in Kubernetes +- Pre-buit AMD64 and ARM64 images provided +- A set of standard metrics included "out of the box" +- Easily define custom metrics +- Define the scrape interval, down to a per-metric level +- Define the query timeout +- Control connection pool settings, can use with go-sql or Oracle Database connection pools, also works with Database Resident Connection Pools +- Sample dashboard provided for Grafana + ![Oracle Database Dashboard](doc/exporter-running-against-basedb.png) From the first production release, v1.0, onwards, this project provides a [Prometheus](https://prometheus.io/) exporter for Oracle Database that is based in part on a Prometheus exporter created by [Seth Miller](https://github.com/iamseth/oracledb_exporter) with changes to comply with various Oracle standards and policies. @@ -34,6 +53,7 @@ Contributions are welcome - please see [contributing](CONTRIBUTING.md). | Release | Date | Changelog | |---------|----------------------|-----------------------------------------------------------------| +| 2.0.1 | June 12, 2025 | [2.0.1 Changelog](./changelog.md#version-201-june-12-2025) | | 2.0.0 | May 27, 2025 | [2.0.0 Changelog](./changelog.md#version-200-may-27-2025) | | 1.6.1 | May 2, 2025 | [1.6.1 Changelog](./changelog.md#version-161-may-2-2025) | | 1.6.0 | April 18, 2025 | [1.6.0 Changelog](./changelog.md#version-160-april-18-2025) | @@ -382,7 +402,7 @@ docker run -it --rm \ -e DB_PASSWORD=Welcome12345 \ -e DB_CONNECT_STRING=free23ai:1521/freepdb \ -p 9161:9161 \ - container-registry.oracle.com/database/observability-exporter:1.6.1 + container-registry.oracle.com/database/observability-exporter:2.0.1 ``` ##### Using a wallet @@ -428,7 +448,7 @@ docker run -it --rm \ -e DB_CONNECT_STRING=devdb_tp \ -v ./wallet:/wallet \ -p 9161:9161 \ - container-registry.oracle.com/database/observability-exporter:1.6.1 + container-registry.oracle.com/database/observability-exporter:2.0.1 ``` > **Note:** If you are using `podman` you must specify the `:z` suffix on the volume mount so that the container will be able to access the files in the volume. For example: `-v ./wallet:/wallet:z` @@ -464,6 +484,18 @@ kubectl create secret generic db-secret \ -n exporter ``` +#### Create a config map for the exporter configuration file (recommended) + +Create a config map with the exporter configuration file (if you are using one) using this command: + +```bash +kubectl create cm metrics-exporter-config \ + --from-file=metrics-exporter-config.yaml +``` + +> NOTE: It is strongly recommended to migrate to the new config file if you are running version 2.0.0 or later. + + #### Create a config map for the wallet (optional) Create a config map with the wallet (if you are using one) using this command. Run this command in the `wallet` directory you created earlier. @@ -481,7 +513,7 @@ kubectl create cm db-metrics-tns-admin \ -n exporter ``` -#### Create a config map for you metrics definition file (optional) +#### Create a config map for your metrics definition file (optional) If you have defined any [custom metrics](#custom-metrics), you must create a config map for the metrics definition file. For example, if you created a configuration file called `txeventq-metrics.toml`, then create the config map with this command: @@ -967,7 +999,7 @@ An exmaple of [custom metrics for Transacational Event Queues](./custom-metrics- If you run the exporter as a container image and want to include your custom metrics in the image itself, you can use the following example `Dockerfile` to create a new image: ```Dockerfile -FROM container-registry.oracle.com/database/observability-exporter:1.6.1 +FROM container-registry.oracle.com/database/observability-exporter:2.0.1 COPY custom-metrics.toml / ENTRYPOINT ["/oracledb_exporter", "--custom.metrics", "/custom-metrics.toml"] ``` diff --git a/THIRD_PARTY_LICENSES.txt b/THIRD_PARTY_LICENSES.txt index 525f44d..14f1975 100644 --- a/THIRD_PARTY_LICENSES.txt +++ b/THIRD_PARTY_LICENSES.txt @@ -769,10 +769,10 @@ SPDX:Apache-2.0 == Copyright -Copyright (c) 2016, 2023, Oracle and/or its affiliates. All rights reserved. +Copyright (c) 2016, 2025, Oracle and/or its affiliates. All rights reserved. == Notices -Copyright (c) 2016, 2018, 2020, Oracle and/or its affiliates. +Copyright (c) 2016, 2025, Oracle and/or its affiliates. --------------------------------- (separator) ---------------------------------- @@ -797,7 +797,7 @@ SPDX:Apache-2.0 Copyright (c) 2015 Björn Rabenstein Copyright 2013 The Go Authors. All rights reserved. Copyright 2013-2015 Blake Mizerany, Björn Rabenstein -Copyright 2024 The Prometheus Authors +Copyright 2025 The Prometheus Authors == Notices Prometheus instrumentation library for Go applications @@ -967,7 +967,7 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. == Copyright Copyright 2009 The Go Authors. -Copyright 2024 The Go Authors. All rights reserved. +Copyright 2025 The Go Authors. All rights reserved. == Patents Additional IP Rights Grant (Patents) @@ -1447,4 +1447,4 @@ SOFTWARE. === ATTRIBUTION-HELPER-GENERATED: === Attribution helper version: {Major:0 Minor:11 GitVersion:0.10.0-116-g2a434e4d-dirty GitCommit:2a434e4d7eea22d4dfd2d1cf04909239d05562b1 GitTreeState:dirty BuildDate:2025-04-29T00:30:45Z GoVersion:go1.22.4 Compiler:gc Platform:linux/amd64} -=== License file based on go.mod with md5 sum: 8b2013f9c4f6808e20b272f9ecfa05b2 +=== License file based on go.mod with md5 sum: 15979ec9beb851f5e9b7b1e60a196993 diff --git a/changelog.md b/changelog.md index 8625222..b1039b7 100644 --- a/changelog.md +++ b/changelog.md @@ -4,6 +4,13 @@ Our current priorities are support for RAC and Exadata. We expect to address these in an upcoming release. +### Version 2.0.1, June 12, 2025 + +This release includes the following changes: + +- Use gv$ views instead of v$ views to allow collection of metrics from all instances in a cluster. (In preparation for RAC support). +- Update some third-party dependencies. + ### Version 2.0.0, May 27, 2025 This release includes the following changes: diff --git a/docker-compose/compose.yaml b/docker-compose/compose.yaml index 23d40a6..41c089e 100644 --- a/docker-compose/compose.yaml +++ b/docker-compose/compose.yaml @@ -59,7 +59,7 @@ services: start_period: 30s exporter: - image: container-registry.oracle.com/database/observability-exporter:2.0.0 + image: container-registry.oracle.com/database/observability-exporter:2.0.1 container_name: exporter command: - '--config.file=/exporter/config.yaml' diff --git a/go.mod b/go.mod index 74e4695..377ca77 100644 --- a/go.mod +++ b/go.mod @@ -3,12 +3,12 @@ module github.com/oracle/oracle-db-appdev-monitoring go 1.23.8 require ( - github.com/Azure/azure-sdk-for-go/sdk/azidentity v1.10.0 + github.com/Azure/azure-sdk-for-go/sdk/azidentity v1.10.1 github.com/Azure/azure-sdk-for-go/sdk/keyvault/azsecrets v0.12.0 github.com/BurntSushi/toml v1.5.0 github.com/alecthomas/kingpin/v2 v2.4.0 github.com/godror/godror v0.48.3 - github.com/oracle/oci-go-sdk/v65 v65.91.1 + github.com/oracle/oci-go-sdk/v65 v65.93.1 github.com/prometheus/client_golang v1.22.0 github.com/prometheus/common v0.64.0 github.com/prometheus/exporter-toolkit v0.14.0 diff --git a/go.sum b/go.sum index 9a7e4b8..835bc58 100644 --- a/go.sum +++ b/go.sum @@ -8,6 +8,8 @@ github.com/Azure/azure-sdk-for-go/sdk/azidentity v1.9.0 h1:OVoM452qUFBrX+URdH3Vp github.com/Azure/azure-sdk-for-go/sdk/azidentity v1.9.0/go.mod h1:kUjrAo8bgEwLeZ/CmHqNl3Z/kPm7y6FKfxxK0izYUg4= github.com/Azure/azure-sdk-for-go/sdk/azidentity v1.10.0 h1:j8BorDEigD8UFOSZQiSqAMOOleyQOOQPnUAwV+Ls1gA= github.com/Azure/azure-sdk-for-go/sdk/azidentity v1.10.0/go.mod h1:JdM5psgjfBf5fo2uWOZhflPWyDBZ/O/CNAH9CtsuZE4= +github.com/Azure/azure-sdk-for-go/sdk/azidentity v1.10.1 h1:B+blDbyVIG3WaikNxPnhPiJ1MThR03b3vKGtER95TP4= +github.com/Azure/azure-sdk-for-go/sdk/azidentity v1.10.1/go.mod h1:JdM5psgjfBf5fo2uWOZhflPWyDBZ/O/CNAH9CtsuZE4= github.com/Azure/azure-sdk-for-go/sdk/azidentity/cache v0.3.2 h1:yz1bePFlP5Vws5+8ez6T3HWXPmwOK7Yvq8QxDBD3SKY= github.com/Azure/azure-sdk-for-go/sdk/azidentity/cache v0.3.2/go.mod h1:Pa9ZNPuoNu/GztvBSKk9J1cDJW6vk/n0zLtV4mgd8N8= github.com/Azure/azure-sdk-for-go/sdk/internal v1.10.0 h1:ywEEhmNahHBihViHepv3xPBn1663uRv2t2q/ESv9seY= @@ -106,6 +108,8 @@ github.com/oracle/oci-go-sdk/v65 v65.89.3 h1:KSUykb5Ou54jF4SeJNjBwcDg+umbAwcvT+x github.com/oracle/oci-go-sdk/v65 v65.89.3/go.mod h1:u6XRPsw9tPziBh76K7GrrRXPa8P8W3BQeqJ6ZZt9VLA= github.com/oracle/oci-go-sdk/v65 v65.91.1 h1:jRE4jUiJd+sDhJTyTCXIJdzLjTx+99gA3PgzpVTaF/I= github.com/oracle/oci-go-sdk/v65 v65.91.1/go.mod h1:u6XRPsw9tPziBh76K7GrrRXPa8P8W3BQeqJ6ZZt9VLA= +github.com/oracle/oci-go-sdk/v65 v65.93.1 h1:lIvy/6aQOUenQI+cxXH1wDBJeXFPO9Du3CaomXeYFaY= +github.com/oracle/oci-go-sdk/v65 v65.93.1/go.mod h1:u6XRPsw9tPziBh76K7GrrRXPa8P8W3BQeqJ6ZZt9VLA= github.com/pkg/browser v0.0.0-20240102092130-5ac0b6a4141c h1:+mdjkGKdHQG3305AYmdv1U2eRNDiU2ErMBj1gwrq8eQ= github.com/pkg/browser v0.0.0-20240102092130-5ac0b6a4141c/go.mod h1:7rwL4CYBLnjLxUqIJNnCWiEdr3bn6IUYi15bNlnbCCU= github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM= diff --git a/kubernetes/metrics-exporter-config.yaml b/kubernetes/metrics-exporter-config.yaml new file mode 100644 index 0000000..a589b3b --- /dev/null +++ b/kubernetes/metrics-exporter-config.yaml @@ -0,0 +1,60 @@ +# Example Oracle Database Metrics Exporter Configuration file. +# Environment variables of the form ${VAR_NAME} will be expanded. + +databases: + ## Path on which metrics will be served + # metricsPath: /metrics + ## Database connection information for the "default" database. + default: + ## Database username + username: ${DB_USERNAME} + ## Database password + password: ${DB_PASSWORD} + ## Database connection url + url: ${DB_CONNECT_STRING} + + ## Metrics query timeout for this database, in seconds + queryTimeout: 5 + + ## Rely on Oracle Database External Authentication by network or OS + # externalAuth: false + ## Database role + # role: SYSDBA + ## Path to Oracle Database wallet, if using wallet + tnsAdmin: ${TNS_ADMIN} + + ### Connection settings: + ### Either the go-sql or Oracle Database connection pool may be used. + ### To use the Oracle Database connection pool over the go-sql connection pool, + ### set maxIdleConns to zero and configure the pool* settings. + + ### Connection pooling settings for the go-sql connection pool + ## Max open connections for this database using go-sql connection pool + maxOpenConns: 10 + ## Max idle connections for this database using go-sql connection pool + maxIdleConns: 10 + + ### Connection pooling settings for the Oracle Database connection pool + ## Oracle Database connection pool increment. + # poolIncrement: 1 + ## Oracle Database Connection pool maximum size + # poolMaxConnections: 15 + ## Oracle Database Connection pool minimum size + # poolMinConnections: 15 + +metrics: + ## How often to scrape metrics. If not provided, metrics will be scraped on request. + # scrapeInterval: 15s + ## Path to default metrics file. + default: default-metrics.toml + ## Paths to any custom metrics files + # custom: + # - /oracle/observability/txeventq-metrics.toml + +log: + # Path of log file + destination: /opt/alert.log + # Interval of log updates + interval: 15s + ## Set disable to 1 to disable logging + # disable: 0 \ No newline at end of file diff --git a/kubernetes/metrics-exporter-deployment.yaml b/kubernetes/metrics-exporter-deployment.yaml index c284011..90b4200 100755 --- a/kubernetes/metrics-exporter-deployment.yaml +++ b/kubernetes/metrics-exporter-deployment.yaml @@ -17,8 +17,10 @@ spec: spec: containers: - name: metrics-exporter - image: container-registry.oracle.com/database/observability-exporter:1.6.1 + image: container-registry.oracle.com/database/observability-exporter:2.0.1 imagePullPolicy: Always + command: ["/oracledb_exporter"] + args: ["--config.file=/config/metrics-exporter-config.yaml"] env: # uncomment and customize the next item if you want to provide custom metrics definitions #- name: CUSTOM_METRICS @@ -41,6 +43,8 @@ spec: - name: DB_CONNECT_STRING value: "DEVDB_TP?TNS_ADMIN=$(TNS_ADMIN)" volumeMounts: + - name: exporter-config + mountPath: /config - name: tns-admin mountPath: /oracle/tns_admin # uncomment and customize the next item if you want to provide custom metrics definitions @@ -61,6 +65,9 @@ spec: - name: tns-admin configMap: name: db-metrics-tns-admin + - name: exporter-config + configMap: + name: metrics-exporter-config # uncomment and customize the next item if you want to provide custom metrics definitions #- name: config-volume # configMap: