Datadog-APM-and-Distributed-Tracing-Fundamentals practice question 10 of 25

Which of the following is a feature for adding spans when using the Java tracer?

Full set: 180 questions
Answer options
A: Trace methods
B: Trace annotations
C: Both trace methods and trace annotations Correct answer
D: None of the choices are correct.
Correct Answer:
C. Both trace methods and trace annotations
Explanation

The Datadog Java tracer provides multiple ways to create new spans for custom instrumentation. Developers can use the @Trace annotation directly in their code to mark specific methods for tracing. Alternatively, they can configure the tracer to trace specific methods without code changes by using the dd.trace.methods system property or the DDTRACEMETHODS environment variable. Since both methods are valid and supported features, the correct choice encompasses both.

Why Incorrect

A. This is only partially correct. While tracing methods via configuration is a feature, it omits the equally valid annotation-based approach.
B. This is also only partially correct. Using trace annotations is a key feature, but it ignores the method of instrumenting via configuration.
D. This is incorrect because the Datadog Java tracer explicitly supports both trace annotations and method tracing through configuration for custom instrumentation.

References

1. Datadog Documentation, "Java Custom Instrumentation". Section: "Trace a method using annotations". This section details the use of the @Trace annotation.

2. Datadog Documentation, "Java Custom Instrumentation". Section: "Trace a method using configuration". This section explains how to use the dd.trace.methods property to instrument methods without code changes.

3. Datadog Documentation, "Configuration". Section: "Java". This page lists DDTRACEMETHODS as an environment variable for "A list of methods that should be traced."

Scroll to Top