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