Class VManagerRunsClient

java.lang.Object
org.jenkinsci.plugins.vmanager.charts.util.VManagerRunsClient

public final class VManagerRunsClient extends Object
Thin client around the vManager /rest/runs/list endpoint used to fetch the (start_time, duration) pair of every run that belongs to a given set of sessions.

The payload uses a .ChainedFilter (OR) of one .RelationFilter per session name, asks the server to sort by duration ASCENDING and projects only the two columns we need (duration, start_time).

For internal vManager servers with self-signed certs the underlying VManagerHttpClient trusts all certs/hostnames.

  • Nested Class Summary

    Nested Classes
    Modifier and Type
    Class
    Description
    static final class 
    Single run point: holds both timeToStartMinutes and timeToEndMinutes (elapsed minutes from the session's start to the run's start / end respectively), the run durationMinutes, the vManager-reported estimatedDurationMinutes (the value of the estimated_duration_vmgr attribute, converted from seconds to minutes) and the vManager run id (numeric).
  • Method Summary

    Modifier and Type
    Method
    Description
    fetchFailureDescriptionCounts(String baseUrl, Collection<String> sessionNames, com.cloudbees.plugins.credentials.common.StandardUsernamePasswordCredentials creds, TaskListener listener)
    POSTs /rest/runs/list grouped by first_failure_description for the given sessions and returns a map of description → number_of_entities.
    fetchGroupByCounts(String baseUrl, Collection<String> sessionNames, com.cloudbees.plugins.credentials.common.StandardUsernamePasswordCredentials creds, TaskListener listener, String groupByAttributeId, int pageLength)
    Two-argument convenience overload for callers that don't need to restrict by run status.
    fetchGroupByCounts(String baseUrl, Collection<String> sessionNames, com.cloudbees.plugins.credentials.common.StandardUsernamePasswordCredentials creds, TaskListener listener, String groupByAttributeId, int pageLength, List<String> statusFilters)
    POSTs /rest/runs/list grouped by an arbitrary RUN_LEVEL attribute and returns a map of group-value → number_of_entities.
    fetchRunPoints(String baseUrl, Collection<String> sessionNames, long sessionStartMillis, com.cloudbees.plugins.credentials.common.StandardUsernamePasswordCredentials creds, TaskListener listener)
    POSTs /rest/runs/list for the given sessions and returns the resulting points (already converted to minutes), preserving the server's ASCENDING-by-duration ordering.
    static long
    fetchSessionStartMillis(String baseUrl, Collection<String> sessionNames, com.cloudbees.plugins.credentials.common.StandardUsernamePasswordCredentials creds, TaskListener listener)
    POSTs /rest/sessions/list for the given sessions, sorted by start_time ASCENDING, and returns the start_time (in ms) of the earliest session — i.e.

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Method Details

    • fetchSessionStartMillis

      public static long fetchSessionStartMillis(String baseUrl, Collection<String> sessionNames, com.cloudbees.plugins.credentials.common.StandardUsernamePasswordCredentials creds, TaskListener listener) throws IOException
      POSTs /rest/sessions/list for the given sessions, sorted by start_time ASCENDING, and returns the start_time (in ms) of the earliest session — i.e. the start of the regression.
      Returns:
      the session start time in milliseconds, or 0L if no row was returned (or the value was missing/non-numeric).
      Throws:
      IOException
    • fetchRunPoints

      public static List<VManagerRunsClient.RunPoint> fetchRunPoints(String baseUrl, Collection<String> sessionNames, long sessionStartMillis, com.cloudbees.plugins.credentials.common.StandardUsernamePasswordCredentials creds, TaskListener listener) throws IOException
      POSTs /rest/runs/list for the given sessions and returns the resulting points (already converted to minutes), preserving the server's ASCENDING-by-duration ordering.
      Parameters:
      baseUrl - vManager server base URL (e.g. https://host:port/vmgr/vapi).
      sessionNames - one or more session names; null/empty returns an empty list.
      sessionStartMillis - the session start time in ms, used to compute each point's timeToStartMinutes as (startTimeMs - sessionStartMillis) / 60000.
      creds - credentials for HTTP Basic auth; may be null (no auth header).
      listener - optional task listener; when non-null the URL, headers and payload are echoed to the build log.
      Returns:
      list of VManagerRunsClient.RunPoint (never null).
      Throws:
      IOException
    • fetchFailureDescriptionCounts

      public static LinkedHashMap<String,Integer> fetchFailureDescriptionCounts(String baseUrl, Collection<String> sessionNames, com.cloudbees.plugins.credentials.common.StandardUsernamePasswordCredentials creds, TaskListener listener) throws IOException
      POSTs /rest/runs/list grouped by first_failure_description for the given sessions and returns a map of description → number_of_entities. Thin wrapper around fetchGroupByCounts(String, Collection, StandardUsernamePasswordCredentials, TaskListener, String, int, java.util.List) preserved for backward compatibility with the original single-purpose Failure Triage chart; applies the historical status IN ["failed"] filter so callers get the same data set they used to.
      Throws:
      IOException
    • fetchGroupByCounts

      public static LinkedHashMap<String,Integer> fetchGroupByCounts(String baseUrl, Collection<String> sessionNames, com.cloudbees.plugins.credentials.common.StandardUsernamePasswordCredentials creds, TaskListener listener, String groupByAttributeId, int pageLength) throws IOException
      Two-argument convenience overload for callers that don't need to restrict by run status. Equivalent to passing an empty statusFilters list.
      Throws:
      IOException
    • fetchGroupByCounts

      public static LinkedHashMap<String,Integer> fetchGroupByCounts(String baseUrl, Collection<String> sessionNames, com.cloudbees.plugins.credentials.common.StandardUsernamePasswordCredentials creds, TaskListener listener, String groupByAttributeId, int pageLength, List<String> statusFilters) throws IOException
      POSTs /rest/runs/list grouped by an arbitrary RUN_LEVEL attribute and returns a map of group-value → number_of_entities. Insertion order is preserved from the server response (sorted DESCENDING by number_of_entities). Entries with number_of_entities <= 0 are filtered out server-side via the postFilter.
      Parameters:
      baseUrl - vManager server base URL.
      sessionNames - one or more session names; null/empty returns an empty map.
      creds - credentials for HTTP Basic auth; may be null.
      listener - optional task listener; when non-null the URL, headers and payload are echoed to the build log (only when verbose logging is on).
      groupByAttributeId - id of the RUN_LEVEL attribute to group on (e.g. first_failure_description, status, computer).
      pageLength - maximum number of groups to return.
      statusFilters - optional list of run statuses (e.g. ["failed"], ["passed","failed"]). Empty / null means "no status filter".
      Throws:
      IOException