oracledb_exporter
oracledb_exporter copied to clipboard
How to fix Prometheus same name and same label error(2021.10.19)
default-metrics.toml
[[metric]]
context = "sessions"
metricsdesc = {rownum ="rownum", value= "value" }
request = "SELECT rownum ,1 as value FROM v$session"
oracle SQL Developer query result
- There are 62 pieces of data, and what you would expect when inserted like that is field name
- prometheus.metrics.oracledb_session_rownum
- There are 1 to 62 data.
- prometheus.metrics.oracledb_sessions_value
- There must be 62 1's.
- But I get the following error
- prometheus.metrics.oracledb_session_rownum
current Error
time="2021-10-19T17:15:41+09:00" level=error msg="error gathering metrics: 126 error(s) occurred:\n* collected metric \"oracledb_sessions_rownum\" { gauge:<value:2 > } was collected before with the same name and label values\n* collected metric \"oracledb_sessions_value\" { gauge:<value:1 > } was collected before with the same name and label values\n* collected metric \"oracledb_sessions_rownum\" { gauge:<value:3 > } was collected before with the same name and label values\n* collected metric \"oracledb_sessions_value\" { gauge:<value:1 > } was collected before with the same name and label values\n* collected metric \"oracledb_sessions_rownum\" { gauge:<value:4 > } was collected before with the same name and label values\n* collected metric \"oracledb_sessions_value\" { gauge:<value:1 > } was collected before with the same name and label values\n* collected metric \"oracledb_sessions_rownum\" { gauge:<value:5 > } was collected before with the same name and label values\n* collected metric \"oracledb_sessions_value\" { gauge:<value:1 > } was collected before with the same name and label values\n* collected metric \"oracledb_sessions_value\" { gauge:<value:1 > } was collected before with the same name and label values\n* collected metric \"oracledb_sessions_rownum\" { gauge:<value:6 > } was collected before with the same name and label values\n* collected metric \"oracledb_sessions_rownum\" { gauge:<value:7 > } was collected before with the same name and label values\n* collected metric \"oracledb_sessions_value\" { gauge:<value:1 > } was collected before with the same name and label values\n* collected metric \"oracledb_sessions_rownum\" { gauge:<value:8 > } was collected before with the same name and label values\n* collected metric \"oracledb_sessions_value\" { gauge:<value:1 > } was collected before with the same name and label values\n* collected metric \"oracledb_sessions_rownum\" { gauge:<value:9 > } was collected before with the same name and label values\n* collected metric \"oracledb_sessions_value\" { gauge:<value:1 > } was collected before with the same name and label values\n* collected metric \"oracledb_sessions_rownum\" { gauge:<value:10 > } was collected before with the same name and label values\n* collected metric \"oracledb_sessions_value\" { gauge:<value:1 > } was collected before with the same name and label values\n* collected metric \"oracledb_sessions_rownum\" { gauge:<value:11 > } was collected before with the same name and label values\n* collected metric \"oracledb_sessions_value\" { gauge:<value:1 > } was collected before with the same name and label values\n* collected metric \"oracledb_sessions_rownum\" { gauge:<value:12 > } was collected before with the same name and label values\n* collected metric \"oracledb_sessions_value\" { gauge:<value:1 > } was collected before with the same name and label values\n* collected metric \"oracledb_sessions_rownum\" { gauge:<value:13 > } was collected before with the same name and label values\n* collected metric \"oracledb_sessions_value\" { gauge:<value:1 > } was collected before with the same name and label values\n* collected metric \"oracledb_sessions_rownum\" { gauge:<value:14 > } was collected before with the same name and label values\n* collected metric \"oracledb_sessions_value\" { gauge:<value:1 > } was collected before with the same name and label values\n* collected metric \"oracledb_sessions_rownum\" { gauge:<value:15 > } was collected before with the same name and label values\n* collected metric \"oracledb_sessions_value\" { gauge:<value:1 > } was collected before with the same name and label values\n* collected metric \"oracledb_sessions_rownum\" { gauge:<value:16 > } was collected before with the same name and label values\n* collected metric \"oracledb_sessions_value\" { gauge:<value:1 > } was collected before with the same name and label values\n* collected metric \"oracledb_sessions_rownum\" { gauge:<value:17 > } was collected before with the same name and label values\n* collected metric \"oracledb_sessions_value\" { gauge:<value:1 > } was collected before with the same name and label values\n* collected metric \"oracledb_sessions_value\" { gauge:<value:1 > } was collected before with the same name and label values\n* collected metric \"oracledb_sessions_rownum\" { gauge:<value:18 > } was collected before with the same name and label values\n* collected metric \"oracledb_sessions_rownum\" { gauge:<value:19 > } was collected before with the same name and label values\n* collected metric \"oracledb_sessions_value\" { gauge:<value:1 > } was collected before with the same name and label values\n* collected metric \"oracledb_sessions_rownum\" { gauge:<value:20 > } was collected before with the same name and label values\n* collected metric \"oracledb_sessions_value\" { gauge:<value:1 > } was collected before with the same name and label values\n* collected metric \"oracledb_sessions_rownum\" { gauge:<value:21 > } was collected before with the same name and label values\n* collected metric \"oracledb_sessions_value\" { gauge:<value:1 > } was collected before with the same name and label values\n* collected metric \"oracledb_sessions_rownum\" { gauge:<value:22 > } was collected before with the same name and label values\n* collected metric \"oracledb_sessions_value\" { gauge:<value:1 > } was collected before with the same name and label values\n* collected metric \"oracledb_sessions_rownum\" { gauge:<value:23 > } was collected before with the same name and label values\n* collected metric \"oracledb_sessions_value\" { gauge:<value:1 > } was collected before with the same name and label values\n* collected metric \"oracledb_sessions_rownum\" { gauge:<value:24 > } was collected before with the same name and label values\n* collected metric \"oracledb_sessions_value\" { gauge:<value:1 > } was collected before with the same name and label values\n* collected metric \"oracledb_sessions_rownum\" { gauge:<value:25 > } was collected before with the same name and label values\n* collected metric \"oracledb_sessions_value\" { gauge:<value:1 > } was collected before with the same name and label values\n* collected metric \"oracledb_sessions_rownum\" { gauge:<value:26 > } was collected before with the same name and label values\n* collected metric \"oracledb_sessions_value\" { gauge:<value:1 > } was collected before with the same name and label values\n* collected metric \"oracledb_sessions_rownum\" { gauge:<value:27 > } was collected before with the same name and label values\n* collected metric \"oracledb_sessions_value\" { gauge:<value:1 > } was collected before with the same name and label values\n* collected metric \"oracledb_sessions_rownum\" { gauge:<value:28 > } was collected before with the same name and label values\n* collected metric \"oracledb_sessions_value\" { gauge:<value:1 > } was collected before with the same name and label values\n* collected metric \"oracledb_sessions_rownum\" { gauge:<value:29 > } was collected before with the same name and label values\n* collected metric \"oracledb_sessions_value\" { gauge:<value:1 > } was collected before with the same name and label values\n* collected metric \"oracledb_sessions_rownum\" { gauge:<value:30 > } was collected before with the same name and label values\n* collected metric \"oracledb_sessions_value\" { gauge:<value:1 > } was collected before with the same name and label values\n* collected metric \"oracledb_sessions_rownum\" { gauge:<value:31 > } was collected before with the same name and label values\n* collected metric \"oracledb_sessions_value\" { gauge:<value:1 > } was collected before with the same name and label values\n* collected metric \"oracledb_sessions_rownum\" { gauge:<value:32 > } was collected before with the same name and label values\n* collected metric \"oracledb_sessions_value\" { gauge:<value:1 > } was collected before with the same name and label values\n* collected metric \"oracledb_sessions_rownum\" { gauge:<value:33 > } was collected before with the same name and label values\n* collected metric \"oracledb_sessions_value\" { gauge:<value:1 > } was collected before with the same name and label values\n* collected metric \"oracledb_sessions_rownum\" { gauge:<value:34 > } was collected before with the same name and label values\n* collected metric \"oracledb_sessions_value\" { gauge:<value:1 > } was collected before with the same name and label values\n* collected metric \"oracledb_sessions_rownum\" { gauge:<value:35 > } was collected before with the same name and label values\n* collected metric \"oracledb_sessions_value\" { gauge:<value:1 > } was collected before with the same name and label values\n* collected metric \"oracledb_sessions_value\" { gauge:<value:1 > } was collected before with the same name and label values\n* collected metric \"oracledb_sessions_rownum\" { gauge:<value:36 > } was collected before with the same name and label values\n* collected metric \"oracledb_sessions_rownum\" { gauge:<value:37 > } was collected before with the same name and label values\n* collected metric \"oracledb_sessions_value\" { gauge:<value:1 > } was collected before with the same name and label values\n* collected metric \"oracledb_sessions_rownum\" { gauge:<value:38 > } was collected before with the same name and label values\n* collected metric \"oracledb_sessions_value\" { gauge:<value:1 > } was collected before with the same name and label values\n* collected metric \"oracledb_sessions_rownum\" { gauge:<value:39 > } was collected before with the same name and label values\n* collected metric \"oracledb_sessions_value\" { gauge:<value:1 > } was collected before with the same name and label values\n* collected metric \"oracledb_sessions_rownum\" { gauge:<value:40 > } was collected before with the same name and label values\n* collected metric \"oracledb_sessions_value\" { gauge:<value:1 > } was collected before with the same name and label values\n* collected metric \"oracledb_sessions_rownum\" { gauge:<value:41 > } was collected before with the same name and label values\n* collected metric \"oracledb_sessions_value\" { gauge:<value:1 > } was collected before with the same name and label values\n* collected metric \"oracledb_sessions_rownum\" { gauge:<value:42 > } was collected before with the same name and label values\n* collected metric \"oracledb_sessions_value\" { gauge:<value:1 > } was collected before with the same name and label values\n* collected metric \"oracledb_sessions_rownum\" { gauge:<value:43 > } was collected before with the same name and label values\n* collected metric \"oracledb_sessions_value\" { gauge:<value:1 > } was collected before with the same name and label values\n* collected metric \"oracledb_sessions_rownum\" { gauge:<value:44 > } was collected before with the same name and label values\n* collected metric \"oracledb_sessions_value\" { gauge:<value:1 > } was collected before with the same name and label values\n* collected metric \"oracledb_sessions_value\" { gauge:<value:1 > } was collected before with the same name and label values\n* collected metric \"oracledb_sessions_rownum\" { gauge:<value:45 > } was collected before with the same name and label values\n* collected metric \"oracledb_sessions_rownum\" { gauge:<value:46 > } was collected before with the same name and label values\n* collected metric \"oracledb_sessions_value\" { gauge:<value:1 > } was collected before with the same name and label values\n* collected metric \"oracledb_sessions_rownum\" { gauge:<value:47 > } was collected before with the same name and label values\n* collected metric \"oracledb_sessions_value\" { gauge:<value:1 > } was collected before with the same name and label values\n* collected metric \"oracledb_sessions_rownum\" { gauge:<value:48 > } was collected before with the same name and label values\n* collected metric \"oracledb_sessions_value\" { gauge:<value:1 > } was collected before with the same name and label values\n* collected metric \"oracledb_sessions_value\" { gauge:<value:1 > } was collected before with the same name and label values\n* collected metric \"oracledb_sessions_rownum\" { gauge:<value:49 > } was collected before with the same name and label values\n* collected metric \"oracledb_sessions_rownum\" { gauge:<value:50 > } was collected before with the same name and label values\n* collected metric \"oracledb_sessions_value\" { gauge:<value:1 > } was collected before with the same name and label values\n* collected metric \"oracledb_sessions_rownum\" { gauge:<value:51 > } was collected before with the same name and label values\n* collected metric \"oracledb_sessions_value\" { gauge:<value:1 > } was collected before with the same name and label values\n* collected metric \"oracledb_sessions_rownum\" { gauge:<value:52 > } was collected before with the same name and label values\n* collected metric \"oracledb_sessions_value\" { gauge:<value:1 > } was collected before with the same name and label values\n* collected metric \"oracledb_sessions_rownum\" { gauge:<value:53 > } was collected before with the same name and label values\n* collected metric \"oracledb_sessions_value\" { gauge:<value:1 > } was collected before with the same name and label values\n* collected metric \"oracledb_sessions_rownum\" { gauge:<value:54 > } was collected before with the same name and label values\n* collected metric \"oracledb_sessions_value\" { gauge:<value:1 > } was collected before with the same name and label values\n* collected metric \"oracledb_sessions_rownum\" { gauge:<value:55 > } was collected before with the same name and label values\n* collected metric \"oracledb_sessions_value\" { gauge:<value:1 > } was collected before with the same name and label values\n* collected metric \"oracledb_sessions_rownum\" { gauge:<value:56 > } was collected before with the same name and label values\n* collected metric \"oracledb_sessions_value\" { gauge:<value:1 > } was collected before with the same name and label values\n* collected metric \"oracledb_sessions_rownum\" { gauge:<value:57 > } was collected before with the same name and label values\n* collected metric \"oracledb_sessions_value\" { gauge:<value:1 > } was collected before with the same name and label values\n* collected metric \"oracledb_sessions_rownum\" { gauge:<value:58 > } was collected before with the same name and label values\n* collected metric \"oracledb_sessions_value\" { gauge:<value:1 > } was collected before with the same name and label values\n* collected metric \"oracledb_sessions_rownum\" { gauge:<value:59 > } was collected before with the same name and label values\n* collected metric \"oracledb_sessions_value\" { gauge:<value:1 > } was collected before with the same name and label values\n* collected metric \"oracledb_sessions_rownum\" { gauge:<value:60 > } was collected before with the same name and label values\n* collected metric \"oracledb_sessions_value\" { gauge:<value:1 > } was collected before with the same name and label values\n* collected metric \"oracledb_sessions_rownum\" { gauge:<value:61 > } was collected before with the same name and label values\n* collected metric \"oracledb_sessions_value\" { gauge:<value:1 > } was collected before with the same name and label values\n* collected metric \"oracledb_sessions_rownum\" { gauge:<value:62 > } was collected before with the same name and label values\n* collected metric \"oracledb_sessions_value\" { gauge:<value:1 > } was collected before with the same name and label values\n* collected metric \"oracledb_sessions_value\" { gauge:<value:1 > } was collected before with the same name and label values\n* collected metric \"oracledb_sessions_rownum\" { gauge:<value:63 > } was collected before with the same name and label values\n* collected metric \"oracledb_sessions_rownum\" { gauge:<value:64 > } was collected before with the same name and label values\n* collected metric \"oracledb_sessions_value\" { gauge:<value:1 > } was collected before with the same name and label values\n" source="log.go:184"
question
- I'm really using open source normally. I'm having a problem while I'm using it. Can you solve it?
- Looking at the above, if you want to receive data like that, is there a way to receive it and a way to solve the above error?
- I know you're busy, but I'd really appreciate it if you took the time to tell me how to fix the error.
Here’s what I would do:
[[metric]] context = "sessions" metricsdesc = {rownum ="rownum"} labels = [“value”] request = "SELECT rownum ,1 as value FROM v$session"
Because then you would get back an individual row number and it’s corresponding value (a true key-value pair), and would look like:
oracledb_sessions_rownum{value=1} 1 oracledb_sessions_rownum{value=1} 2
and prevent the exporter from panicking that there’s two values attempting to be inserted into the same context, which would also generate churn.
Alternatively, separate the value and row num into separate queries and no additional labels, so you’d have two different metricsdesc within the sessions context and you could aggregate as needed.
I also had this kind of issue with wait_class
and sessions
. All you need to do is to have labels that can identify your data in a unique manner such as type
or status
.
For sessions I did it this way:
[[metric]]
context = "sessions"
labels = [ "status", "type" ]
metricsdesc = { value= "Gauge metric with count of sessions by status and type." }
request = "SELECT status, type, COUNT(*) as value FROM v$session GROUP BY status, type"