PROFESSIONAL-CLOUD-DEVELOPER · Question #79
Your application is logging to Stackdriver. You want to get the count of all requests on all /api/alpha/* endpoints. What should you do?
The correct answer is B. Add a Stackdriver counter metric for endpoint:/api/alpha/*.. A logs-based counter metric in Cloud Monitoring (Stackdriver) lets you filter log entries by a specific pattern and count the matches. Using a filter like endpoint:/api/alpha/* correctly captures all requests to any endpoint under that path prefix using a wildcard. This is the na
Question
Your application is logging to Stackdriver. You want to get the count of all requests on all /api/alpha/* endpoints. What should you do?
Options
- AAdd a Stackdriver counter metric for path:/api/alpha/.
- BAdd a Stackdriver counter metric for endpoint:/api/alpha/*.
- CExport the logs to Cloud Storage and count lines matching /api/alpha.
- DExport the logs to Cloud Pub/Sub and count lines matching /api/alpha.
How the community answered
(31 responses)- A16% (5)
- B71% (22)
- C10% (3)
- D3% (1)
Explanation
A logs-based counter metric in Cloud Monitoring (Stackdriver) lets you filter log entries by a specific pattern and count the matches. Using a filter like endpoint:/api/alpha/* correctly captures all requests to any endpoint under that path prefix using a wildcard. This is the native, purpose-built mechanism for deriving metrics from log data. Exporting logs to Cloud Storage (C) or Cloud Pub/Sub (D) and counting lines is a manual, higher-latency, and more expensive approach. Option A uses an incorrect filter key ('path' instead of 'endpoint').
Topics
Community Discussion
No community discussion yet for this question.