oracledb_exporter icon indicating copy to clipboard operation
oracledb_exporter copied to clipboard

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

Open d-bhadra2 opened this issue 2 years ago • 1 comments

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

  • [ Y] bug report
  • [ ] feature 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

d-bhadra2 avatar Oct 27 '23 14:10 d-bhadra2

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?

Yannig avatar Nov 22 '23 06:11 Yannig