Class OtelLauncherExtension

java.lang.Object
org.microproxy.otel.OtelLauncherExtension
All Implemented Interfaces:
LauncherExtension

public final class OtelLauncherExtension extends Object implements LauncherExtension
Adds --otel and its options to the command line when this module is on the class path. OpenTelemetry's OTEL_* environment variables configure it first, and the options override them; setting OTEL_EXPORTER_OTLP_ENDPOINT (or a signal's endpoint) turns it on without --otel, and OTEL_SDK_DISABLED=true keeps it off.
  • Constructor Details

    • OtelLauncherExtension

      public OtelLauncherExtension()
      Creates the extension, reading the process's environment.
    • OtelLauncherExtension

      public OtelLauncherExtension(Map<String,String> env)
      Creates the extension with another environment, for tests.
      Parameters:
      env - the environment variables
  • Method Details

    • usage

      public String usage()
      Description copied from interface: LauncherExtension
      Returns help lines for the options this extension adds, formatted like the built-in ones.
      Specified by:
      usage in interface LauncherExtension
      Returns:
      help lines for the options this extension adds, formatted like the built-in ones
    • parseOption

      public boolean parseOption(String option, Deque<String> args)
      Description copied from interface: LauncherExtension
      Consumes option if it belongs to this extension, taking any values from the front of args. Returns false for options it does not recognise.
      Specified by:
      parseOption in interface LauncherExtension
      Parameters:
      option - the command-line option to parse
      args - the remaining command-line arguments
      Returns:
      whether this extension consumed the option
    • configure

      public void configure(HttpProxyServerBootstrap bootstrap, PrintStream console)
      Description copied from interface: LauncherExtension
      Applies the parsed options, after the built-in ones; HttpProxyServerBootstrap.getChainProxyManager() shows any upstream configuration to wrap.
      Specified by:
      configure in interface LauncherExtension
      Parameters:
      bootstrap - the proxy configuration to extend
      console - the output stream for status messages and diagnostics