Annotation Type WithSpan


  • @Target({METHOD,CONSTRUCTOR})
    @Retention(RUNTIME)
    public @interface WithSpan
    This annotation marks that an execution of this method or constructor should result in a new Span.

    Application developers can use this annotation to signal OpenTelemetry auto-instrumentation that a new span should be created whenever marked method is executed.

    If you are a library developer, then probably you should NOT use this annotation, because it is non-functional without the OpenTelemetry auto-instrumentation agent, or some other annotation processor.

    See Also:
    OpenTelemetry OpenTelemetry Instrumentation for Java
    • Optional Element Summary

      Optional Elements 
      Modifier and Type Optional Element Description
      io.opentelemetry.api.trace.SpanKind kind
      Specify the SpanKind of span to be created.
      String value
      Optional name of the created span.
    • Element Detail

      • value

        String value
        Optional name of the created span.

        If not specified, an appropriate default name should be created by auto-instrumentation. E.g. "className"."method"

        Default:
        ""
      • kind

        io.opentelemetry.api.trace.SpanKind kind
        Specify the SpanKind of span to be created. Defaults to SpanKind.INTERNAL.
        Default:
        io.opentelemetry.api.trace.SpanKind.INTERNAL