Reposting from the IRC chat:

I have been running into an issue with dividing:

vector with one label
by
vector with different labels

I understand that prometheus divides vectors via label matching. However, 
sometimes dividing by vectors with non-matching labels "makes sense"

Take my particular use case:

I am trying to integrate two exporters, process-exporter and node-exporter, 
correlating process memory metrics with node memory metrics.

To calculate memory use, I divide a process' memory use by the total memory 
on the machine

Node-exporter exposes this as node_memory_MemTotal_bytes

Now this metric will never change, this is basically a "scalar"

What is the proper way to divide the first vector by the second vector?

The only real workaround I can get to work, is to put a dummy label on both 
metrics via label replace and divide them that way. But this is an extra 
calculation everytime I want to do this, for something that, in my case 
when integrating two exporters together, will happen a lot.

For example,
- record: procex_memory_megabytes_by_process expr: 
label_replace(procex_memory_megabytes_by_process, "dummy_label", 
"dummy_val", "", "") - record: node_memory_MemTotal_bytes expr: 
label_replace(node_cpu_seconds_total, "dummy_label", "dummy_val", "", "") # 
final metric - record: memory_usage_percentage expr: 
procex_memory_megabytes_by_process / ignoring(groupname) group_left 
node_memory_MemTotal_bytes 

I don't see anything in the docs mentioning this and have searched the 
issues but haven't found much.

Any help is greatly appreciated!

-- 
You received this message because you are subscribed to the Google Groups 
"Prometheus Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/prometheus-users/f83cce66-5b0a-4b34-a840-e2faa575e5d3n%40googlegroups.com.

Reply via email to