Professional Cloud DevOps Engineer
Prepare and test your skills
Prepare and test your skills
Worked example. The correct answer is already marked and every option is explained below, so there is nothing to select here. To answer questions yourself, start the free trial.
Keep the momentum going with these hand-picked practice scenarios
Want more questions like this?
Get a free certification question every week.
Last updated
A DevOps team manages a microservices application running on Google Cloud where services emit structured JSON logs to Cloud Logging. The logs contain a response status code (jsonPayload.status), the name of the service (jsonPayload.service_name), and the execution duration in milliseconds (jsonPayload.latency_ms).
The team needs to implement observability solutions in Cloud Monitoring to fulfill two requirements:
Which custom log-based metric designs should the team configure in Cloud Logging?
Create a single distribution log-based metric that extracts both jsonPayload.latency_ms and jsonPayload.status, and use Cloud Monitoring metric-threshold filters to count 5xx status codes.
Create a distribution log-based metric extracting jsonPayload.latency_ms to record latency into histogram buckets, and create a counter log-based metric filtering for jsonPayload.status >= 500 with a custom label extracting jsonPayload.service_name.
Create a counter log-based metric extracting jsonPayload.latency_ms with configured histogram buckets, and create a distribution log-based metric filtering for jsonPayload.status >= 500.
Create a boolean log-based metric for latency percentiles, and configure a log-based alerting policy directly in Logs Explorer to monitor 5xx error rate trends.
Create a single distribution log-based metric that extracts both jsonPayload.latency_ms and jsonPayload.status, and use Cloud Monitoring metric-threshold filters to count 5xx status codes.
Create a distribution log-based metric extracting jsonPayload.latency_ms to record latency into histogram buckets, and create a counter log-based metric filtering for jsonPayload.status >= 500 with a custom label extracting jsonPayload.service_name.
Log-based metrics are user-defined or system-defined metrics in Cloud Logging that convert log stream data into time-series metrics ingested by Cloud Monitoring. User-defined log-based metrics support two core metric types: counter metrics and distribution metrics.
jsonPayload.latency_ms and aggregate them into configurable histogram buckets. Cloud Monitoring uses these distributions to calculate percentiles (such as p50, p95, and p99) and evaluate latency threshold alert policies.jsonPayload.status >= 500 increments a count each time a server error log is ingested. Adding a custom label that extracts jsonPayload.service_name partitions the count into distinct time series per service, allowing Cloud Monitoring to chart error rates and alert on spikes per microservice.This approach directly maps the data requirements to the native capabilities of Google Cloud Observability: continuous numeric distributions for statistical latency analysis and labeled counters for tracking discrete categorized event occurrences.
Create a counter log-based metric extracting jsonPayload.latency_ms with configured histogram buckets, and create a distribution log-based metric filtering for jsonPayload.status >= 500.
Create a boolean log-based metric for latency percentiles, and configure a log-based alerting policy directly in Logs Explorer to monitor 5xx error rate trends.