Skip to content
Advertisement

Prometheus OR Operator

I am trying to run this query in Prometheus. But I need to add “OR” operation in envoy_cluster_name and add another cluster name, so incase a change of cluster name it picks the correct one.

Really appreciate if you can tell me how to use OR operator here.

https://prometheus.test.com/api/v1/query_range?query=sum(increase(envoy_cluster_rq{kubernetes_cluster='test_cluster', envoy_cluster_name='cluster_https___api_test',service='test'}[1m]))&start=2020-03-25T08:00:00Z&end=2020-03-27T08:11:00Z&step=1m

I have tried the following, but it gives separate outcomes.

https://prometheus.test.com/api/v1/query_range?query=sum(increase(envoy_cluster_rq{kubernetes_cluster='test_cluster', envoy_cluster_name='cluster_https___api_test| test123',service='test'}[1m]))&start=2020-03-25T08:00:00Z&end=2020-03-27T08:11:00Z&step=1m

Thanks in advance.

Advertisement

Answer

Just enumerate cluster names in regexp. For instance the following filter would select time series with envoy_cluster_name='name1' and envoy_cluster_name='name2':

envoy_cluster_name=~'name1|name2'
User contributions licensed under: CC BY-SA
3 People found this is helpful
Advertisement