I would like to use a label value in order to calculate the throughput of one file
I receive the messages on pushgateway as follow
avg_treatment_duration{"treatment_name":"A","step":"E1","length":"1000","fileName"="file1"} 0.3s
avg_treatment_duration{"treatment_name":"A","step":"E2","length":"1000","fileName"="file1"} 0.6s
avg_treatment_duration{"treatment_name":"B","step":"E3","length":"1000","fileName"="file1"} 0.8s
avg_treatment_duration{"treatment_name":"B","step":"E4","length":"1000","fileName"="file1"} 0.6s
avg_treatment_duration{"treatment_name":"A","step":"E1","length":"3000","fileName"="file2"} 0.7s
avg_treatment_duration{"treatment_name":"A","step":"E2","length":"3000","fileName"="file2"} 0.6s
avg_treatment_duration{"treatment_name":"B","step":"E3","length":"3000","fileName"="file2"} 0.3s
avg_treatment_duration{"treatment_name":"B","step":"E4","length":"3000","fileName"="file2"} 0.6s
The values corresponds to the duration of treatment.
The operations are as follow
- sum of the duration per file
- ratio : length / sum of the duration per file (but how can I get the label value length )
- average of the result of step 2
For the moment, I supposed that I receive the ratio on values, so the query is
avg(sum by(fileName) (avg_treatment_duration{}))
Is it possible to get the label value for one metric per file and do arithmetic operations on it?
Thank you !
AFAIK, you can't. If you need to use labels as arguments for some arithmetic operations, you'd better expose them as separate metrics.
and later you could use query