Search code examples
google-cloud-platformgoogle-cloud-monitoringmonitoring-query-language

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?


Solution

  • 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