Google Professional Cloud Developer Question 62
Select 3Google Cloud PlatformYou are developing a distributed application on Google Cloud and want to monitor its performance. To achieve this, you need to instrument your application code to collect metrics, logs, and traces. Which of the following actions should you take to ensure proper observability and integration with Google Cloud's operations suite?
- A
Use the Cloud Logging client library to write structured logs from your application.
- B
Implement OpenTelemetry to generate and export traces to Cloud Trace.
- C
Add Stackdriver-specific logging code directly into your application.
- D
Use the Cloud Monitoring client library to export custom metrics.
- E
Enable the Cloud Debugger agent to automatically collect traces and logs.
Show answer and explanation
Correct answers: A, B, D
Explanation
For proper observability in Google Cloud, you should use modern tools like the Cloud Logging client library for structured logs, OpenTelemetry for traces, and the Cloud Monitoring client library for custom metrics. These tools integrate seamlessly with Google Cloud's operations suite, providing robust monitoring and debugging capabilities. Avoid relying on outdated or unrelated solutions like Stackdriver or Cloud Debugger for these purposes.
- A. Correct.
This is correct because using the Cloud Logging client library allows you to write structured logs that integrate seamlessly with Google Cloud Logging.
- B. Correct.
This is correct because OpenTelemetry is a recommended, vendor-neutral standard for instrumenting code to generate and export traces, and it integrates well with Cloud Trace.
- C. Incorrect.
This is incorrect because Google Cloud no longer uses the Stackdriver branding, and manually adding outdated Stackdriver-specific code is not recommended or necessary.
- D. Correct.
This is correct because the Cloud Monitoring client library allows you to create and export custom metrics to Google Cloud Monitoring for detailed performance tracking.
- E. Incorrect.
This is incorrect because while Cloud Debugger can help debug applications in production, it is not primarily used to collect metrics or traces.