Prepare and test your skills
Prepare and test your skills
Free sample question, answered and explained below. The Professional Cloud DevOps Engineer practice bank has 1,455 more like it. Try 10 free: instant score, no account.
Your DevOps team deploys a critical microservice on Compute Engine instances with the Google Cloud Ops Agent. The Ops Agent is configured to ingest OpenTelemetry Protocol (OTLP) metrics using the Cloud Monitoring API mode (metrics_mode: googlecloudmonitoring). The application emits two cumulative counter metrics:
workload.googleapis.com/custom/http_requests_totalworkload.googleapis.com/custom/http_errors_totalYou need to construct a PromQL-based alerting policy condition in Cloud Monitoring that triggers an incident whenever the 5-minute HTTP error rate exceeds 5% of total requests across the fleet.
Which PromQL query correctly references these metrics according to Cloud Monitoring syntax conventions?
( sum(rate(prometheus_googleapis_com:custom_http_errors_total_counter{monitored_resource="prometheus_target"}[5m])) / sum(rate(prometheus_googleapis_com:custom_http_requests_total_counter{monitored_resource="prometheus_target"}[5m])) ) > 0.05
This query references metrics using the prometheus.googleapis.com domain, appends the _counter kind suffix, and targets the prometheus_target monitored resource type.
metrics_mode: googlecloudmonitoring. Therefore, metrics are written to the workload.googleapis.com domain against the gce_instance resource, not prometheus.googleapis.com.prometheus_target is only used when ingesting via the Prometheus API mode. In Monitoring API mode, the monitored resource is gce_instance._counter or _gauge suffix is only generated when metrics pass through the OpenTelemetry-to-Prometheus translation in the Prometheus API pipeline.The Ops Agent receiver were running in Prometheus API mode and the query was written using explicit, fully qualified Prometheus API metric descriptors.
( sum(rate(workload.googleapis.com:custom:http_errors_total[5m])) / sum(rate(workload.googleapis.com:custom:http_requests_total[5m])) ) > 0.05
This query attempts to map the Cloud Monitoring metric by replacing slashes with colons while leaving dots (.) unchanged and omitting the monitored resource label.
.) and multiple colons (:) within metric names are invalid. Cloud Monitoring mapping rules require replacing all dots (.) and subsequent slashes (/) with underscores (_).{monitored_resource="gce_instance"} leads to query ambiguity or failure.PromQL permitted arbitrary dotted notation in identifier names and did not require monitored resource scoping in Cloud Monitoring.
( sum(rate(workload_googleapis_com:custom_http_errors_total{monitored_resource="gce_instance"}[5m])) / sum(rate(workload_googleapis_com:custom_http_requests_total{monitored_resource="gce_instance"}[5m])) ) > 0.05
When querying metrics ingested through the Cloud Monitoring API (googlecloudmonitoring ingestion mode) using Prometheus Query Language (PromQL), metric names must follow specific conversion rules to be compatible with PromQL syntax. In Cloud Monitoring, the metric type is converted into a PromQL identifier, and monitored resources must be explicitly defined where applicable.
/) in the metric type string is replaced with a colon (:)..) and subsequent forward slashes (/), are replaced with underscores (_).workload.googleapis.com/custom/http_errors_total becomes workload_googleapis_com:custom_http_errors_total.{monitored_resource="gce_instance"} label filter.rate(...[5m]) calculates the per-second rate of change over a 5-minute window, and computing the ratio with / compared against > 0.05 enforces the 5% threshold.sum() aggregates request and error rates across all matching VM instances.monitored_resource="gce_instance" avoids ambiguity in multi-resource environments.This syntax precisely follows Google Cloud's documented mapping specification for non-Prometheus native custom metrics ingested via the Monitoring API, avoiding runtime query errors and missing data anomalies.
( sum(rate(http_errors_total[5m])) / sum(rate(http_requests_total[5m])) ) > 0.05
This query uses unmodified, short metric identifiers (http_errors_total and http_requests_total) without domain prefixes or resource qualifiers.
prometheus_target resource) where OpenTelemetry metrics are automatically stripped of their domain prefix during ingestion.workload.googleapis.com), which requires the fully qualified domain mapping (workload_googleapis_com:...).prometheus_target and require the {monitored_resource="gce_instance"} selector.workload.googleapis.com metric descriptors.The Ops Agent were configured with the default Prometheus API receiver mode (prometheus.googleapis.com), where metrics are automatically transformed into standard Prometheus identifiers without domain namespaces.
Answer them yourself and get your score the moment you finish. No account needed.
Full access includes
Keep the momentum going with these hand-picked practice scenarios
Last updated Validated