Class ReconfigurableOpenTelemetry

java.lang.Object
io.jenkins.plugins.opentelemetry.api.ReconfigurableOpenTelemetry
All Implemented Interfaces:
ExtensionPoint, ExtendedOpenTelemetry, io.opentelemetry.api.OpenTelemetry, Closeable, AutoCloseable

public class ReconfigurableOpenTelemetry extends Object implements ExtendedOpenTelemetry, io.opentelemetry.api.OpenTelemetry, Closeable, ExtensionPoint

Reconfigurable OpenTelemetry.

We need reconfigurability because Jenkins supports changing the configuration of the OpenTelemetry params at runtime. All instantiated tracers, loggers, and eventLoggers are reconfigured when the configuration changes, when configure(Map, Resource) is invoked.

Reconfigurable EventLoggerProvider that allows to reconfigure the Tracers, Loggers, and EventLoggers.

Jenkins components interested in being notified after the OpenTelemetry configuration changes can be marked as @Extension and implement OpenTelemetryLifecycleListener.

  • Constructor Details

    • ReconfigurableOpenTelemetry

      public ReconfigurableOpenTelemetry()

      Initialize as NoOp.

      See Also:
  • Method Details

    • init

    • get

      @Extension(ordinal=2.147483647E9) public static ReconfigurableOpenTelemetry get()
      Use a factory method for the @Extension to ensure single instantiation across Jenkins

      The Jenkins component ReconfigurableOpenTelemetry is instantiated through the static factory method get() rather than through the instance constructor to ensure that we have single instantiation across Jenkins' @Extension and Google Guice @Inject.

      This factory method works in conjunction with OpenTelemetryApiGuiceModule

    • configure

      @Deprecated public void configure(@NonNull Map<String,String> openTelemetryProperties, io.opentelemetry.sdk.resources.Resource openTelemetryResource)
      Deprecated.
      Configure the OpenTelemetry SDK with the given properties and resource disabling the OTel SDK shutdown hook
      Specified by:
      configure in interface ExtendedOpenTelemetry
    • configure

      public void configure(@NonNull Map<String,String> openTelemetryProperties, io.opentelemetry.sdk.resources.Resource openTelemetryResource, boolean disableShutdownHook)
      Description copied from interface: ExtendedOpenTelemetry
      Reconfigures the OpenTelemetry instance. If no exporter is explicitly defined, this OpenTelemetry instance is NoOp.
      Specified by:
      configure in interface ExtendedOpenTelemetry
      Parameters:
      openTelemetryProperties - properties used as ConfigProperties through AutoConfiguredOpenTelemetrySdkBuilder.addPropertiesSupplier(Supplier)
      openTelemetryResource - resource attributes passed through AutoConfiguredOpenTelemetrySdkBuilder.addResourceCustomizer(BiFunction)
      disableShutdownHook - enable / disable a shutdown hook
    • setOpenTelemetryImpl

      protected void setOpenTelemetryImpl(io.opentelemetry.api.OpenTelemetry openTelemetryImpl)
    • close

      @PreDestroy public void close()
      Specified by:
      close in interface AutoCloseable
      Specified by:
      close in interface Closeable
    • getTracerProvider

      public io.opentelemetry.api.trace.TracerProvider getTracerProvider()
      Specified by:
      getTracerProvider in interface io.opentelemetry.api.OpenTelemetry
    • getTracer

      public io.opentelemetry.api.trace.Tracer getTracer(String instrumentationScopeName)
      Specified by:
      getTracer in interface io.opentelemetry.api.OpenTelemetry
    • getTracer

      public io.opentelemetry.api.trace.Tracer getTracer(String instrumentationScopeName, String instrumentationScopeVersion)
      Specified by:
      getTracer in interface io.opentelemetry.api.OpenTelemetry
    • tracerBuilder

      public io.opentelemetry.api.trace.TracerBuilder tracerBuilder(String instrumentationScopeName)
      Specified by:
      tracerBuilder in interface io.opentelemetry.api.OpenTelemetry
    • getMeterProvider

      public io.opentelemetry.api.metrics.MeterProvider getMeterProvider()
      Specified by:
      getMeterProvider in interface io.opentelemetry.api.OpenTelemetry
    • getEventLoggerProvider

      public io.opentelemetry.api.incubator.events.EventLoggerProvider getEventLoggerProvider()
      Specified by:
      getEventLoggerProvider in interface ExtendedOpenTelemetry
    • eventLoggerBuilder

      public io.opentelemetry.api.incubator.events.EventLoggerBuilder eventLoggerBuilder(String instrumentationScopeName)
      Specified by:
      eventLoggerBuilder in interface ExtendedOpenTelemetry
    • getMeter

      public io.opentelemetry.api.metrics.Meter getMeter(String instrumentationScopeName)
      Specified by:
      getMeter in interface io.opentelemetry.api.OpenTelemetry
    • meterBuilder

      public io.opentelemetry.api.metrics.MeterBuilder meterBuilder(String instrumentationScopeName)
      Specified by:
      meterBuilder in interface io.opentelemetry.api.OpenTelemetry
    • getImplementation

      @Deprecated public io.opentelemetry.api.OpenTelemetry getImplementation()
      Deprecated.
      Specified by:
      getImplementation in interface ExtendedOpenTelemetry
    • getResource

      @NonNull public io.opentelemetry.sdk.resources.Resource getResource()
      Description copied from interface: ExtendedOpenTelemetry
      Resource used by this OpenTelemetry instance for the resource attributes of the produced telemetry
      Specified by:
      getResource in interface ExtendedOpenTelemetry
    • getConfig

      @NonNull public io.opentelemetry.sdk.autoconfigure.spi.ConfigProperties getConfig()
      Description copied from interface: ExtendedOpenTelemetry
      ConfigProperties used to instantiate this OpenTelemetry instance using the AutoConfiguredOpenTelemetrySdk.
      Specified by:
      getConfig in interface ExtendedOpenTelemetry
    • getLogsBridge

      public io.opentelemetry.api.logs.LoggerProvider getLogsBridge()
      Specified by:
      getLogsBridge in interface io.opentelemetry.api.OpenTelemetry
    • getPropagators

      public io.opentelemetry.context.propagation.ContextPropagators getPropagators()
      Specified by:
      getPropagators in interface io.opentelemetry.api.OpenTelemetry
    • getLogRecordExporter

      public io.opentelemetry.sdk.logs.export.LogRecordExporter getLogRecordExporter()
      For testing and troubleshooting purpose
    • postOpenTelemetrySdkConfiguration

      @OverridingMethodsMustInvokeSuper protected void postOpenTelemetrySdkConfiguration()