Google Associate Cloud Engineer Question 286
Single answerGoogle Cloud PlatformYour company uses a custom application hosted on Google Cloud Compute Engine, and you need to monitor a specific application metric, such as the number of processed requests per minute. How can you create and ingest this custom metric into Cloud Monitoring?
- A
Use the Google Cloud Console to manually create the custom metric and ingest data using a form.
- B
Write a script that uses the Cloud Monitoring API to define the custom metric and sends data points to it.
- C
Configure a Stackdriver Logging export to automatically convert log entries into custom metrics.
- D
Set up Google Cloud Pub/Sub to collect the data and automatically create a custom metric in Cloud Monitoring.
Show answer and explanation
Correct answer: B
Explanation
To create and ingest custom metrics into Cloud Monitoring, you need to use the Cloud Monitoring API. This involves defining the custom metric schema and sending data points through the API. This approach provides flexibility and is suitable for programmatically capturing application-specific metrics, such as the number of processed requests per minute.
- A. Incorrect.
This option incorrectly suggests that you can manually create and ingest custom metrics directly through the Google Cloud Console, which is not possible.
- B. Correct.
This is the correct approach. You need to use the Cloud Monitoring API to define and ingest custom metric data programmatically.
- C. Incorrect.
While Stackdriver Logging can be used to create metrics from logs, it requires logs with specific structured data, and this approach is not applicable to direct custom metric creation.
- D. Incorrect.
Google Cloud Pub/Sub can be used to transport data, but it does not directly create or ingest metrics into Cloud Monitoring.