Adding AND resource.type=\"global\" is not working for me in metric.type filter

Adding AND resource.type="global" is not working for me.

When navigating to the metric editor in the GUI I get an error: “Chart definition invalid. The supplied filter does not specify a valid combination of metric and monitored resource descriptors. The query will not return any time series.”

Interestingly when I remove “Resource type: Global” from the “find resource type and metric” selection the error goes away and it appears to be working. However Terraform will not let me create the alert without a resource type.

below is code snippet:

conditions {
display_name = “logging/user/${google_logging_metric.cloudrun_error_alert_metric_deadline.name} [COUNT]”,

condition_threshold {
comparison = “COMPARISON_GT”
duration = “0s”
filter = “metric.type="logging.googleapis.com/user/${google_logging_metric.cloudrun_error_alert_metric_deadline.name}"AND resource.type="global"”
threshold_value = 0

i think i have figured out the problem , thank you.

@vchava can I ask you to mark your question as resolved. Maybe you would be able to share what the solution for your problem was.

Thank you

filter = “metric.type="logging.googleapis.com/user/${google_logging_metric.cloudrun_error_alert_metric_deadline.name}"AND resource.type="cloud_run_revision"”

the above resource.type resolved issue

Thank you. I see that the solution was to change global resource type to cloud_run_revision.