0

I was reading some of the query on grafana dashboard.

There is one query I am not quite understand

sum (container_memory_working_set_bytes{pod_name=~"^$Pod$"}) / sum (machine_memory_bytes{kubernetes_io_hostname=~"^$Node$"}) * 100

I understand the $Pod is my valuable or template which I created.

But I am not sure what does the "^" and the second "$" in "^$Node$" mean.

Thank you for help me.

qing zhang
  • 125
  • 1
  • 4
  • 13

1 Answers1

0

I know nothing about Grafana, but that definitely looks like a Regular Expression. If I'm right, $Pod and $Node are mere placeholders that will be substituted with their actual values at runtime, and the ^ and $ mean that you want to match exactly that value. In other words, in order to match, a string has to begin and end with that value.

As an example, if $Pod gets substituted by, say, foo_pod, a string containing exactly foo_pod will match, but a string like foo_pod2 will not.

Here you can learn more about Regular Expressions, specifically about the ^ and $ anchors.

s.m.
  • 7,895
  • 2
  • 38
  • 46