iamseth / oracledb_exporter

Prometheus Oracle database exporter.
MIT License
484 stars 237 forks source link

define a variable in custom-metrics.toml and pass it in a pl/sql function #375

Open d-bhadra2 opened 11 months ago

d-bhadra2 commented 11 months ago

I'm submitting a bug on adding a variable in custom-metrics.toml and passing it into a pl/sql function called from request

What is the current behavior?

I can see the only a select query can be called from custom-metrics.toml without passing any variable

If the current behavior is a bug, please provide the steps to reproduce and if possible a minimal demo of the problem

This code I have added in custom-metrics.toml .If I am providing a hard coded string in the function argument then it is returning a value in the metrics variable but not working I am passing a variable [[TABLE]] TABLENAME = "Product" [[metric]] context = "count_of_product" metricsdesc = {row_count ="total row_count from product tables."} labels = ["row_count"] request = "select oraexporter_row_count("${tablename}") as row_count" metricstype = { row_count = "counter" }

if I am passing variable I am receiving error

level=error msg="Near line 16 (last key parsed 'metric'): expected a top-level item to end with a newline, comment, or EOF, but got '$' instead" source="main.go:525"

What is the expected behavior?

I can define a variable or environment variable in deployment file and pass it into the queries

What is the motivation / use case for changing the behavior?

Please tell us about your environment:

Version: X.Y.Z

Yannig commented 11 months ago

You cant use at the same time a field as a metric (here row_count) and as a label. Could you try to remove the labels entry?