Professional Cloud Developer Exam QuestionsBrowse all questions from this exam

Professional Cloud Developer Exam - Question 35


Your application is logging to Stackdriver. You want to get the count of all requests on all /api/alpha/* endpoints.

What should you do?

Show Answer
Correct Answer: BC

To get the count of all requests on all /api/alpha/* endpoints using Stackdriver, you should add a Stackdriver counter metric with a filter that matches the specific endpoints. By using a filter such as endpoint:/api/alpha/*, you can accurately count and monitor the number of requests to all the endpoints under /api/alpha/* efficiently within the Stackdriver environment.

Discussion

17 comments
Sign in to comment
woriheck93Option: B
Sep 5, 2021

Ans: B B have the correct endpoint /api/alpha/*, A only get one endpoint counter

siwang
Jan 4, 2023

Agree. counter metric with applying regression filter to httpRequest.requestUrl should be able to get the count value. refer to: https://cloud.google.com/logging/docs/log4j2-vulnerability#log4j-search

fraloca
Jan 8, 2023

B is the correct answer "Create a filter that collects only the log entries that you want to count in your metric using the logging query language. You can also use regular expressions to create your metric's filters." https://cloud.google.com/logging/docs/logs-based-metrics/counter-metrics#console

google_learner123Option: A
Sep 5, 2020

Answer should be A

fraloca
Dec 24, 2020

https://cloud.google.com/logging/docs/logs-based-metrics/counter-metrics#console

hug_c0sm0s
Mar 17, 2021

a bit confused about A / B, it seems they mean the same thing.

GoReplyGCPExamOption: B
Apr 19, 2022

Ans should be B -> (https://cloud.google.com/blog/products/management-tools/cloud-logging-gets-regular-expression-support) path=~"/api/alpha/*"

celia20200410Option: A
Jul 20, 2021

ans: a https://cloud.google.com/logging/docs/view/basic-queries#searching_specific_fields https://cloud.google.com/monitoring/charts/metrics-selector#filter-option To match any US zone that ends with “a”, you could use the the regular expression ^us.*.a$.

ruben82
May 26, 2022

documentation says: "ends with a". This question is different.

omermahgoubOption: B
Jan 7, 2023

Option B is the correct choice because it involves creating a counter metric in Stackdriver specifically for requests to the /api/alpha/* endpoints. This will allow you to track the number of requests to these endpoints and view the data in Stackdriver.

omermahgoub
Jan 7, 2023

Option A is incorrect because the path:/api/alpha/ metric will track requests to any path that starts with /api/alpha/, not just requests to /api/alpha/* endpoints.

omermahgoub
Jan 7, 2023

Option C is incorrect because it involves exporting the logs to Cloud Storage and manually counting the lines that match /api/alpha. This is a more time-consuming and error-prone approach compared to using a counter metric in Stackdriver.

omermahgoub
Jan 7, 2023

Option D is also incorrect for similar reasons. Exporting the logs to Cloud Pub/Sub and counting the lines that match /api/alpha is more time-consuming and error-prone compared to using a counter metric in Stackdriver.

tomato123Option: C
Aug 20, 2022

C is correct

santoshchauhanOption: A
Mar 7, 2024

A. Add a Stackdriver counter metric for path:/api/alpha/. In Google Cloud's operations suite (formerly Stackdriver), you can create custom metrics to count specific events within your logs. You would set up a counter metric to capture and count log entries where the request path matches your specified pattern, such as /api/alpha/*. This would allow you to query and visualize the count of requests to these endpoints directly within Stackdriver Monitoring without the need to export the logs elsewhere. B. This option seems to be suggesting the correct action (creating a counter metric), but the syntax endpoint:/api/alpha/* is not correct for Stackdriver Monitoring. Custom metrics in Stackdriver are based on log data and the filter that matches the log entries, so you would specify the filter as part of creating the metric.

syu31svcOption: C
Jul 18, 2021

https://cloud.google.com/logging/docs/logs-based-metrics/troubleshooting#metric-name-restrictions I would take C

telpOption: B
Jan 9, 2023

answer is B with the correct endpoint and the goal of counter metris is to resolve the need to count calls

ash_meharunOption: B
Jan 11, 2023

B is the correct answer

FoxalOption: B
Feb 2, 2023

B is the only one

Pime13Option: B
Feb 27, 2023

submiting just to confirm community response.

kennylooOption: B
Aug 17, 2023

B is for counter

maxdannyOption: B
Aug 24, 2023

This option will accurately track the number of requests made to all endpoints nested under /api/alpha/*.

RajanOption: B
Sep 19, 2023

Ans: B

theseawillclaimOption: B
Feb 13, 2024

If you don't export the metric, then you have nothing to count. I choose B because "endpoint" is more specific than "path".

thewalkerOption: A
Jul 17, 2024

The best approach here is A. Add a Stackdriver counter metric for path:/api/alpha/. Here's why: Stackdriver Metrics: Stackdriver metrics are specifically designed for tracking and aggregating data points over time. They are ideal for counting events like requests. Path-Based Filtering: You can define Stackdriver metrics with specific filters based on the request path. In this case, path:/api/alpha/ will capture all requests matching that pattern. Efficient Aggregation: Stackdriver automatically aggregates the metric data, providing you with the total count of requests to the /api/alpha/* endpoints.

thewalker
Jul 17, 2024

Why other options are less suitable: **B. Endpoint:/api/alpha/*: ** While this might seem like a good option, Stackdriver doesn't typically use the term "endpoint" for filtering. It primarily uses "path" for request path-based filtering. C. Export logs to Cloud Storage and count lines: This is a less efficient and more complex approach. You'd need to write custom code to parse the logs and count the matching lines, which adds overhead and potential for errors. D. Export logs to Cloud Pub/Sub and count lines: Similar to option C, this involves exporting logs and then processing them externally, which is less efficient than using Stackdriver metrics. In summary: Adding a Stackdriver counter metric with the path:/api/alpha/ filter is the most efficient and straightforward way to get the count of all requests on all /api/alpha/* endpoints.