PCA Analyzing and optimizing processes

A payments engineer wants a chart and an alert that count how often a service writes a log line containing the phrase card declined, without changing the application code. What should be created?

Show answer and explanation

Answer: A

A logs-based metric in Cloud Logging counts log entries matching a filter, or extracts a numeric value from a field, and turns the result into a time series. That series can be charted in Metrics Explorer, placed on dashboards, and used in alerting policies, all without touching the service's code. Trace spans measure request timing, profiler flame graphs show CPU and memory hotspots, and an export to Cloud Storage would need a separate processing job before any metric existed.

Why the other options are wrong

  • B. Trace spans record latency across distributed calls and are created by instrumenting code. They do not count log lines, and a span filter cannot produce a counter from log text.
  • C. Profiler flame graphs show where CPU time or memory is spent inside the code. They do not tally application messages, so they cannot track declined card events.
  • D. Exporting logs to Cloud Storage archives them for retention. Counting events there needs an external job, and the result is not a native monitoring metric that alerting policies can evaluate directly.

Keep going. 213 PCA questions, answers explained after each one.

Practise this domain

Reviewed November 2026. Spotted a problem with this question? Report it from the practice tool.