Class OpenTelemetrySpan

java.lang.Object
org.axonframework.tracing.opentelemetry.OpenTelemetrySpan
All Implemented Interfaces:
org.axonframework.tracing.Span

public class OpenTelemetrySpan extends Object implements org.axonframework.tracing.Span
Span implementation that uses OpenTelemetry's Span to provide tracing capabilities to an application.

These traces should always be created using the OpenTelemetrySpanFactory since this will make sure the proper parent context is extracted before creating the Span.

Since:
4.6.0
Author:
Mitchell Herrijgers
  • Constructor Summary

    Constructors
    Constructor
    Description
    OpenTelemetrySpan(io.opentelemetry.api.trace.SpanBuilder spanBuilder)
    Creates the span, based on the SpanBuilder provided.
  • Method Summary

    Modifier and Type
    Method
    Description
    org.axonframework.tracing.Span
    addAttribute(String key, String value)
     
    void
    end()
     
    org.axonframework.tracing.SpanScope
     
    org.axonframework.tracing.Span
     
    org.axonframework.tracing.Span
     

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait

    Methods inherited from interface org.axonframework.tracing.Span

    run, runCallable, runConsumer, runSupplier, wrapCallable, wrapConsumer, wrapRunnable, wrapSupplier
  • Constructor Details

    • OpenTelemetrySpan

      public OpenTelemetrySpan(io.opentelemetry.api.trace.SpanBuilder spanBuilder)
      Creates the span, based on the SpanBuilder provided. This SpanBuilder will supply the Span when the start() method is invoked.
      Parameters:
      spanBuilder - The provider of the Span.
  • Method Details

    • start

      public org.axonframework.tracing.Span start()
      Specified by:
      start in interface org.axonframework.tracing.Span
    • makeCurrent

      public org.axonframework.tracing.SpanScope makeCurrent()
      Specified by:
      makeCurrent in interface org.axonframework.tracing.Span
    • end

      public void end()
      Specified by:
      end in interface org.axonframework.tracing.Span
    • recordException

      public org.axonframework.tracing.Span recordException(Throwable t)
      Specified by:
      recordException in interface org.axonframework.tracing.Span
    • addAttribute

      public org.axonframework.tracing.Span addAttribute(String key, String value)
      Specified by:
      addAttribute in interface org.axonframework.tracing.Span