From 44f06fbf67f46399ed0fb24500c1823b4cb3a907 Mon Sep 17 00:00:00 2001 From: Mark Nelson Date: Wed, 26 Feb 2025 09:48:18 -0500 Subject: [PATCH 1/5] pickup change in godror to add extra admin roles Signed-off-by: Mark Nelson --- go.mod | 2 +- go.sum | 2 ++ 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/go.mod b/go.mod index 38dd402..d431d48 100644 --- a/go.mod +++ b/go.mod @@ -8,7 +8,7 @@ require ( github.com/BurntSushi/toml v1.4.0 github.com/alecthomas/kingpin/v2 v2.4.0 github.com/go-kit/log v0.2.1 - github.com/godror/godror v0.46.0 + github.com/godror/godror v0.46.1-0.20250226074503-67aeda640090 github.com/oracle/oci-go-sdk/v65 v65.81.1 github.com/prometheus/client_golang v1.20.5 github.com/prometheus/common v0.60.1 diff --git a/go.sum b/go.sum index 13534a1..4a12734 100644 --- a/go.sum +++ b/go.sum @@ -34,6 +34,8 @@ github.com/godror/godror v0.45.2 h1:rkXxmD+/QdKz0PTOuSfEmWNFCHnKpWS8b8HUl+5V7us= github.com/godror/godror v0.45.2/go.mod h1:44hxVDzvFSwc+yGyRM+riCLNAY5SwZkUfLzVTh5MXCg= github.com/godror/godror v0.46.0 h1:/43db84UcoxlooASIsasH8TvZ7E1huwJ64yDtZ2504k= github.com/godror/godror v0.46.0/go.mod h1:44hxVDzvFSwc+yGyRM+riCLNAY5SwZkUfLzVTh5MXCg= +github.com/godror/godror v0.46.1-0.20250226074503-67aeda640090 h1:9/ZPRz24+4QrrU/xB0I+AAXKzLV2xtG+mn+9zb3cQCg= +github.com/godror/godror v0.46.1-0.20250226074503-67aeda640090/go.mod h1:44hxVDzvFSwc+yGyRM+riCLNAY5SwZkUfLzVTh5MXCg= github.com/godror/knownpb v0.1.2 h1:icMyYsYVpGmzhoVA01xyd0o4EaubR31JPK1UxQWe4kM= github.com/godror/knownpb v0.1.2/go.mod h1:zs9hH+lwj7mnPHPnKCcxdOGz38Axa9uT+97Ng+Nnu5s= github.com/gofrs/flock v0.8.1 h1:+gYjHKf32LDeiEEFhQaotPbLuUXjY5ZqxKgXy7n59aw= From f34f131f8d955b1b873485be39ade26d22a2c242 Mon Sep 17 00:00:00 2001 From: Mark Nelson Date: Wed, 26 Feb 2025 09:57:33 -0500 Subject: [PATCH 2/5] update doc, version Signed-off-by: Mark Nelson --- Makefile | 2 +- README.md | 23 +++++++++++++++++++++++ 2 files changed, 24 insertions(+), 1 deletion(-) diff --git a/Makefile b/Makefile index 7cfeb07..cedfd0d 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 ?= 1.5.3 +VERSION ?= 1.5.4 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 3eacfd9..31315c8 100644 --- a/README.md +++ b/README.md @@ -27,8 +27,31 @@ Contributions are welcome - please see [contributing](CONTRIBUTING.md). ## Release Notes +### Version 1.5.4, February 27, 2025 + +Our current priorities are support for RAC and mutliple databases (inculding #84 and #89), and intermittent connection issues +with ADB-S when exporter is run in a container (including #169). We expect to address these in an upcoming release. + +- Fix malloc error (#177) +- Add support for additional admin roles, including SYSDG (#180) +- Updated some third-party dependencies. + +Thank you to the following people for their suggestions and contributions: + +- [@Jman1993](https://github.com/Jman1993) +- [@oey](https://github.com/oey) +- [@jlembeck06](https://github.com/jlembeck06) +- [@Jman1993](https://github.com/Jman1993) +- [@PeterP55P](https://github.com/PeterP55P) +- [@rlagyu0](https://github.com/rlagyu0) + +In this release, we also continued some minor code refactoring. + ### Version 1.5.3, January 28, 2025 +*Known issue*: This release has a known issue that results in the error message `malloc(): unsorted double linked list corrupted`. +We recommend staying on 1.5.2 until a new release with a fix is available. We hope to have a fix by early March. + Our current priorities are support for RAC and mutliple databases (inculding #84 and #89), and intermittent connection issues with ADB-S when exporter is run in a container (including #169). We expect to address these in an upcoming release. From 7b21341a01a29e24d5fe47c91926e80519292ce4 Mon Sep 17 00:00:00 2001 From: Mark Nelson Date: Wed, 26 Feb 2025 10:10:41 -0500 Subject: [PATCH 3/5] uptake new admin role api Signed-off-by: Mark Nelson --- README.md | 4 ++-- collector/collector.go | 24 ++++++++++++++++++------ 2 files changed, 20 insertions(+), 8 deletions(-) diff --git a/README.md b/README.md index 31315c8..40be1cb 100644 --- a/README.md +++ b/README.md @@ -33,7 +33,7 @@ Our current priorities are support for RAC and mutliple databases (inculding #84 with ADB-S when exporter is run in a container (including #169). We expect to address these in an upcoming release. - Fix malloc error (#177) -- Add support for additional admin roles, including SYSDG (#180) +- Add support for additional admin roles, exapnding list of options for `DB_ROILE` to `SYSDBA`, `SYSOPER`, `SYSBACKUP`, `SYSDG`, `SYSKM`, `SYSRAC` and `SYSASM` (#180) - Updated some third-party dependencies. Thank you to the following people for their suggestions and contributions: @@ -519,7 +519,7 @@ For a simple connection, you will provide the details using these variables: - `DB_USERNAME` is the database username, e.g., `pdbadmin` - `DB_PASSWORD` is the password for that user, e.g., `Welcome12345` - `DB_CONNECT_STRING` is the connection string, e.g., `free23ai:1521/freepdb` -- `DB_ROLE` (Optional) can be set to `SYSDBA` or `SYSOPER` if you want to connect with one of those roles, however Oracle recommends that you connect with the lowest possible privileges and roles necessary for the exporter to run. +- `DB_ROLE` (Optional) can be set to `SYSDBA`, `SYSOPER`, `SYSBACKUP`, `SYSDG`, `SYSKM`, `SYSRAC` or `SYSASM` if you want to connect with one of those roles, however Oracle recommends that you connect with the lowest possible privileges and roles necessary for the exporter to run. To run the exporter in a container and expose the port, use a command like this, with the appropriate values for the environment variables: diff --git a/collector/collector.go b/collector/collector.go index 644691a..a9ebc62 100644 --- a/collector/collector.go +++ b/collector/collector.go @@ -23,6 +23,7 @@ import ( "github.com/go-kit/log" "github.com/go-kit/log/level" "github.com/godror/godror" + "github.com/godror/godror/dsn" "github.com/prometheus/client_golang/prometheus" ) @@ -401,12 +402,23 @@ func (e *Exporter) connect() error { // if TNS_ADMIN env var is set, set ConfigDir to that location P.ConfigDir = e.configDir - if strings.ToUpper(e.config.DbRole) == "SYSDBA" { - P.IsSysDBA = true - } - - if strings.ToUpper(e.config.DbRole) == "SYSOPER" { - P.IsSysOper = true + switch strings.ToUpper(e.config.DbRole) { + case "SYSDBA": + P.AdminRole = dsn.SysDBA + case "SYSOPER": + P.AdminRole = dsn.SysOPER + case "SYSBACKUP": + P.AdminRole = dsn.SysBACKUP + case "SYSDG": + P.AdminRole = dsn.SysDG + case "SYSKM": + P.AdminRole = dsn.SysKM + case "SYSRAC": + P.AdminRole = dsn.SysRAC + case "SYSASM": + P.AdminRole = dsn.SysASM + default: + P.AdminRole = dsn.NoRole } level.Debug(e.logger).Log("msg", "connection properties: "+fmt.Sprint(P)) From 76d16200a954beaf4298442124e906ad503d615d Mon Sep 17 00:00:00 2001 From: Mark Nelson Date: Wed, 26 Feb 2025 10:13:55 -0500 Subject: [PATCH 4/5] update version nums Signed-off-by: Mark Nelson --- README.md | 6 +++--- docker-compose/compose.yaml | 2 +- kubernetes/metrics-exporter-deployment.yaml | 2 +- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/README.md b/README.md index 40be1cb..8caf3aa 100644 --- a/README.md +++ b/README.md @@ -529,7 +529,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.5.3 + container-registry.oracle.com/database/observability-exporter:1.5.4 ``` ##### Using a wallet @@ -575,7 +575,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.5.3 + container-registry.oracle.com/database/observability-exporter:1.5.4 ``` > **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` @@ -865,7 +865,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.5.3 +FROM container-registry.oracle.com/database/observability-exporter:1.5.4 COPY custom-metrics.toml / ENTRYPOINT ["/oracledb_exporter", "--custom.metrics", "/custom-metrics.toml"] ``` diff --git a/docker-compose/compose.yaml b/docker-compose/compose.yaml index de088fe..52d0847 100644 --- a/docker-compose/compose.yaml +++ b/docker-compose/compose.yaml @@ -43,7 +43,7 @@ services: start_period: 30s exporter: - image: container-registry.oracle.com/database/observability-exporter:1.5.3 + image: container-registry.oracle.com/database/observability-exporter:1.5.4 container_name: exporter ports: - 9161:9161 diff --git a/kubernetes/metrics-exporter-deployment.yaml b/kubernetes/metrics-exporter-deployment.yaml index e3337cf..5f910eb 100755 --- a/kubernetes/metrics-exporter-deployment.yaml +++ b/kubernetes/metrics-exporter-deployment.yaml @@ -17,7 +17,7 @@ spec: spec: containers: - name: metrics-exporter - image: container-registry.oracle.com/database/observability-exporter:1.5.3 + image: container-registry.oracle.com/database/observability-exporter:1.5.4 imagePullPolicy: Always env: # uncomment and customize the next item if you want to provide custom metrics definitions From a949646dc2deb05140cf9a4dc584f56bc6159b37 Mon Sep 17 00:00:00 2001 From: Mark Nelson Date: Wed, 26 Feb 2025 11:32:18 -0500 Subject: [PATCH 5/5] use AdminRole type instead of just string Signed-off-by: Mark Nelson --- collector/collector.go | 4 ++-- main.go | 5 +++-- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/collector/collector.go b/collector/collector.go index a9ebc62..314bbbf 100644 --- a/collector/collector.go +++ b/collector/collector.go @@ -55,7 +55,7 @@ type Config struct { User string Password string ConnectString string - DbRole string + DbRole dsn.AdminRole ConfigDir string ExternalAuth bool MaxIdleConns int @@ -402,7 +402,7 @@ func (e *Exporter) connect() error { // if TNS_ADMIN env var is set, set ConfigDir to that location P.ConfigDir = e.configDir - switch strings.ToUpper(e.config.DbRole) { + switch e.config.DbRole { case "SYSDBA": P.AdminRole = dsn.SysDBA case "SYSOPER": diff --git a/main.go b/main.go index 80729b3..8ee3d91 100644 --- a/main.go +++ b/main.go @@ -13,6 +13,7 @@ import ( "time" "github.com/go-kit/log/level" + "github.com/godror/godror/dsn" "github.com/prometheus/client_golang/prometheus" cversion "github.com/prometheus/client_golang/prometheus/collectors/version" "github.com/prometheus/client_golang/prometheus/promhttp" @@ -87,9 +88,9 @@ func main() { User: user, Password: password, ConnectString: connectString, - DbRole: dbrole, + DbRole: dsn.AdminRole(dbrole), ConfigDir: tnsadmin, - ExternalAuth: externalAuth, + ExternalAuth: externalAuth, MaxOpenConns: *maxOpenConns, MaxIdleConns: *maxIdleConns, CustomMetrics: *customMetrics,