Class InstrumentationUtil

java.lang.Object
io.opentelemetry.api.impl.InstrumentationUtil

public final class InstrumentationUtil extends Object
Utility for suppressing instrumentation cycles between exporters which leverage various client libraries in their implementations and the otel java agent which instruments those client libraries.

This class is not intended for use by application developers. Its API is stable and will not be changed or removed in a backwards-incompatible manner.

Since:
1.63.0
  • Method Details

    • suppressInstrumentation

      public static void suppressInstrumentation(Runnable runnable)
      Adds a Context boolean key that will allow to identify HTTP calls coming from OTel exporters. The key later be checked by an automatic instrumentation to avoid tracing OTel exporter's calls.
    • shouldSuppressInstrumentation

      public static boolean shouldSuppressInstrumentation(io.opentelemetry.context.Context context)
      Checks if an automatic instrumentation should be suppressed with the provided Context.
      Returns:
      TRUE to suppress the automatic instrumentation, FALSE to continue with the instrumentation.