nerdexam
Google

PROFESSIONAL-CLOUD-DEVELOPER · Question #225

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 trace

The correct answer is D. Add the X-Cloud-Trace-Context header to the request with the appropriate parameters.. The X-Cloud-Trace-Context header lets callers control tracing behavior per request. Setting the options flag to o=1 (TRACE_TRUE) forces the request to be sampled regardless of the default sampling rate. The format is X-Cloud-Trace-Context: TRACE_ID/SPAN_ID;o=1. This guarantees 10

Debugging, Monitoring, and Optimizing Applications

Question

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?

Options

  • AWait 10 minutes, then verify that Trace captures those types of requests automatically.
  • BWrite a custom script that sends this type of request repeatedly from your dev project.
  • CUse the Trace API to apply custom attributes to the trace.
  • DAdd the X-Cloud-Trace-Context header to the request with the appropriate parameters.

How the community answered

(40 responses)
  • A
    18% (7)
  • B
    3% (1)
  • C
    8% (3)
  • D
    73% (29)

Explanation

The X-Cloud-Trace-Context header lets callers control tracing behavior per request. Setting the options flag to o=1 (TRACE_TRUE) forces the request to be sampled regardless of the default sampling rate. The format is X-Cloud-Trace-Context: TRACE_ID/SPAN_ID;o=1. This guarantees 100% capture of that specific request type. Waiting 10 minutes (A) relies on the probabilistic sampler and cannot guarantee a specific request is traced. Sending repeated requests (B) increases probability but still does not guarantee every instance is captured. Custom attributes via the Trace API (C) annotate existing spans but do not force sampling of requests that would otherwise be dropped.

Topics

#Tracing#OpenTelemetry#Cloud Trace#Debugging

Community Discussion

No community discussion yet for this question.

Full PROFESSIONAL-CLOUD-DEVELOPER Practice