Class StatsdNotifier

java.lang.Object
org.jenkinsci.plugins.githubautostatus.notifiers.BuildNotifier
org.jenkinsci.plugins.githubautostatus.notifiers.StatsdNotifier
All Implemented Interfaces:
ExtensionPoint

public class StatsdNotifier extends BuildNotifier
Sends job and stage metrics to a StatsD collector server over UDP.
Author:
Tom Hadlaw (thomas.hadlaw@hootsuite.com)
  • Field Details

  • Constructor Details

  • Method Details

    • isEnabled

      public boolean isEnabled()
      Determines whether this notifier is enabled.
      Specified by:
      isEnabled in class BuildNotifier
      Returns:
      true if enabled; false otherwise
    • getBranchPath

      public String getBranchPath()
      Returns the StatsD including the global prefix up to the branch bucket.
      Returns:
      string of path up to branch bucket
    • notifyBuildStageStatus

      public void notifyBuildStageStatus(String jobName, BuildStage stageItem)
      Sends duration metric to StatsD by doing a timer metric - interface-dictated wrapper around notifyBuildStageStatus(String, String, BuildStage.State, long).
      Specified by:
      notifyBuildStageStatus in class BuildNotifier
      Parameters:
      jobName - the name of the job (currently ignored, required for interface)
      stageItem - stage item describing the new state (its name and state is what gets reported)
    • notifyBuildStageStatus

      public void notifyBuildStageStatus(String jobName, String nodeName, BuildStage.State buildState, long nodeDuration)
      Sends duration metric to StatsD by doing a timer metric - actual implementation.
      Parameters:
      jobName - the name of the job (currently ignored)
      nodeName - the name of the node (stage)
      buildState - the new state
      nodeDuration - the duration of the node
    • notifyFinalBuildStatus

      public void notifyFinalBuildStatus(BuildStage.State buildState, Map<String,Object> parameters)
      Sends final build status metric by doing a timer metric for blocked and unblocked job time.
      Specified by:
      notifyFinalBuildStatus in class BuildNotifier
      Parameters:
      buildState - the reported state
      parameters - build parameters
    • sendNonStageError

      public void sendNonStageError(String jobName, String nodeName)
      Sends build status metric to StatsD by doing an increment on the buildState categories.
      Parameters:
      jobName - name of the job (currently ignored)
      nodeName - the stage of the status on which to report on
    • sanitizeAll

      public String sanitizeAll(String key)
      Applies all sanitizations to a key, folders are expanded into separate StatsD buckets. It first applies bucket sanitization (removing periods to prevent them being interpreted as separate buckets). It then applies the StatsD bucket key sanitization.
      Parameters:
      key - key to sanitize
      Returns:
      sanitized key