How does one plot multiple lines, such as different percentiles, in a single chart based on a single distribution metric using MQL in Google Cloud Platform?
The following query will draw a graph with the 50th percentile from a distribution metric:
fetch global::logging.googleapis.com/user/my_metrics.response_time |
percentile_from 50
The my_metrics.response_time
is a logs-based distribution metric with the unit ms
, the chart looks like this:
I'd like to plot the 50th, 90th, and 95th percentiles in the same chart as well. My best attempt so far is:
fetch global::logging.googleapis.com/user/my_metrics.response_time |
{
percentile_from 50
;
percentile_from 90
;
percentile_from 95
} |
union
This only plots a single line again, however (it seems to be the 90th percentile):
The attempt above is based on this example which plots multiple lines from a single metric.
I've tried various alignment functions etc, but I think the problem is just that I don't have a good understanding of the data model. There's probably a group_by []
or outer_join 0
missing somewhere, but I can't wrap my head around it.
One solution that seems to work is to use
union_group_by
to do a group by operation with multiple tables as input, in combination withadd
to create a label to group by:The following chart is produced: