On 23/12/2020 15:18, akshay sharma wrote:
Hi Christian,

Thanks for you reply,

ONTSTAT{IDF="false",Interval="0",METype="NT",ResourceID="t",instance="localhost:8999 <http://172.27.173.103:8999> ",job="prometheus",rxByte="33",time="1608711202557257990",txByte="18"}  4

what i've understood from your reply is , you are saying to break the metric into two metrics, one refers to rxbyte info with value and other one with txbyte info with value.
and then perform action (like rx-tx) on using both of them.?????

That is correct. Metrics are the values you are wanting to store over time. Labels attached to those metrics are purely descriptions of those metrics (device name, location, service, etc.) and not values which change over time themselves.

ex: as you mentioned..
ontstat_rx_bytes{device_id="1"} 31
ontstat_tx_bytes{device_id="1"} 16

I've one query, suppose I'm receiving the same metrics with different rx and tx values, but labels are the same(deviceid), and I want to perform some calculation between 1st (rx tx metrics ) and last (tx rx metrics).
How can we achieve this?

It depends what calculation you are wanting to do. For example if you wanted to add the rx & tx values you could just do ontstat_rx_bytes + onststat_tx_bytes. For the example above you would get the result {device_id="1"} 47

can you please elaborate on the below comment??

semantically to sum up rx/tx metrics, you might consider making it a
single metric with a label to distinguish, e.g.
ontstat_traffic_bytes{device_id="1",queue="tx"}.

The design of your metrics should reflect their meaning. As mentioned labels are there to describe different subsets of a metric (e.g different devices). It should be possible to remove all labels via an aggregation such as sum() and still have a value which is meaningful.

For example if you had a metric counting number of requests it would make sense to have labels for status code or method. However it would not make sense to have a metric where the values with a label of "type=time" are durations and "type=number" are counts - that would be two different metrics.

--
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 prometheus-users+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/prometheus-users/fe6099d5-22be-fc31-c7d6-8f4419447f4d%40Jahingo.com.

Reply via email to