Stackdriver / stackdriver-prometheus-sidecar

A sidecar for the Prometheus server that can send metrics to Stackdriver.
https://cloud.google.com/monitoring/kubernetes-engine/prometheus
Apache License 2.0
120 stars 43 forks source link

Using operator in filter #221

Open rky0930 opened 4 years ago

rky0930 commented 4 years ago

Is there a way to use an operator in a filter? I want to send only metric with value greater than 0 to stackdriver. ex) PromQL: {name="kube_pod_status_phase", namespace="kubeflow", phase=~"Pending|Failed"} >0

When I run it on a filter, I get the following error:

--include=({__name__="kube_pod_status_phase", namespace="kubeflow", phase=~"Pending|Failed"}>0)
# Error 
"Error parsing --include (or --filter)" err="cannot parse --include flag '({__name__=\"kube_pod_status_phase\", namespace=\"kubeflow\", phase=~\"Pending|Failed\"}>0)': \"parse error at char 1: vector selector must contain label matchers or metric name\""
osigida commented 4 years ago

I had a similar problem --include='{__name__!~"cadvisor_.+"} didn't actually work Got errors like parse error at char 19: vector selector must contain at least one non-empty matcher

Had to move negation into the regexp instead like that --include='{__name__=~"^cadvisor_.+"}