Google Professional Cloud Developer Question 66
Select 2Google Cloud PlatformYou are developing a microservices-based application running on Google Kubernetes Engine (GKE). The application uses Cloud Monitoring and Cloud Logging for observability. You need to ensure that your application produces metrics, logs, and traces to diagnose issues and monitor performance effectively. Which of the following steps should you take to instrument your application code?
- A
Use the OpenTelemetry SDK to implement distributed tracing in your application.
- B
Write application logs to the local filesystem and rely on GKE to automatically push them to Cloud Logging.
- C
Create custom metrics using the Cloud Monitoring client libraries and export them to Cloud Monitoring.
- D
Enable VPC Flow Logs to collect detailed application-level metrics.
- E
Integrate application logs with Cloud Logging using the Fluentd agent.
Show answer and explanation
Correct answers: A, C
Explanation
To instrument your application code effectively for metrics, logs, and traces, you should use OpenTelemetry SDK for distributed tracing and Cloud Monitoring client libraries for custom metrics. These tools are designed to seamlessly integrate with Google Cloud's observability stack, enabling you to diagnose issues and monitor performance efficiently. Writing logs to the local filesystem, relying on VPC Flow Logs, or using Fluentd agents are either insufficient or not specific to this task.
- A. Correct.
Using the OpenTelemetry SDK is a best practice for instrumenting distributed tracing in your application. OpenTelemetry allows you to collect and export trace data, which is essential for end-to-end observability.
- B. Incorrect.
Writing logs to the local filesystem is not sufficient for integration with Cloud Logging. You need to explicitly configure your application to use supported logging libraries or agents to push logs to Cloud Logging.
- C. Correct.
Creating custom metrics using Cloud Monitoring client libraries is a correct approach to instrument your application for metrics. These libraries allow your application to send custom performance data to Cloud Monitoring.
- D. Incorrect.
VPC Flow Logs capture network-level information about traffic flowing in and out of your VPC, but they are not related to application-level metrics or logs. This option is not relevant to instrumenting your application code.
- E. Incorrect.
While Fluentd can be used to collect and export logs, integrating application logs with Cloud Logging is better achieved by using supported language-specific logging libraries directly in your application code. This option is not the most appropriate choice.