Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

GCP MQL: Rename a line in monitoring chart

I have a simple Google Cloud Monitoring Query Language to show the count of all requests to all containers in kubernetes from log-based metrics. The query is below.

k8s_container::logging.googleapis.com/user/service-api-gateway-prod-request-in-count | sum

The widget will look like below

enter image description here

I would like to rename the long label for the line chart to something shorter like "request count". How do I do it?

like image 607
Petra Barus Avatar asked Sep 07 '25 13:09

Petra Barus


2 Answers

So the best I can do is to add a new column to the table and map the column.

In my example, I add add [p: 'error count'] | map [p] to the line, and become like this.

k8s_container::logging.googleapis.com/user/service-api-gateway-prod-request-in-count | sum | add [p: 'error count'] | map [p]

This works in my case.

References

  • https://cloud.google.com/monitoring/mql/reference#map
like image 175
Petra Barus Avatar answered Sep 10 '25 05:09

Petra Barus


You can try renaming the value column with | value [request_count: val()].

Reference entry for the value operator

like image 39
kdima Avatar answered Sep 10 '25 07:09

kdima