Class Telemetries

java.lang.Object
org.acemq.amqp.core.Telemetries

public final class Telemetries extends Object
Builds the telemetry sink for a connection.

Micrometer and OpenTelemetry are optional dependencies, so neither may be present at runtime. Presence is checked by attempting to load one class from each and catching the failure. That is the only reliable test: an application that excluded the dependency has no class to load, and asking about it any other way means importing it.

When neither is available the core uses Telemetry.NONE, whose methods are empty and whose scopes allocate nothing. Instrumentation that an application did not ask for should cost it nothing.

No optional type is named anywhere in this class, not even in a method signature. A signature is part of a class's descriptors and is resolved when the class is loaded, so a single convenience factory taking a MeterRegistry here would make this class unloadable in any application without Micrometer. The typed factories live in MicrometerSupport and OpenTelemetrySupport, which are only loaded by callers that already have the dependency.

  • Method Details

    • autoDetect

      public static Telemetry autoDetect(String transport)
      Parameters:
      transport - transport short name, used as the messaging system tag
      Returns:
      a sink combining whichever providers are present, or a no-op when none are
    • composite

      public static Telemetry composite(Telemetry... delegates)
      Combines several sinks into one.
      Parameters:
      delegates - sinks to fan out to
      Returns:
      a sink reporting to all of them