MQL: Count operation on labels

34 views
Skip to first unread message

Avinash Patange

unread,
Nov 13, 2023, 3:36:35 PM11/13/23
to Google Stackdriver Discussion Forum
Hello.

I have some labels which contain serial numbers of components in a metric.

e.g. metric:Capacity
Labels:
disk: disk_serial_number,
cluster: cluster_serial_number
}

i want to count number of unique disk and controllers for this metric. 
I tried something like this: (not related to the above metric)

| metric 'custom.googleapis.com/vol_size_total'
| { t_0:
align mean_aligner()
| group_by [resource.location], [sp_count: count(metric.SPUUID)]
| map add[Pools: sp_count]
; t_1:
align mean_aligner()
| group_by [resource.location],
[volume_count: count(metric.VolumeUUID)]
| map add[Volumes: volume_count]
; t_2:
align mean_aligner()
| group_by [resource.location],
[cluster_count: count(resource.cluster_name)]
| map add[Clusters: cluster_count] }
| join

But this does not give me the cluster/volume count but only the location count

Any pointers would help. 
Reply all
Reply to author
Forward
0 new messages