You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
e.logger.Error(fmt.Sprintf("there was an issue while loading specified default metrics file at: "+e.Metrics.Default+", proceeding to run with default metrics."),
Copy file name to clipboardExpand all lines: site/docs/configuration/custom-metrics.md
+38Lines changed: 38 additions & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -23,6 +23,10 @@ metrics:
23
23
24
24
You may also use `--custom.metrics` flag followed by a comma separated list of TOML or YAML files, or export `CUSTOM_METRICS` variable environment (`export CUSTOM_METRICS=my-custom-metrics.toml,my-other-custom-metrics.toml`)
25
25
26
+
### Metric Hot Reload
27
+
28
+
The exporter watches for changes in custom metrics. When these files change, the exporter hot reloads the metrics definition, and serves the new metrics on the next scrape.
29
+
26
30
### Metric Schema
27
31
28
32
Metrics files must contain a series of `[[metric]]` definitions, in TOML, or the equivalent definition in a YAML file. Each metric definition must follow the exporter's metric schema:
@@ -123,6 +127,40 @@ oracledb_test_value_2 2
123
127
You can find [working examples](https://github.com/oracle/oracle-db-appdev-monitoring/blob/main/custom-metrics-example/custom-metrics.toml) of custom metrics for slow queries, big queries and top 100 tables.
124
128
An example of [custom metrics for Transacational Event Queues](https://github.com/oracle/oracle-db-appdev-monitoring/blob/main/custom-metrics-example/txeventq-metrics.toml) is also provided.
125
129
130
+
#### Override Existing, Individual Metrics
131
+
132
+
You may override properties for existing metrics by supplying a new, custom metric definition with the same `context` and `metricsdesc` values. For example, if you have an existing metric like so:
133
+
134
+
```toml
135
+
[[metric]]
136
+
context = "my_default_metric"
137
+
metricsdesc = { value_1 = "Simple example returning always 1.", value_2 = "Same but returning always 2." }
138
+
request = "SELECT 1 as value_1, 2 as value_2 FROM DUAL"
139
+
```
140
+
141
+
You can redefine this metric in a custom metrics file to change any properties other than `context` or `metricsdesc`. For example, overriding the previous metric with `labels`, `scrapeinterval`, and `querytimeout` properties:
142
+
143
+
```toml
144
+
[[metric]]
145
+
context = "my_default_metric"
146
+
metricsdesc = { value_1 = "Simple example returning always 1.", value_2 = "Same but returning always 2." }
147
+
labels = [ "label_1", "label_2" ]
148
+
request = "SELECT 1 as value_1, 2 as value_2 FROM DUAL"
149
+
scrapeinterval = "30s"
150
+
querytimeout = "10s"
151
+
```
152
+
153
+
Then, provide any metrics overrides as custom metrics files in the [exporter configuration file](config-file.md):
154
+
155
+
```yaml
156
+
metrics:
157
+
## Paths to any custom metrics files
158
+
custom:
159
+
- my-custom-metrics.toml
160
+
```
161
+
162
+
If any metric appears more than once in the custom metrics file list, the metric definition in the last file provided takes precedence.
163
+
126
164
### YAML Metrics
127
165
128
166
Metrics may be defined with YAML instead of TOML. YAML metric field names correspond to TOML metric field names.
Copy file name to clipboardExpand all lines: site/docs/releases/changelog.md
+1Lines changed: 1 addition & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -13,6 +13,7 @@ Our current priorities to support metrics for advanced database features and use
13
13
14
14
- Updated project dependencies.
15
15
- Standardize multi-arch builds and document supported database versions.
16
+
- The metrics override capability is extended, allowing users to redefine individual existing metrics in custom metrics files. This allows users to modify individual default metrics without wholly replacing the default metrics file.
16
17
- If the exporter fails to connect to a database due to invalid or locked credentials (ORA-01017 or ORA-28000 errors), that database configuration will be invalidated and the exporter will not attempt to re-establish the database connection. Other databases will continue to be scraped.
17
18
- Metrics with an empty databases array (`databases = []`) are now considered disabled, and will not be scraped.
18
19
- Increased the default query timeout for the `top_sql` metric to 10 seconds (previously 5 seconds).
0 commit comments