Metadata system labels in Cloud Monitoring doesn't return informations

Hi everyone

I'm having a problem with a following MQL query in Cloud Monitoring:

fetch gce_instance
| metric 'agent.googleapis.com/memory/percent_used'
| filter
resource.project_id == '638520461541'
&& (metadata.system_labels.instance_group == 'gs-uig-apps')
&& (metric.state == 'used')
| group_by 1m, [value_percent_used_mean: mean(value.percent_used)]
| every 1m
| group_by [], [value_percent_used_mean_mean: mean(value_percent_used_mean)]

 

The item metadata.system_labels.instance_group == 'gs-uig-apps' doesn't return the informations about the instance group that i already had configured. The reported error is :

"Line 5: The first argument to '==' is of type 'Set(String)' which does not match any of the expected types 'Num' or 'Comparable'."

I changed the code using other filters and it worked, but only "metadata.system_labels.instance_group" have this error. Has anyone experienced this problem?

1 2 384
2 REPLIES 2

Hi @Lucas-chagas01,

Welcome to the Google Cloud Community!

Based on the error you provided, it seems like there is a type mismatch in your MQL.

In line 5:

 

&& (metadata.system_labels.instance_group == 'gs-uig-apps')

 

Instead of using the == operator, can you try using the has operator

 

&& metadata.system_labels.instance_group has 'gs-uig-apps'

 

Let me know if it worked. Thank you. 

anicds
New Member

hi i am also stuck on the same issue
any solution