Package org.jenkinsci.plugins.cloudstats
Class CloudStatistics.ProvisioningListener
- java.lang.Object
-
- hudson.slaves.CloudProvisioningListener
-
- org.jenkinsci.plugins.cloudstats.CloudStatistics.ProvisioningListener
-
- All Implemented Interfaces:
ExtensionPoint
- Enclosing class:
- CloudStatistics
@Extension public static class CloudStatistics.ProvisioningListener extends CloudProvisioningListener
Listen to ongoing provisioning activities.All activities that are triggered by Jenkins queue load (those that goes through
NodeProvisioner
) are reported by Jenkins core. This api needs to be called by plugin if and only if the agents are provisioned differently.Implementation note: onComplete and onFailure are being called while holding the queue lock from NodeProvisioner, so the work is extracted to separate thread.
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from interface hudson.ExtensionPoint
ExtensionPoint.LegacyInstancesAreScopedToHudson
-
-
Constructor Summary
Constructors Constructor Description ProvisioningListener()
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description static CloudStatistics.ProvisioningListener
get()
void
onComplete(NodeProvisioner.PlannedNode plannedNode, Node node)
ProvisioningActivity
onComplete(ProvisioningActivity.Id id, Node node)
Inform plugin provisioning has completed.void
onFailure(NodeProvisioner.PlannedNode plannedNode, Throwable t)
ProvisioningActivity
onFailure(ProvisioningActivity.Id id, Throwable throwable)
Inform plugin provisioning has failed.void
onStarted(Cloud cloud, Label label, Collection<NodeProvisioner.PlannedNode> plannedNodes)
ProvisioningActivity
onStarted(ProvisioningActivity.Id id)
Inform plugin provisioning has started.-
Methods inherited from class hudson.slaves.CloudProvisioningListener
all, canProvision, canProvision, onCommit, onRollback
-
-
-
-
Method Detail
-
onStarted
@Restricted(org.kohsuke.accmod.restrictions.DoNotUse.class) public void onStarted(Cloud cloud, Label label, Collection<NodeProvisioner.PlannedNode> plannedNodes)
- Overrides:
onStarted
in classCloudProvisioningListener
-
onStarted
@NonNull public ProvisioningActivity onStarted(@NonNull ProvisioningActivity.Id id)
Inform plugin provisioning has started. This is only needed when provisioned outsideNodeProvisioner
.- Parameters:
id
- Unique identifier of the activity. The plugin is responsible for this to be unique and all subsequent calls are identified by the same Id instance.
-
onComplete
@Restricted(org.kohsuke.accmod.restrictions.DoNotUse.class) public void onComplete(NodeProvisioner.PlannedNode plannedNode, Node node)
- Overrides:
onComplete
in classCloudProvisioningListener
-
onComplete
@CheckForNull public ProvisioningActivity onComplete(@NonNull ProvisioningActivity.Id id, @NonNull Node node)
Inform plugin provisioning has completed. This is only needed when provisioned outsideNodeProvisioner
.The method should be called before the node is added to Jenkins.
-
onFailure
@Restricted(org.kohsuke.accmod.restrictions.DoNotUse.class) public void onFailure(NodeProvisioner.PlannedNode plannedNode, Throwable t)
- Overrides:
onFailure
in classCloudProvisioningListener
-
onFailure
@CheckForNull public ProvisioningActivity onFailure(@NonNull ProvisioningActivity.Id id, @NonNull Throwable throwable)
Inform plugin provisioning has failed. This is only needed when provisioned outsideNodeProvisioner
.No node with
id
should be added added to jenkins.
-
get
public static CloudStatistics.ProvisioningListener get()
-
-