类 TracerRegistry

java.lang.Object
io.agentscope.core.tracing.TracerRegistry

public class TracerRegistry extends Object
Registry for the global Tracer instance.

Reactor global hook: This class provides methods to enable or disable a global Reactor hook (via enableTracingHook() and disableTracingHook()) that propagates tracing context across Reactor operators. Enabling this hook affects all Reactor operations in the JVM, which may have performance implications even for code unrelated to tracing. Use with care, and only enable the hook if you require tracing context propagation for all Reactor pipelines.

  • 构造器详细资料

    • TracerRegistry

      public TracerRegistry()
  • 方法详细资料

    • enableTracingHook

      public static void enableTracingHook()
      Enables the global Reactor hook for tracing context propagation.

      Mechanism: This registers a global hook using Hooks.onEachOperator(String, Function) that intercepts every Reactor operator creation involved in Flux and Mono chains. It wraps the Subscriber to ensure that downstream signals (onNext, onError, onComplete) are processed within the tracing context captured at assembly time or from upstream.

      Activation: The hook is active immediately after calling this method. It affects all subsequently assembled Reactor streams in the JVM.

      Performance: Enabling this hook introduces overhead for every Reactor operator in the application, even those not strictly related to AgentScope tracing. It involves object allocation (wrapper subscribers) and context context capturing/restoring. It should be enabled only when automatic context propagation across asynchronous boundaries is required.

      This method is safe to call multiple times; the hook will only be registered once.

    • disableTracingHook

      public static void disableTracingHook()
      Disables the global Reactor hook for tracing context propagation. This removes the hook for all Reactor operators in the JVM.
    • register

      public static void register(Tracer tracer)
    • get

      public static Tracer get()