Skip to content

Commit e164962

Browse files
authored
Prepare for 1.5.1 (#142)
* 1.5.1 release --------- Signed-off-by: Mark Nelson <[email protected]>
1 parent f74d413 commit e164962

File tree

10 files changed

+108
-33
lines changed

10 files changed

+108
-33
lines changed

Diff for: Dockerfile

+23-13
Original file line numberDiff line numberDiff line change
@@ -1,54 +1,64 @@
11
ARG BASE_IMAGE
2-
FROM ${BASE_IMAGE} AS build
2+
FROM ${BASE_IMAGE:-ghcr.io/oracle/oraclelinux:8-slim} AS build
33

44
ARG GOOS
5-
ENV GOOS ${GOOS:-linux}
5+
ENV GOOS=${GOOS:-linux}
66

77
ARG GOARCH
8-
ENV GOARCH ${GOARCH:-amd64}
8+
ENV GOARCH=${GOARCH:-amd64}
99

1010
RUN microdnf install wget gzip gcc && \
1111
wget -q https://go.dev/dl/go1.22.7.${GOOS}-${GOARCH}.tar.gz && \
1212
rm -rf /usr/local/go && \
1313
tar -C /usr/local -xzf go1.22.7.${GOOS}-${GOARCH}.tar.gz && \
1414
rm go1.22.7.${GOOS}-${GOARCH}.tar.gz
1515

16-
ENV PATH $PATH:/usr/local/go/bin
16+
ENV PATH=$PATH:/usr/local/go/bin
1717

1818
WORKDIR /go/src/oracledb_exporter
1919
COPY . .
2020
RUN go get -d -v
2121

2222
ARG VERSION
23-
ENV VERSION ${VERSION:-1.0.0}
23+
ENV VERSION=${VERSION:-1.0.0}
2424

2525
RUN CGO_ENABLED=1 GOOS=${GOOS} GOARCH=${GOARCH} go build -v -ldflags "-X main.Version=${VERSION} -s -w"
2626

27-
FROM ${BASE_IMAGE} as exporter
27+
FROM ${BASE_IMAGE:-ghcr.io/oracle/oraclelinux:8-slim} AS exporter
2828
LABEL org.opencontainers.image.authors="Oracle America, Inc."
2929
LABEL org.opencontainers.image.description="Oracle Database Observability Exporter"
3030

31-
ENV VERSION ${VERSION:-1.0.0}
31+
ARG VERSION
32+
ENV VERSION=${VERSION:-1.0.0}
3233
ENV DEBIAN_FRONTEND=noninteractive
3334

35+
ARG GOARCH
36+
ENV GOARCH=${GOARCH:-amd64}
37+
38+
# note: the 23ai arm drivers are not in yum yet, when they are can switch this to just use yum and not need
39+
# to wget the driver for arm. also note that the permalink for otn download of drivers does not have version
40+
# in it, and does not appear to be a link vith version in it, so that link is very brittle and could break build
3441
RUN if [ "$GOARCH" = "amd64" ]; then \
35-
microdnf install -y oracle-instantclient-release-el8 && microdnf install -y oracle-instantclient-basic && \
42+
microdnf install -y oracle-instantclient-release-23ai-el8 && microdnf install -y oracle-instantclient-basic && \
3643
microdnf install glibc-2.28-251.0.2.el8_10.4 \
3744
; else \
38-
microdnf install oracle-release-el8 && \
39-
microdnf install -y oracle-instantclient19.23-basic && \
45+
microdnf install wget libaio && \
46+
wget https://download.oracle.com/otn_software/linux/instantclient/instantclient-basic-linux-arm64.rpm && \
47+
rpm -ivh instantclient-basic-linux-arm64.rpm && \
48+
ln -s /usr/lib/oracle/19.24 /usr/lib/oracle/23 && \
4049
microdnf install glibc-2.28-251.0.2.el8_10.4 \
4150
; fi
4251

43-
ENV LD_LIBRARY_PATH /usr/lib/oracle/21/client64/lib
44-
ENV PATH $PATH:/usr/lib/oracle/21/client64/bin
45-
ENV ORACLE_HOME /usr/lib/oracle/21/client64
52+
ENV LD_LIBRARY_PATH=/usr/lib/oracle/23/client64/lib:usr/lib/oracle/19.24/client64/lib
53+
ENV PATH=$PATH:/usr/lib/oracle/23/client64/bin:usr/lib/oracle/19.24/client64/bin
54+
ENV ORACLE_HOME=/usr/lib/oracle/23/client64
4655

4756
COPY --from=build /go/src/oracledb_exporter/oracle-db-appdev-monitoring /oracledb_exporter
4857
ADD ./default-metrics.toml /default-metrics.toml
4958

5059
# create the mount point for alert log exports (default location)
5160
RUN mkdir /log && chown 1000:1000 /log
61+
RUN mkdir /wallet && chown 1000:1000 /wallet
5262

5363
EXPOSE 9161
5464

Diff for: Makefile

+3-3
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ OS_TYPE ?= $(shell uname -s | tr '[:upper:]' '[:lower:]')
33
ARCH_TYPE ?= $(subst x86_64,amd64,$(patsubst i%86,386,$(ARCH)))
44
GOOS ?= $(shell go env GOOS)
55
GOARCH ?= $(shell go env GOARCH)
6-
VERSION ?= 1.5.0
6+
VERSION ?= 1.5.1
77
LDFLAGS := -X main.Version=$(VERSION)
88
GOFLAGS := -ldflags "$(LDFLAGS) -s -w"
99
BUILD_ARGS = --build-arg VERSION=$(VERSION)
@@ -83,10 +83,10 @@ push-images:
8383
@make --no-print-directory push-oraclelinux-image
8484

8585
docker:
86-
docker build --no-cache --progress=plain $(BUILD_ARGS) -t "$(IMAGE_ID)" --build-arg BASE_IMAGE=$(ORACLE_LINUX_BASE_IMAGE) .
86+
docker build --no-cache --progress=plain $(BUILD_ARGS) -t "$(IMAGE_ID)-amd64" --build-arg BASE_IMAGE=$(ORACLE_LINUX_BASE_IMAGE) --build-arg GOARCH=amd64 .
8787

8888
docker-arm:
89-
docker build --no-cache --progress=plain $(BUILD_ARGS) -t "$(IMAGE_ID)" --build-arg BASE_IMAGE=$(ORACLE_LINUX_BASE_IMAGE) --build-arg GOARCH=arm64 .
89+
docker buildx build --platform linux/arm64 --load --no-cache --progress=plain $(BUILD_ARGS) -t "$(IMAGE_ID)-arm64" --build-arg BASE_IMAGE=$(ORACLE_LINUX_BASE_IMAGE) --build-arg GOARCH=arm64 .
9090

9191
push-oraclelinux-image:
9292
docker push $(IMAGE_ID)

Diff for: README.md

+24-3
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,17 @@ Contributions are welcome - please see [contributing](CONTRIBUTING.md).
2727

2828
## Release Notes
2929

30+
### Version 1.5.1, October 28, 2024
31+
32+
This release includes the following changes:
33+
34+
- Added support for using the `TNS_ADMIN` environment variable, which fixes an issue when connecting to Autonomous Database instances using TNS name.
35+
- Updated InstantClient to 23ai version for amd64 and latest available 19.24 version for arm64.
36+
- Fixed an issue with wrong `LD_LIBRARY_PATH` on some platforms. (#136)
37+
- Added documentation and an example of using the `scrapeinterval` setting to change the interval at which a certain metric is colected.
38+
- Added notes to documentation for extra security parameters needed when using a wallet with Podman.
39+
- Updated some third-party dependencies.
40+
3041
### Version 1.5.0, September 26, 2024
3142

3243
This release includes the following changes:
@@ -333,6 +344,11 @@ oracledb_wait_time_system_io 1.62
333344
oracledb_wait_time_user_io 24.5
334345
```
335346

347+
These standard metrics are defined in the file `default-metrics.toml` found in the root directory of this repository.
348+
349+
> **Note:** You can change the interval at which metrics are collected at a per-metric level. If you find that any of the default metrics are placing too much load on your database instance, you may will too collect that particular metric less often, which can be done by adding the `scrapeinterval` paraemeter to the metric definition. See the definition of the `top_sql` metric for an example.
350+
351+
336352
## Database permissions required
337353

338354
For the built-in default metrics, the database user that the exporter uses to connect to the Oracle Database instance must have the `SELECT_CATALOG_ROLE` privilege and/or `SELECT` permission on the following objects:
@@ -459,7 +475,7 @@ docker run -it --rm \
459475
-e DB_PASSWORD=Welcome12345 \
460476
-e DB_CONNECT_STRING=free23ai:1521/freepdb \
461477
-p 9161:9161 \
462-
container-registry.oracle.com/database/observability-exporter:1.5.0
478+
container-registry.oracle.com/database/observability-exporter:1.5.1
463479
```
464480

465481
##### Using a wallet
@@ -477,6 +493,9 @@ Now, you provide the connection details using these variables:
477493
- `DB_CONNECT_STRING` is the connection string, e.g., `devdb_tp?TNS_ADMIN=/wallet`
478494
- `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.
479495
- `ORACLE_HOME` is the location of the Oracle Instant Client, i.e., `/lib/oracle/21/client64/lib`. If you built your own container image, the path may be different.
496+
- `TNS_ADMIN` is the location of your (unzipped) wallet. The `DIRECTORY` set in the `sqlnet.ora` file must match the path that it will be mounted on inside the container.
497+
498+
> **Note:** Specify the path to your wallet using the `TNS_ADMIN` environment variable rather than adding it to the `DB_CONNECT_STRING`.
480499
481500
To run the exporter in a container and expose the port, use a command like this, with the appropriate values for the environment variables, and mounting your `wallet` directory as `/wallet` in the container to provide access to the wallet:
482501

@@ -487,8 +506,9 @@ docker run -it --rm \
487506
-e DB_CONNECT_STRING=devdb_tp \
488507
-v ./wallet:/wallet \
489508
-p 9161:9161 \
490-
container-registry.oracle.com/database/observability-exporter:1.5.0
509+
container-registry.oracle.com/database/observability-exporter:1.5.1
491510
```
511+
> **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`
492512
493513
### Test/demo environment with Docker Compose
494514

@@ -651,6 +671,7 @@ You may provide the connection details using these variables:
651671
- `DB_CONNECT_STRING` is the connection string, e.g., `localhost:1521/freepdb1`
652672
- `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.
653673
- `ORACLE_HOME` is the location of the Oracle Instant Client, e.g., `/lib/oracle/21/client64/lib`.
674+
- `TNS_ADMIN` is the location of your (unzipped) wallet. The `DIRECTORY` set in the `sqlnet.ora` file must match the path that it will be mounted on inside the container.
654675

655676
The following example puts the logfile in the current location with the filename `alert.log` and loads the default matrics file (`default-metrics,toml`) from the current location.
656677

@@ -775,7 +796,7 @@ An exmaple of [custom metrics for Transacational Event Queues](./custom-metrics-
775796
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:
776797

777798
```Dockerfile
778-
FROM container-registry.oracle.com/database/observability-exporter:1.5.0
799+
FROM container-registry.oracle.com/database/observability-exporter:1.5.1
779800
COPY custom-metrics.toml /
780801
ENTRYPOINT ["/oracledb_exporter", "--custom.metrics", "/custom-metrics.toml"]
781802
```

Diff for: collector/collector.go

+6
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,7 @@ type Exporter struct {
3535
user string
3636
password string
3737
connectString string
38+
configDir string
3839
duration, error prometheus.Gauge
3940
totalScrapes prometheus.Counter
4041
scrapeErrors *prometheus.CounterVec
@@ -53,6 +54,7 @@ type Config struct {
5354
Password string
5455
ConnectString string
5556
DbRole string
57+
ConfigDir string
5658
MaxIdleConns int
5759
MaxOpenConns int
5860
CustomMetrics string
@@ -114,6 +116,7 @@ func NewExporter(logger log.Logger, cfg *Config) (*Exporter, error) {
114116
user: cfg.User,
115117
password: cfg.Password,
116118
connectString: cfg.ConnectString,
119+
configDir: cfg.ConfigDir,
117120
duration: prometheus.NewGauge(prometheus.GaugeOpts{
118121
Namespace: namespace,
119122
Subsystem: exporterName,
@@ -367,6 +370,9 @@ func (e *Exporter) connect() error {
367370
var P godror.ConnectionParams
368371
P.Username, P.Password, P.ConnectString = e.user, godror.NewPassword(e.password), e.connectString
369372

373+
// if TNS_ADMIN env var is set, set ConfigDir to that location
374+
P.ConfigDir = e.configDir
375+
370376
if strings.ToUpper(e.config.DbRole) == "SYSDBA" {
371377
P.IsSysDBA = true
372378
}

Diff for: default-metrics.toml

+5
Original file line numberDiff line numberDiff line change
@@ -95,6 +95,11 @@ order by elapsed_time desc
9595
) where ROWNUM <= 15
9696
'''
9797
ignorezeroresult = true
98+
# scrapeinterval = "5m"
99+
# The previous line is an example of changing the interval at which this one metric
100+
# will be scraped. You may wish to do this to scrape a metric less often, if the SQL
101+
# statement to collect that metric places more load on your database instance than
102+
# desired when it is run at every scrape.
98103

99104
[[metric]]
100105
context = "cache_hit_ratio"

Diff for: docker-compose/compose.yaml

+1-1
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ services:
4343
start_period: 30s
4444

4545
exporter:
46-
image: container-registry.oracle.com/database/observability-exporter:1.5.0
46+
image: container-registry.oracle.com/database/observability-exporter:1.5.1
4747
container_name: exporter
4848
ports:
4949
- 9161:9161

Diff for: go.mod

+14-12
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,18 @@
11
module github.com/oracle/oracle-db-appdev-monitoring
22

3-
go 1.21
3+
go 1.22
44

5-
toolchain go1.21.4
5+
toolchain go1.22.4
66

77
require (
88
github.com/BurntSushi/toml v1.4.0
99
github.com/alecthomas/kingpin/v2 v2.4.0
1010
github.com/go-kit/log v0.2.1
11-
github.com/godror/godror v0.44.7
12-
github.com/oracle/oci-go-sdk/v65 v65.75.0
13-
github.com/prometheus/client_golang v1.20.2
14-
github.com/prometheus/common v0.59.1
15-
github.com/prometheus/exporter-toolkit v0.11.0
11+
github.com/godror/godror v0.44.8
12+
github.com/oracle/oci-go-sdk/v65 v65.77.1
13+
github.com/prometheus/client_golang v1.20.5
14+
github.com/prometheus/common v0.60.1
15+
github.com/prometheus/exporter-toolkit v0.12.0
1616
)
1717

1818
require (
@@ -25,19 +25,21 @@ require (
2525
github.com/gofrs/flock v0.8.1 // indirect
2626
github.com/jpillora/backoff v1.0.0 // indirect
2727
github.com/klauspost/compress v1.17.9 // indirect
28+
github.com/mdlayher/socket v0.4.1 // indirect
29+
github.com/mdlayher/vsock v1.2.1 // indirect
2830
github.com/munnerz/goautoneg v0.0.0-20191010083416-a7dc8b61c822 // indirect
2931
github.com/mwitkow/go-conntrack v0.0.0-20190716064945-2f068394615f // indirect
3032
github.com/prometheus/client_model v0.6.1 // indirect
3133
github.com/prometheus/procfs v0.15.1 // indirect
3234
github.com/sony/gobreaker v0.5.0 // indirect
3335
github.com/xhit/go-str2duration/v2 v2.1.0 // indirect
34-
golang.org/x/crypto v0.26.0 // indirect
36+
golang.org/x/crypto v0.27.0 // indirect
3537
golang.org/x/exp v0.0.0-20240719175910-8a7402abbf56 // indirect
36-
golang.org/x/net v0.28.0 // indirect
37-
golang.org/x/oauth2 v0.22.0 // indirect
38+
golang.org/x/net v0.29.0 // indirect
39+
golang.org/x/oauth2 v0.23.0 // indirect
3840
golang.org/x/sync v0.8.0 // indirect
39-
golang.org/x/sys v0.23.0 // indirect
40-
golang.org/x/text v0.17.0 // indirect
41+
golang.org/x/sys v0.25.0 // indirect
42+
golang.org/x/text v0.18.0 // indirect
4143
google.golang.org/protobuf v1.34.2 // indirect
4244
gopkg.in/yaml.v2 v2.4.0 // indirect
4345
)

0 commit comments

Comments
 (0)