Google Cloud Professional Cloud Developer — Question 177
You have recently instrumented a new application with OpenTelemetry, and you want to check the latency of your application requests in Trace. You want to ensure that a specific request is always traced. What should you do?
Answer options
- A. Wait 10 minutes, then verify that Trace captures those types of requests automatically.
- B. Write a custom script that sends this type of request repeatedly from your dev project.
- C. Use the Trace API to apply custom attributes to the trace.
- D. Add the X-Cloud-Trace-Context header to the request with the appropriate parameters.
Correct answer: D
Explanation
The correct answer is D because adding the X-Cloud-Trace-Context header ensures that the request is linked to a specific trace, making it traceable. Option A is incorrect as simply waiting does not guarantee that the specific request will be traced. Option B may help with testing but does not ensure tracing. Option C does not directly address ensuring a specific request is traced.