gcpdiag.queries.quotas

Queries related to Quota.
CONSUMER_QUOTA_QUERY_TEMPLATE = "\nfetch consumer_quota\n| filter resource.service == '{service_name}'\n| {{ metric serviceruntime.googleapis.com/quota/allocation/usage\n | align next_older(1d)\n | group_by [resource.project_id, metric.quota_metric, resource.location],\n max(val())\n ; metric serviceruntime.googleapis.com/quota/limit\n | filter metric.limit_name =~ '{limit_name}'\n | align next_older(1d)\n | group_by [resource.project_id, metric.quota_metric, resource.location],\n min(val())\n }}\n| join\n| value [val(0), val(1)]\n| within {within_days}d\n| group_by 1d, [max(val(0))/min(val(1)), min(val(1))]\n"
QUOTA_EXCEEDED_QUERY_TEMPLATE = "\nfetch consumer_quota\n| metric 'serviceruntime.googleapis.com/quota/exceeded'\n| group_by 1d, [value_exceeded_count_true: count_true(value.exceeded)]\n| within {within_days}d\n"
QUOTA_EXCEEDED_HOURLY_PER_SERVICE_QUERY_TEMPLATE = "\nfetch consumer_quota\n| metric 'serviceruntime.googleapis.com/quota/exceeded'\n| filter (resource.service =~ {service_name})\n| group_by 1h, [value_exceeded_count_true: count_true(value.exceeded)]\n| within {within_days}d\n"
QUOTA_EXCEEDED_QUERY_WINDOW_TEMPLATE = "\nfetch consumer_quota\n| metric 'serviceruntime.googleapis.com/quota/exceeded'\n| group_by 1h, [value_exceeded_count_true: count_true(value.exceeded)]\n| within {start_time}, {end_time}\n"