On 19/04/2020 12:58, SHRIKRISHNA KHUPASANGIKAR wrote:

I have two counters like below . Both counter have common label interface_name.

Counter A= {app_kubernetes_io_component="xyz-rest-ep",interface_name="N7",command="create","job="kubernetes-pods",monitor="prometheus",namespace="xyz-foo",pod="xyz-rest-ep-9f5686bc-dvtjr",pod_template_hash="9f5686bc",}



Counter B= {app_kubernetes_io_component="xyz-rest-ep",interface_name="N7",command="delete",job="kubernetes-pods",monitor="prometheus",namespace="xyz-foo",pod="xyz-rest-ep-9f5686bc-dvtjr",pod_template_hash="9f5686bc",target_base_url="http://192.168.102.50:7044/"}



I would like to have addition of counter A and counter B by interface_name lable.

Note that Counter B have extra label as target_base_url which is absent in Counter A

Kindly let us know how to achieve this in Prometheus query.


You can add them if they have the same labels, so use an aggregation operator (e.g. sum()) with "by" or "without".

--
Stuart Clark

--
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/7801e730-757d-8747-f981-eb13340f4ae4%40Jahingo.com.

Reply via email to