nerdexam
Google

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

Implementing Logging and Monitoring for Applications

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)
  • A
    16% (5)
  • B
    71% (22)
  • C
    10% (3)
  • D
    3% (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

#Cloud Logging#Cloud Monitoring#Log-based Metrics#Application Metrics

Community Discussion

No community discussion yet for this question.

Full PROFESSIONAL-CLOUD-DEVELOPER Practice