Skip to content

Commit 0eda99a

Browse files
Package updates (#187)
* Package updates Signed-off-by: Anders Swanson <[email protected]>
1 parent 5b331be commit 0eda99a

File tree

11 files changed

+311
-388
lines changed

11 files changed

+311
-388
lines changed

README.md

Lines changed: 9 additions & 165 deletions
Original file line numberDiff line numberDiff line change
@@ -25,173 +25,17 @@ Contributions are welcome - please see [contributing](CONTRIBUTING.md).
2525
- [Monitoring Transactional Event Queues](#monitoring-transactional-event-queues)
2626
- [Developer notes](#developer-notes)
2727

28-
## Release Notes
28+
## Releases
2929

30-
### Version 1.5.4, February 27, 2025
30+
| Release | Date | Changelog |
31+
|---------|----------------------|-----------------------------------------------------------------|
32+
| 1.5.4 | March 3rd, 2025 | [1.5.4 Changelog](./changelog.md#version-154-march-3-2025) |
33+
| 1.5.3 | January 28th, 2025 | [1.5.3 Changelog](./changelog.md#version-153-january-28-2025) |
34+
| 1.5.2 | December 2nd, 2024 | [1.5.2 Changelog](./changelog.md#version-152-december-2-2024) |
35+
| 1.5.1 | October 28th, 2024 | [1.5.1 Changelog](./changelog.md#version-151-october-28-2024) |
36+
| 1.5.0 | September 26th, 2024 | [1.5.0 Changelog](./changelog.md#version-150-september-26-2024) |
3137

32-
Our current priorities are support for RAC and mutliple databases (inculding #84 and #89), and intermittent connection issues
33-
with ADB-S when exporter is run in a container (including #169). We expect to address these in an upcoming release.
34-
35-
- Fix malloc error (#177)
36-
- Add support for additional admin roles, exapnding list of options for `DB_ROILE` to `SYSDBA`, `SYSOPER`, `SYSBACKUP`, `SYSDG`, `SYSKM`, `SYSRAC` and `SYSASM` (#180)
37-
- Updated some third-party dependencies.
38-
39-
Thank you to the following people for their suggestions and contributions:
40-
41-
- [@Jman1993](https://github.com/Jman1993)
42-
- [@oey](https://github.com/oey)
43-
- [@jlembeck06](https://github.com/jlembeck06)
44-
- [@Jman1993](https://github.com/Jman1993)
45-
- [@PeterP55P](https://github.com/PeterP55P)
46-
- [@rlagyu0](https://github.com/rlagyu0)
47-
48-
In this release, we also continued some minor code refactoring.
49-
50-
### Version 1.5.3, January 28, 2025
51-
52-
*Known issue*: This release has a known issue that results in the error message `malloc(): unsorted double linked list corrupted`.
53-
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.
54-
55-
Our current priorities are support for RAC and mutliple databases (inculding #84 and #89), and intermittent connection issues
56-
with ADB-S when exporter is run in a container (including #169). We expect to address these in an upcoming release.
57-
58-
This release includes the following changes:
59-
60-
- Fix over-zealous supression of errors when `ignorezeroresult = true` (#168).
61-
- When `scrapeinterval` is set, do first scrape immediately, not after the interval (#166).
62-
- Updated some third-party dependencies.
63-
64-
Thank you to the following people for their suggestions and contributions:
65-
66-
- [@redelang](https://github.com/redelang)
67-
68-
In this release, we also started some minor code refactoring.
69-
70-
### Version 1.5.2, December 2, 2024
71-
72-
This release includes the following changes:
73-
74-
- Update the metric defintion for tablespace usage to report more accurate temp space usage.
75-
- Revert InstantClient to 21c version due to ADB connectivity issue.
76-
- Update documentation to explain how to obtain credentials from a wallet.
77-
- Fix race condition on err variable in scrape() func (by @valrusu).
78-
- Updated some third-party dependencies.
79-
80-
Thank you to the following people for their suggestions and contributions:
81-
82-
- [@aureliocirella](https://github.com/aureliocirella)
83-
- [@mitoeth](https://github.com/mitoeth)
84-
- [@valrusu](https://github.com/valrusu)
85-
86-
### Version 1.5.1, October 28, 2024
87-
88-
This release includes the following changes:
89-
90-
- Added support for using the `TNS_ADMIN` environment variable, which fixes an issue when connecting to Autonomous Database instances using TNS name.
91-
- Updated InstantClient to 23ai version for amd64 and latest available 19.24 version for arm64.
92-
- Fixed an issue with wrong `LD_LIBRARY_PATH` on some platforms. (#136)
93-
- Added documentation and an example of using the `scrapeinterval` setting to change the interval at which a certain metric is colected.
94-
- Added notes to documentation for extra security parameters needed when using a wallet with Podman.
95-
- Updated some third-party dependencies.
96-
97-
### Version 1.5.0, September 26, 2024
98-
99-
This release includes the following changes:
100-
101-
- Support for running the exporter on ARM processors (darwin and linux).
102-
- Updated some third-party dependencies.
103-
- Updated the "test/demo environment" to use newer version of Oracle Database (23.5.0.24.07) and faster startup.
104-
105-
### Version 1.4.0, September 4, 2024
106-
107-
This release includes the following changes:
108-
109-
- Allow multiple custom metrics definition files.
110-
- Allow query timeout per-metric.
111-
- Allow scrape interval per-metric.
112-
- Updated some third-party dependencies.
113-
114-
### Version 1.3.1, July 22, 2024
115-
116-
This release includes the following changes:
117-
118-
- Alert logs can be disabled by setting parameter `log.disable` to `1`.
119-
- Alert log exporter will stop if it gets three consecutive failures.
120-
- Updated the list of required permissions.
121-
- Updated the TxEventQ sample dashboard.
122-
- Updated some third-party dependencies.
123-
124-
Thank you to the following people for their suggestions and contributions:
125-
126-
- [@tux-jochen](https://github.com/tux-jochen)
127-
128-
### Version 1.3.0, June 7, 2024
129-
130-
This release includes the following changes:
131-
132-
- Alert logs can be exported for collection by a log reader like Promtail or FluentBit. Default
133-
output to `/log/alert.log` in JSON format.
134-
- Provide ability to connect as SYSDBA or SYSOPER by setting DB_ROLE.
135-
- New default metric is added to report the type of database connected to (CDB or PDB).
136-
- New default metrics are added for cache hit ratios.
137-
- Default metrics updated to suppress spurious warnings in log.
138-
- Wait class metric updated to use a better query.
139-
- The sample dashboard is updated to include new metrics.
140-
- Fixed a bug which prevented periodic freeing of memory.
141-
- Set CLIENT_INFO to a meaningful value.
142-
- Update Go toolchain to 1.22.4.
143-
- Updated some third-party dependencies.
144-
145-
Thank you to the following people for their suggestions and contributions:
146-
147-
- [@pioro](https://github.com/pioro)
148-
- [@savoir81](https://github.com/savoir81)
149-
150-
### Version 1.2.1, April 16, 2024
151-
152-
This release includes the following changes:
153-
154-
- Accept max idle and open connections settings as parameters.
155-
- Updated some third-party dependencies.
156-
157-
### Version 1.2.0, January 17, 2024
158-
159-
This release includes the following changes:
160-
161-
- Introduced a new feature to periodically restart the process if requested.
162-
- Introduced a new feature to periodically attempt to free OS memory if requested.
163-
- Updated some third-party dependencies.
164-
165-
### Version 1.1.1, November 28, 2023
166-
167-
This release just updates some third-party dependencies.
168-
169-
### Version 1.1, October 27, 2023
170-
171-
This release includes the following changes:
172-
173-
- The query for the standard metric `wait_class` has been updated so that it will work in both container databases
174-
and pluggable databases, including in Oracle Autonomous Database instances. Note that this query will not return
175-
any data unless the database instance is under load.
176-
- Support for reading the database password from OCI Vault has been added (see [details](#using-oci-vault))
177-
- Log messages have been improved
178-
- Some dependencies have been updated
179-
180-
### Version 1.0, September 13, 2023
181-
182-
The first production release, v1.0, includes the following features:
183-
184-
- A number of [standard metrics](#standard-metrics) are exposed,
185-
- Users can define [custom metrics](#custom-metrics),
186-
- Oracle regularly reviews third-party licenses and scans the code and images, including transitive/recursive dependencies for issues,
187-
- Connection to Oracle can be a basic connection or use an Oracle Wallet and TLS - connection to Oracle Autonomous Database is supported,
188-
- Metrics for Oracle Transactional Event Queues are also supported,
189-
- A Grafana dashboard is provided for Transactional Event Queues, and
190-
- A pre-built container image is provided, based on Oracle Linux, and optimized for size and security.
191-
192-
Note that this exporter uses a different Oracle Database driver which in turn uses code directly written by Oracle to access the database. This driver does require an Oracle client. In this initial release, the client is bundled into the container image, however we intend to make that optional in order to minimize the image size.
193-
194-
The interfaces for this version have been kept as close as possible to those of earlier alpha releases in this repository to assist with migration. However, it should be expected that there may be breaking changes in future releases.
38+
For releases notes on older releases, see the [Changelog](./changelog.md)
19539

19640
## Roadmap
19741

alertlog/alertlog.go

Lines changed: 14 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// Copyright (c) 2024, Oracle and/or its affiliates.
1+
// Copyright (c) 2024, 2025, Oracle and/or its affiliates.
22
// Licensed under the Universal Permissive License v 1.0 as shown at https://oss.oracle.com/licenses/upl.package vault
33

44
package alertlog
@@ -9,11 +9,9 @@ import (
99
"errors"
1010
"fmt"
1111
"io"
12+
"log/slog"
1213
"os"
1314
"strings"
14-
15-
"github.com/go-kit/log"
16-
"github.com/go-kit/log/level"
1715
)
1816

1917
type LogRecord struct {
@@ -25,10 +23,10 @@ type LogRecord struct {
2523

2624
var queryFailures int = 0
2725

28-
func UpdateLog(logDestination string, logger log.Logger, db *sql.DB) {
26+
func UpdateLog(logDestination string, logger *slog.Logger, db *sql.DB) {
2927

3028
if queryFailures == 3 {
31-
level.Info(logger).Log("msg", "Failed to query the alert log three consecutive times, so will not try any more")
29+
logger.Info("Failed to query the alert log three consecutive times, so will not try any more")
3230
queryFailures++
3331
return
3432
}
@@ -39,10 +37,10 @@ func UpdateLog(logDestination string, logger log.Logger, db *sql.DB) {
3937

4038
// check if the log file exists, and if not, create it
4139
if _, err := os.Stat(logDestination); errors.Is(err, os.ErrNotExist) {
42-
level.Info(logger).Log("msg", "Log destination file does not exist, will try to create it: "+logDestination)
40+
logger.Info("Log destination file does not exist, will try to create it: " + logDestination)
4341
f, e := os.Create(logDestination)
4442
if e != nil {
45-
level.Error(logger).Log("msg", "Failed to create the log file: "+logDestination)
43+
logger.Error("Failed to create the log file: " + logDestination)
4644
return
4745
}
4846
f.Close()
@@ -52,7 +50,7 @@ func UpdateLog(logDestination string, logger log.Logger, db *sql.DB) {
5250
file, err := os.Open(logDestination)
5351

5452
if err != nil {
55-
level.Error(logger).Log("msg", "Could not open the alert log destination file: "+logDestination)
53+
logger.Error("Could not open the alert log destination file: " + logDestination)
5654
return
5755
}
5856

@@ -101,7 +99,7 @@ func UpdateLog(logDestination string, logger log.Logger, db *sql.DB) {
10199
var lastLogRecord LogRecord
102100
err = json.Unmarshal([]byte(line), &lastLogRecord)
103101
if err != nil {
104-
level.Error(logger).Log("msg", "Could not parse last line of log file")
102+
logger.Error("Could not parse last line of log file")
105103
return
106104
}
107105

@@ -112,7 +110,7 @@ func UpdateLog(logDestination string, logger log.Logger, db *sql.DB) {
112110

113111
rows, err := db.Query(stmt)
114112
if err != nil {
115-
level.Error(logger).Log("msg", "Error querying the alert logs")
113+
logger.Error("Error querying the alert logs")
116114
queryFailures++
117115
return
118116
}
@@ -121,7 +119,7 @@ func UpdateLog(logDestination string, logger log.Logger, db *sql.DB) {
121119
// write them to the file
122120
outfile, err := os.OpenFile(logDestination, os.O_APPEND|os.O_WRONLY, 0600)
123121
if err != nil {
124-
level.Error(logger).Log("msg", "Could not open log file for writing: "+logDestination)
122+
logger.Error("Could not open log file for writing: " + logDestination)
125123
return
126124
}
127125
defer outfile.Close()
@@ -130,7 +128,7 @@ func UpdateLog(logDestination string, logger log.Logger, db *sql.DB) {
130128
for rows.Next() {
131129
var newRecord LogRecord
132130
if err := rows.Scan(&newRecord.Timestamp, &newRecord.ModuleId, &newRecord.ECID, &newRecord.Message); err != nil {
133-
level.Error(logger).Log("msg", "Error reading a row from the alert logs")
131+
logger.Error("Error reading a row from the alert logs")
134132
return
135133
}
136134

@@ -139,18 +137,18 @@ func UpdateLog(logDestination string, logger log.Logger, db *sql.DB) {
139137

140138
jsonLogRecord, err := json.Marshal(newRecord)
141139
if err != nil {
142-
level.Error(logger).Log("msg", "Error marshalling alert log record")
140+
logger.Error("Error marshalling alert log record")
143141
return
144142
}
145143

146144
if _, err = outfile.WriteString(string(jsonLogRecord) + "\n"); err != nil {
147-
level.Error(logger).Log("msg", "Could not write to log file: "+logDestination)
145+
logger.Error("Could not write to log file: " + logDestination)
148146
return
149147
}
150148
}
151149

152150
if err = rows.Err(); err != nil {
153-
level.Error(logger).Log("msg", "Error querying the alert logs")
151+
logger.Error("Error querying the alert logs")
154152
queryFailures++
155153
}
156154
}

0 commit comments

Comments
 (0)