Google Professional Cloud DevOps Engineer Question 163
Select 2Google Cloud PlatformYour team has deployed a microservices-based application on Google Kubernetes Engine (GKE). To improve observability, you need to instrument the application to collect detailed metrics and traces. The application uses HTTP requests to communicate between services. Which steps should you take to implement application instrumentation effectively?
- A
Use OpenTelemetry libraries in your application code to collect and export traces and metrics.
- B
Enable Stackdriver Profiler to automatically collect traces without modifying application code.
- C
Add unique trace IDs to HTTP headers for all inter-service requests.
- D
Instrument your application to send metrics and traces directly to Google Cloud Monitoring.
- E
Configure Kubernetes Pods to generate traces automatically without requiring application changes.
Show answer and explanation
Correct answers: A, C
Explanation
To instrument a microservices-based application deployed on GKE, you need to collect telemetry data such as metrics and traces. Instrumenting your application with tools like OpenTelemetry and adding trace IDs to HTTP headers ensures end-to-end observability and correlation of requests between services. Other options like Stackdriver Profiler and Kubernetes Pod configurations do not directly address the need for trace collection and metrics instrumentation.
- A. Correct.
Correct: OpenTelemetry is a widely used tool for application instrumentation. It allows developers to collect, process, and export telemetry data such as traces and metrics. Using OpenTelemetry libraries in your application code is a key step in implementing instrumentation effectively.
- B. Incorrect.
Incorrect: Stackdriver Profiler provides profiling data about CPU and memory usage but does not handle trace collection or metrics instrumentation. Application instrumentation still requires explicit code changes or integration with tools like OpenTelemetry.
- C. Correct.
Correct: Adding unique trace IDs to HTTP headers is essential for correlating requests and ensuring end-to-end traceability across microservices.
- D. Incorrect.
Incorrect: While it is possible to send metrics and traces directly to Google Cloud Monitoring, this approach is not considered best practice. Metrics and traces should first be collected and processed by an instrumentation library like OpenTelemetry for flexibility and standardization.
- E. Incorrect.
Incorrect: Kubernetes Pods do not inherently generate traces. Application instrumentation typically requires changes to the application code or integration with libraries like OpenTelemetry.