Class BinaryLoggerConfigurationHelpers

java.lang.Object
com.illumon.iris.db.util.logging.BinaryLoggerConfigurationHelpers

public class BinaryLoggerConfigurationHelpers extends Object
  • Field Details

  • Constructor Details

    • BinaryLoggerConfigurationHelpers

      public BinaryLoggerConfigurationHelpers()
  • Method Details

    • getInternalPartitionFromConfig

      @Nullable public static String getInternalPartitionFromConfig()
      Gets the LOCAL_INTERNAL_PARTITION_PROPERTY from the Configuration if it is defined. If the property value starts with env: then the part of the property after that prefix will be used to look up and return an environment variable. For example, if configuring a property value of env:NODE_IP this method will return the value of the NODE_IP environment variable, with all '.' characters replaced with a '_'. Return null if the property is not present, or if there is no environment variable whose name matches the part of the property after env: prefix.
      Returns:
      The value to be used as the internal partition. Will be null if LOCAL_INTERNAL_PARTITION_PROPERTY is not defined, or the environment variable it references is not defined.
    • getInternalPartitionForLogs

      @NotNull public static String getInternalPartitionForLogs()
      Get an internal partition for binary logging.

      If there is a specific internal partition available from configuration (as determined by getInternalPartitionFromConfig(), use that. Otherwise, use the current node identifier as a partition.

      Returns:
      a generic internal partition for binary logging, without awareness of the specific logger
    • getNodeIdentifier

      public static String getNodeIdentifier(boolean legalize)
      Get the identifier for the local host by calling InetAddress.getLocalHost().getHostName() if it is available, optionally legalizing it for use as a partition identifier by replacing dots with underscores. This will return a Pod name if deployed in a Kubernetes environment.
      Parameters:
      legalize - if true, modify the return value to be a legal partition string
      Returns:
      the local host name, or "UndeterminedHost" if it can't be determined
    • getNodeIdentifier

      public static String getNodeIdentifier()
      Get the identifier for the local node if it is available
      Returns:
      the local host name, or "UndeterminedHost" if it can't be determined
    • getDefaultLogFormat

      public static String getDefaultLogFormat(int logFormat)
      Get the log format suffix formatted using "%d".
    • getInternalPartitionForLogs

      @NotNull @InternalUseOnly public static String getInternalPartitionForLogs(@Nullable String internalPartitionSuffix, @Nullable String logFormat, boolean includePid)
      Determine an appropriate internal partition that can be used for writing logs. Calls getInternalPartitionFromConfig() and uses that value, if a config value is present. If not, then the partition will be the value obtained by calling getNodeIdentifier(), with any period characters replaced with underscores.
      Parameters:
      includePid - should the process ID of this process be included in the internal partition name. In the standard configuration, when using the LAS or files this is false. When falling back to files from the LAS, this is true so that multiple processes do not create invalid streams.
      Returns:
      the internal partition as described above.