DataDog/documentation

`@Trace` Java annotation needs better docs

walles opened this issue · 3 comments

Documentation Page

`@Trace` annotations have the default operation name `trace.annotation` and resource name of the traced method. These can be set as arguments of the `@Trace` annotation to better reflect what is being instrumented. These are the only possible arguments that can be set for the `@Trace` annotation.

Issue Description

Please document what the @Trace measured and noParent options do. What kind of measurements is it that are off by default but can be turned on?

Doc claim that operationName and resourceName

are the only possible arguments that can be set for the @Trace annotation.

But the source code contains measured and noParent as well:

https://github.com/DataDog/dd-trace-java/blob/487e069145be51c641c6f8f155ae417b79640a36/dd-trace-api/src/main/java/datadog/trace/api/Trace.java#L9-L25

/** Set this annotation to a method so the dd-java-agent considers it for tracing. */
@Retention(RUNTIME)
@Target(METHOD)
public @interface Trace {


  /** The operation name to set. By default it takes the method's name */
  String operationName() default "";


  /** The resource name. By default it uses the same value as the operation name */
  String resourceName() default "";


  /** Set whether to measure a trace. By default traces are not measured. */
  boolean measured() default false;


  /** Set whether to start a new trace. By default it continues the current trace. */
  boolean noParent() default false;
}

@walles - Thanks for the detailed issue! I'll look into getting this updated. 👍

@walles - Thanks again for the feedback. I'm going to update the documentation to include the noParent argument in the linked PR. As for measured, that is intentionally undocumented as it must be used carefully, typically with help from our Support team. It allows span metrics to be generated for custom traces.

I want to see in the UI when my span starts and ends.

Do I need measured for that?