Class TelemetryLogger

java.lang.Object
io.deephaven.process.telemetry.TelemetryLogger

public class TelemetryLogger
extends Object
A TelemetryLogger is created by each long-lived "instance" of an object for which telemetry will be tracked. The TelemetryLogger will create any number of requested TelemetryItem instances to be tracked, each with its own unique identifier
  • Constructor Details

    • TelemetryLogger

      public TelemetryLogger​(com.fishlib.io.logger.Logger defaultLogger, boolean enabled)
      Construct a new TelemetryLogger instance
      Parameters:
      defaultLogger - a valid Logger
      enabled - if the instance should log telemetry. See TelemetryService.enabledFor(String)
    • TelemetryLogger

      public TelemetryLogger​(com.fishlib.io.logger.Logger defaultLogger)
      Construct a new TelemetryLogger instance. TelemetryItems created by this instance will log to local log-file and possibly to a remote table
      Parameters:
      defaultLogger - a valid Logger
    • TelemetryLogger

      public TelemetryLogger​(com.fishlib.io.logger.Logger defaultLogger, boolean enabled, TelemetryLogger.TelemetryInfo telemetryInfo)
      Construct a new TelemetryLogger instance
      Parameters:
      defaultLogger - a valid Logger
      enabled - if the instance should log telemetry. See TelemetryService.enabledFor(String)
      telemetryInfo - used to update "set-once" elements as part of construction instead of via updateFromInfo(TelemetryInfo)
    • TelemetryLogger

      public TelemetryLogger​(com.fishlib.io.logger.Logger defaultLogger, TelemetryLogger.TelemetryInfo telemetryInfo)
      Construct a new TelemetryLogger instance. TelemetryItems created by this instance will log to local log-file and possibly to a remote table
      Parameters:
      defaultLogger - a valid Logger
      telemetryInfo - used to update "set-once" elements as part of construction instead of via updateFromInfo(TelemetryInfo)
  • Method Details

    • enabledFor

      public static boolean enabledFor​(String whom)
      Parameters:
      whom - a string identifying a class, which may have a "Telemetry.enableFor.${whom}" property defined
      Returns:
      the configuration value, if defined. Defaults to `true`
    • updateFromInfo

      public void updateFromInfo​(TelemetryLogger.TelemetryInfo telemetryInfo)
      Update "set-once" elements for this TelemetryLogger instance
      Parameters:
      telemetryInfo - structure containing elements which shall be set
    • updateInfo

      public void updateInfo​(@Nullable String tableName, long pqSerial, @Nullable QueryProcessorConnection qpc)
    • updateInfo

      public void updateInfo​(@Nullable String tableName, long pqSerial, @Nullable String workerName, @Nullable String workerHost, @Nullable String processInfoId)
    • getInfo

      Copies potential "set-once" elements for this TelemetryLogger instance to a new TelemetryInfo object
      Returns:
      a new TelemetryInfo instance which is set from the current TelemetryLogger's values
    • setPqSerial

      public void setPqSerial​(long pqSerial)
      Update the "set-once" pq-serial-number
      Parameters:
      pqSerial - the serial of the PQ, if any
    • getPqSerial

      public long getPqSerial()
    • setWorker

      public void setWorker​(String worker)
      Update the "set-once" worker-name
      Parameters:
      worker - the worker-name
    • getWorker

      @Nullable public String getWorker()
    • setWorkerHost

      public void setWorkerHost​(String workerHost)
      Update the "set-once" worker host-name
      Parameters:
      workerHost - the hostname where the worker is running
    • getWorkerHost

      @Nullable public String getWorkerHost()
    • setProcessInfoId

      public void setProcessInfoId​(String processInfoId)
      Update the "set-once" worker ProcessInfoId
      Parameters:
      processInfoId - the ProcessInfoId of the worker
    • getProcessInfoId

      @Nullable public String getProcessInfoId()
    • setTableName

      public void setTableName​(String tableName)
      Update the "set-once" table-name
      Parameters:
      tableName - the name of the table
    • getTableName

      @Nullable public String getTableName()
    • telemetryItem

      public TelemetryItem telemetryItem​(String actionName)
      Gets a new TelemetryItem instance. The initial status will not be logged
      Parameters:
      actionName - the name of the new TelemetryItem
      Returns:
      a new TelemetryItem instance which is appropriate for the current configuration
    • telemetryItem

      public TelemetryItem telemetryItem​(String actionName, String eventStatus)
      Gets a new TelemetryItem instance, and logs the initialization of the item as LogLevel.INFO
      Parameters:
      actionName - the name of the new TelemetryItem
      eventStatus - the current status of the new TelemetryItem
      Returns:
      a new TelemetryItem instance which is appropriate for the current configuration
    • telemetryItem

      public TelemetryItem telemetryItem​(com.fishlib.io.log.LogLevel level, String actionName, String eventStatus)
      Gets a new TelemetryItem instance, and logs the initialization of the item as LogLevel.INFO
      Parameters:
      level - LogLevel to use for local logs, if any
      actionName - the name of the new TelemetryItem
      eventStatus - the current status of the new TelemetryItem
      Returns:
      a new TelemetryItem instance which is appropriate for the current configuration