Class JfrSpanProcessor

java.lang.Object
org.infinispan.server.core.telemetry.jfr.JfrSpanProcessor
All Implemented Interfaces:
io.opentelemetry.sdk.trace.SpanProcessor, Closeable, AutoCloseable

public final class JfrSpanProcessor extends Object implements io.opentelemetry.sdk.trace.SpanProcessor
Hook to generate Events based on Span.

This implementation hooks into OpenTelemetry to generate internal events to record with JFR. This approach enables us to keep track of telemetry and tracing with a lower overhead and easy-to-configure alternative.

Although the exporter is active, the JVM must be properly configured to record events with JFR. Otherwise, no event is recorded. The application starts with the `-XX:StartFlightRecording=...` option or during runtime with the `jcmd JFR.start ...` command line tool.

This implementation is an adaptation of OpenTelemetry Java Flight Recorder (JFR) Events.
Since:
15.1.0
  • Constructor Summary

    Constructors
    Constructor
    Description
     
  • Method Summary

    Modifier and Type
    Method
    Description
    boolean
     
    boolean
     
    void
    onEnd(io.opentelemetry.sdk.trace.ReadableSpan span)
     
    void
    onStart(io.opentelemetry.context.Context parentContext, io.opentelemetry.sdk.trace.ReadWriteSpan span)
     
    io.opentelemetry.sdk.common.CompletableResultCode
     

    Methods inherited from class java.lang.Object

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

    Methods inherited from interface io.opentelemetry.sdk.trace.SpanProcessor

    close, forceFlush
  • Constructor Details

    • JfrSpanProcessor

      public JfrSpanProcessor()
  • Method Details

    • onStart

      public void onStart(io.opentelemetry.context.Context parentContext, io.opentelemetry.sdk.trace.ReadWriteSpan span)
      Specified by:
      onStart in interface io.opentelemetry.sdk.trace.SpanProcessor
    • isStartRequired

      public boolean isStartRequired()
      Specified by:
      isStartRequired in interface io.opentelemetry.sdk.trace.SpanProcessor
    • onEnd

      public void onEnd(io.opentelemetry.sdk.trace.ReadableSpan span)
      Specified by:
      onEnd in interface io.opentelemetry.sdk.trace.SpanProcessor
    • isEndRequired

      public boolean isEndRequired()
      Specified by:
      isEndRequired in interface io.opentelemetry.sdk.trace.SpanProcessor
    • shutdown

      public io.opentelemetry.sdk.common.CompletableResultCode shutdown()
      Specified by:
      shutdown in interface io.opentelemetry.sdk.trace.SpanProcessor