Class CloudStatistics

java.lang.Object
hudson.model.ManagementLink
org.jenkinsci.plugins.cloudstats.CloudStatistics
All Implemented Interfaces:
ExtensionPoint, Action, ModelObject, Saveable, org.kohsuke.stapler.StaplerProxy

@ExportedBean @Extension public class CloudStatistics extends ManagementLink implements Saveable, org.kohsuke.stapler.StaplerProxy
Statistics of provisioning activities.
  • Field Details

    • ARCHIVE_RECORDS

      public static int ARCHIVE_RECORDS
      The number of completed records to be stored.
  • Constructor Details

    • CloudStatistics

      @Restricted(org.kohsuke.accmod.restrictions.NoExternalUse.class) public CloudStatistics()
  • Method Details

    • get

      @NonNull public static CloudStatistics get()
      Get the singleton instance.
    • getDisplayName

      public String getDisplayName()
      Specified by:
      getDisplayName in interface Action
      Specified by:
      getDisplayName in interface ModelObject
    • getIconFileName

      public String getIconFileName()
      Specified by:
      getIconFileName in interface Action
      Specified by:
      getIconFileName in class ManagementLink
    • getRequiredPermission

      @NonNull public Permission getRequiredPermission()
      Overrides:
      getRequiredPermission in class ManagementLink
    • getTarget

      public Object getTarget()
      Specified by:
      getTarget in interface org.kohsuke.stapler.StaplerProxy
    • getNotCompletedActivities

      @NonNull public Collection<ProvisioningActivity> getNotCompletedActivities()
      Get activities that was not completed yet.
    • getUrlName

      public String getUrlName()
      Specified by:
      getUrlName in interface Action
      Specified by:
      getUrlName in class ManagementLink
    • getDescription

      public String getDescription()
      Overrides:
      getDescription in class ManagementLink
    • getCategoryName

      public String getCategoryName()
      Name of the category for this management link. Exists so that plugins with core dependency pre-dating the version when this was introduced can define a category.

      TODO when the core version is >2.226 change this to override getCategory() instead

      Overrides:
      getCategoryName in class ManagementLink
      Returns:
      name of the desired category, one of the enum values of Category, e.g. STATUS.
      Since:
      2.226 of Jenkins core
    • getActivities

      @Exported(inline=true) public List<ProvisioningActivity> getActivities()
    • getApi

      public Api getApi()
      Exposes provisioning activity data through the standard Jenkins remote API (/manage/cloud-stats/api/json and /manage/cloud-stats/api/xml).

      Permission model: Access is enforced by getTarget(), which checks Jenkins.SYSTEM_READ before Stapler dispatches any route under this object — including both the HTML management pages and this API endpoint. SYSTEM_READ is therefore the single, consistent gate for everything this class serves.

      Stack-trace exposure: The exported data includes PhaseExecutionAttachment.ExceptionAttachment.getText() (full exception stack traces). This is intentional and not a new exposure: the identical text is already rendered as HTML at /manage/cloud-stats/activity/{fingerprint}/phase/{phase}/attachment/exception/ (see ExceptionAttachment/_index.jelly) for any caller who holds SYSTEM_READ. Requiring a stronger permission for the API endpoint but not for the HTML page would be inconsistent — the same data would remain accessible by simply navigating the UI. Organisations that consider SYSTEM_READ too broad for this data should tighten that permission grant rather than split the access model between UI and API.

    • getPotentiallyCompletedActivityFor

      @CheckForNull public ProvisioningActivity getPotentiallyCompletedActivityFor(ProvisioningActivity.Id id)
      Get activity that is suspected to be completed already.
      Returns:
      The activity or null if rotated already.
    • getActivityFor

      @CheckForNull public ProvisioningActivity getActivityFor(ProvisioningActivity.Id id)
      Get "active" activity, missing activity will be logged.
    • getActivityFor

      @CheckForNull public ProvisioningActivity getActivityFor(TrackedItem item)
    • getIndex

      public ActivityIndex getIndex()
    • getActivity

      @Restricted(org.kohsuke.accmod.restrictions.NoExternalUse.class) public ProvisioningActivity getActivity(@NonNull String hashString)
    • getUrl

      @Restricted(org.kohsuke.accmod.restrictions.NoExternalUse.class) @CheckForNull public String getUrl(@NonNull ProvisioningActivity activity, @NonNull PhaseExecution phaseExecution, @NonNull PhaseExecutionAttachment attachment)
    • attach

      public void attach(@NonNull ProvisioningActivity activity, @NonNull ProvisioningActivity.Phase phase, @NonNull PhaseExecutionAttachment attachment)
      Attach information to activity's phase execution.
    • save

      public void save() throws IOException
      Specified by:
      save in interface Saveable
      Throws:
      IOException