oracle / oci-grafana-metrics

Grafana datasource plugin for OCI metrics
https://grafana.com/grafana/plugins/oci-metrics-datasource
Universal Permissive License v1.0
79 stars 40 forks source link

Using a complex MQL expression instead of just a metric name #130

Closed juergenfl closed 1 year ago

juergenfl commented 2 years ago

Hi all, is it possible to define a kind of raw query with a complex MQL string instead of a single metric name?

Example: Prometheus node exporter is providing these metrics (among others):

node_filesystem_size_bytes node_filesystem_avail_bytes

To use them to plot the filesystem utilization, we have to use this MQL query:

( node_filesystem_size_bytes[1m]{mountpoint=\"/\"}.grouping().mean() - node_filesystem_avail_bytes[1m]{mountpoint=\"/\"}.grouping().mean() ) / node_filesystem_size_bytes[1m]{mountpoint=\"/\"}.grouping().mean() * 100

Any idea how to achieve this with the current plugin?

huskerdhf commented 2 years ago

Hi @juergenfl, unfortunately there is no way to use either the grouping() or the groupBy() function of the MQL language with the metrics plugin at this point. There are really two related but separate enhancements to the plugin either of which would address your comment:

  1. Enhance the metrics query editor window to include the ability to enable the grouping() function
  2. Have the query editor support a raw mode
juergenfl commented 2 years ago

ok, thanks!