Google Cloud Professional Cloud Developer — Question 360
Your application is logging to Stackdriver. You want to get the count of all requests on all /api/alpha/* endpoints.
What should you do?
Answer options
- A. Add a Stackdriver counter metric for path:/api/alpha/.
- B. Add a Stackdriver counter metric for endpoint:/api/alpha/*.
- C. Export the logs to Cloud Storage and count lines matching /api/alpha.
- D. Export the logs to Cloud Pub/Sub and count lines matching /api/alpha.
Correct answer: A
Explanation
The correct answer is A because adding a Stackdriver counter metric for path:/api/alpha/ will accurately track and count all requests matching that path. Option B is incorrect as it suggests a different metric that doesn't match the required path structure. Options C and D involve exporting logs, which adds unnecessary steps for counting requests that can be directly counted with a metric.