@@ -31,6 +31,8 @@ The following metrics are exposed currently.
31
31
- oracledb_tablespace_bytes
32
32
- oracledb_tablespace_max_bytes
33
33
- oracledb_tablespace_bytes_free
34
+ - oracledb_resource_current_utilization
35
+ - oracledb_resource_limit_value
34
36
35
37
# Installation
36
38
@@ -67,12 +69,99 @@ Usage of oracledb_exporter:
67
69
If set use a syslog logger or JSON logging. Example: logger:syslog? appname=bob& local=7 or logger:stdout? json=true. Defaults to stderr.
68
70
-log.level value
69
71
Only log messages with the given severity or above. Valid levels: [debug, info, warn, error, fatal].
72
+ -custom.metrics string
73
+ File that may contain various custom metrics in a TOML file.
70
74
-web.listen-address string
71
75
Address to listen on for web interface and telemetry. (default " :9161" )
72
76
-web.telemetry-path string
73
77
Path under which to expose metrics. (default " /metrics" )
74
78
```
75
79
80
+ # Custom metrics
81
+
82
+ This exporter does not have the metrics you want? You can provide new one using TOML file. To specify this file to the exporter, you can:
83
+ - Use `` -custom.metrics `` flag followed by the TOML file
84
+ - Export CUSTOM_METRICS variable environment (`` export CUSTOM_METRICS=my-custom-metrics.toml `` )
85
+
86
+ This file must contain the following elements:
87
+ - One or several metric section (`` [[metric]] `` )
88
+ - For each section a context, a request and a map between a field of your request and a comment.
89
+
90
+ Here's a simple example:
91
+
92
+ ```
93
+ [[metric]]
94
+ context = "test"
95
+ request = "SELECT 1 as value_1, 2 as value_2 FROM DUAL"
96
+ metricsdesc = { value_1 = "Simple example returning always 1.", value_2 = "Same but returning always 2." }
97
+ ```
98
+
99
+ This file produce the following entries in the exporter:
100
+
101
+ ```
102
+ # HELP oracledb_test_value_1 Simple example returning always.
103
+ # TYPE oracledb_test_value_1 gauge
104
+ oracledb_test_value_1 1
105
+ # HELP oracledb_test_value_2 Same but returning always 2.
106
+ # TYPE oracledb_test_value_2 gauge
107
+ oracledb_test_value_2 2
108
+ ```
109
+
110
+ You can also provide labels using labels field. Here's an example providing two metrics, with and without labels:
111
+
112
+ ```
113
+ [[metric]]
114
+ context = "context_no_label"
115
+ request = "SELECT 1 as value_1, 2 as value_2 FROM DUAL"
116
+ metricsdesc = { value_1 = "Simple example returning always 1.", value_2 = "Same but returning always 2." }
117
+
118
+ [[metric]]
119
+ context = "context_with_labels"
120
+ labels = [ "label_1", "label_2" ]
121
+ request = "SELECT 1 as value_1, 2 as value_2, 'First label' as label_1, 'Second label' as label_2 FROM DUAL"
122
+ metricsdesc = { value_1 = "Simple example returning always 1.", value_2 = "Same but returning always 2." }
123
+ ```
124
+
125
+ This TOML file produce the following result:
126
+
127
+ ```
128
+ # HELP oracledb_context_no_label_value_1 Simple example returning always 1.
129
+ # TYPE oracledb_context_no_label_value_1 gauge
130
+ oracledb_context_no_label_value_1 1
131
+ # HELP oracledb_context_no_label_value_2 Same but returning always 2.
132
+ # TYPE oracledb_context_no_label_value_2 gauge
133
+ oracledb_context_no_label_value_2 2
134
+ # HELP oracledb_context_with_labels_value_1 Simple example returning always 1.
135
+ # TYPE oracledb_context_with_labels_value_1 gauge
136
+ oracledb_context_with_labels_value_1{label_1="First label",label_2="Second label"} 1
137
+ # HELP oracledb_context_with_labels_value_2 Same but returning always 2.
138
+ # TYPE oracledb_context_with_labels_value_2 gauge
139
+ oracledb_context_with_labels_value_2{label_1="First label",label_2="Second label"} 2
140
+ ```
141
+
142
+ Last, you can set metric type using ** metricstype** field.
143
+
144
+ ```
145
+ [[metric]]
146
+ context = "context_with_labels"
147
+ labels = [ "label_1", "label_2" ]
148
+ request = "SELECT 1 as value_1, 2 as value_2, 'First label' as label_1, 'Second label' as label_2 FROM DUAL"
149
+ metricsdesc = { value_1 = "Simple example returning always 1 as counter.", value_2 = "Same but returning always 2 as gauge." }
150
+ # Can be counter or gauge (default)
151
+ metricstype = { value_1 = "counter" }
152
+ ```
153
+
154
+ This TOML file will produce the following result:
155
+
156
+ ```
157
+ # HELP oracledb_test_value_1 Simple test example returning always 1 as counter.
158
+ # TYPE oracledb_test_value_1 counter
159
+ oracledb_test_value_1 1
160
+ # HELP oracledb_test_value_2 Same test but returning always 2 as gauge.
161
+ # TYPE oracledb_test_value_2 gauge
162
+ oracledb_test_value_2 2
163
+ ```
164
+
76
165
# Integration with Grafana
77
166
78
167
An example Grafana dashboard is available [ here] ( https://grafana.com/dashboards/3333 ) .
0 commit comments