Class DatadogBuildListener
- java.lang.Object
-
- hudson.model.listeners.RunListener<Run>
-
- org.datadog.jenkins.plugins.datadog.listeners.DatadogBuildListener
-
- All Implemented Interfaces:
ExtensionPoint
@Extension public class DatadogBuildListener extends RunListener<Run>
This class registers anRunListener
to trigger events and calculate metrics: - When a build initializes, theonInitialize(Run)
method will be invoked. - When a build starts, theonStarted(Run, TaskListener)
method will be invoked. - When a build completes, theonCompleted(Run, TaskListener)
method will be invoked. - When a build finalizes, theonFinalized(Run)
method will be invoked.
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from interface hudson.ExtensionPoint
ExtensionPoint.LegacyInstancesAreScopedToHudson
-
-
Field Summary
-
Fields inherited from class hudson.model.listeners.RunListener
LISTENERS, targetType
-
-
Constructor Summary
Constructors Constructor Description DatadogBuildListener()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description DatadogClient
getDatadogClient()
Queue
getQueue()
com.cloudbees.workflow.rest.external.RunExt
getRunExtForRun(org.jenkinsci.plugins.workflow.job.WorkflowRun run)
void
onCompleted(Run run, TaskListener listener)
Called when a build is completed.void
onDeleted(Run run)
void
onFinalized(Run run)
Called when a build is finalized.void
onInitialize(Run run)
Called when a build is first initialized.void
onStarted(Run run, TaskListener listener)
Called when a build is first started.Environment
setUpEnvironment(AbstractBuild build, Launcher launcher, BuildListener listener)
Called before the SCMCheckout is run in a Jenkins build.-
Methods inherited from class hudson.model.listeners.RunListener
all, fireCompleted, fireDeleted, fireFinalized, fireInitialize, fireStarted, register, unregister
-
-
-
-
Method Detail
-
onInitialize
public void onInitialize(Run run)
Called when a build is first initialized.- Overrides:
onInitialize
in classRunListener<Run>
- Parameters:
run
- - A Run object representing a particular execution of Job.
-
setUpEnvironment
public Environment setUpEnvironment(AbstractBuild build, Launcher launcher, BuildListener listener) throws Run.RunnerAbortedException
Called before the SCMCheckout is run in a Jenkins build. This method is called after onInitialize callback.- Overrides:
setUpEnvironment
in classRunListener<Run>
- Throws:
Run.RunnerAbortedException
-
onStarted
public void onStarted(Run run, TaskListener listener)
Called when a build is first started.- Overrides:
onStarted
in classRunListener<Run>
- Parameters:
run
- - A Run object representing a particular execution of Job.listener
- - A TaskListener object which receives events that happen during some operation.
-
onCompleted
public void onCompleted(Run run, @Nonnull TaskListener listener)
Called when a build is completed.- Overrides:
onCompleted
in classRunListener<Run>
- Parameters:
run
- - A Run object representing a particular execution of Job.listener
- - A TaskListener object which receives events that happen during some operation.
-
onFinalized
public void onFinalized(Run run)
Called when a build is finalized.- Overrides:
onFinalized
in classRunListener<Run>
- Parameters:
run
- - A Run object representing a particular execution of Job.
-
onDeleted
public void onDeleted(Run run)
- Overrides:
onDeleted
in classRunListener<Run>
-
getRunExtForRun
public com.cloudbees.workflow.rest.external.RunExt getRunExtForRun(org.jenkinsci.plugins.workflow.job.WorkflowRun run)
-
getQueue
public Queue getQueue()
-
getDatadogClient
public DatadogClient getDatadogClient()
-
-