Google Professional Cloud Developer Question 63
Select 3Google Cloud PlatformYou are developing a microservices-based application hosted on Google Kubernetes Engine (GKE). To monitor and debug the application, you decide to implement observability by instrumenting the code to produce logs, metrics, and traces. Which steps should you take to achieve this using Google Cloud's services?
- A
Use OpenTelemetry SDK to instrument your application code and export traces to Cloud Trace.
- B
Integrate the Cloud Logging client library into your application to send logs directly to Cloud Logging.
- C
Configure Prometheus to scrape metrics from your application and export them to Cloud Monitoring using the Prometheus sidecar.
- D
Manually write log messages to a local file and upload them to Cloud Storage for analysis.
- E
Use Cloud Debugger to automatically generate metrics and traces without any modifications to your code.
Show answer and explanation
Correct answers: A, B, C
Explanation
To enable observability in a microservices-based application on GKE, you should use tools and libraries that integrate seamlessly with Google Cloud's monitoring and logging ecosystem. OpenTelemetry is ideal for generating and exporting traces, Cloud Logging client libraries simplify log management, and Prometheus is a standard choice for collecting metrics that can be exported to Cloud Monitoring. These steps provide a complete observability solution, whereas manual log management or relying solely on Cloud Debugger are not appropriate for this use case.
- A. Correct.
Correct. OpenTelemetry is a widely used framework for generating and exporting distributed traces. By using its SDK, you can instrument your code and export traces to Google Cloud Trace.
- B. Correct.
Correct. The Cloud Logging client library allows you to directly send application logs to Cloud Logging, enabling centralized log management and analysis.
- C. Correct.
Correct. Prometheus can collect application metrics, and with a Prometheus sidecar, you can seamlessly export these metrics to Google Cloud Monitoring for visualization and alerting.
- D. Incorrect.
Incorrect. Writing logs to a local file and uploading them to Cloud Storage is not an efficient or recommended approach for real-time observability in Google Cloud.
- E. Incorrect.
Incorrect. Cloud Debugger helps with inspecting application state but does not automatically generate metrics or traces for observability. Code instrumentation is still required.