Class VManagerRunsClient
java.lang.Object
org.jenkinsci.plugins.vmanager.charts.util.VManagerRunsClient
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 ClassesModifier and TypeClassDescriptionstatic final classSingle run point: holds bothtimeToStartMinutesandtimeToEndMinutes(elapsed minutes from the session's start to the run's start / end respectively), the rundurationMinutes, the vManager-reportedestimatedDurationMinutes(the value of theestimated_duration_vmgrattribute, converted from seconds to minutes) and the vManager runid(numeric). -
Method Summary
Modifier and TypeMethodDescriptionstatic LinkedHashMap<String, Integer> fetchFailureDescriptionCounts(String baseUrl, Collection<String> sessionNames, com.cloudbees.plugins.credentials.common.StandardUsernamePasswordCredentials creds, TaskListener listener) POSTs/rest/runs/listgrouped byfirst_failure_descriptionfor the given sessions and returns a map of description →number_of_entities.static LinkedHashMap<String, Integer> 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.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) POSTs/rest/runs/listgrouped by an arbitrary RUN_LEVEL attribute and returns a map of group-value →number_of_entities.static List<VManagerRunsClient.RunPoint> fetchRunPoints(String baseUrl, Collection<String> sessionNames, long sessionStartMillis, com.cloudbees.plugins.credentials.common.StandardUsernamePasswordCredentials creds, TaskListener listener) POSTs/rest/runs/listfor the given sessions and returns the resulting points (already converted to minutes), preserving the server's ASCENDING-by-duration ordering.static longfetchSessionStartMillis(String baseUrl, Collection<String> sessionNames, com.cloudbees.plugins.credentials.common.StandardUsernamePasswordCredentials creds, TaskListener listener) POSTs/rest/sessions/listfor the given sessions, sorted bystart_time ASCENDING, and returns thestart_time(in ms) of the earliest session — i.e.
-
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/listfor the given sessions, sorted bystart_time ASCENDING, and returns thestart_time(in ms) of the earliest session — i.e. the start of the regression.- Returns:
- the session start time in milliseconds, or
0Lif 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/listfor 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'stimeToStartMinutesas(startTimeMs - sessionStartMillis) / 60000.creds- credentials for HTTP Basic auth; may benull(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(nevernull). - 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/listgrouped byfirst_failure_descriptionfor the given sessions and returns a map of description →number_of_entities. Thin wrapper aroundfetchGroupByCounts(String, Collection, StandardUsernamePasswordCredentials, TaskListener, String, int, java.util.List)preserved for backward compatibility with the original single-purpose Failure Triage chart; applies the historicalstatus 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 emptystatusFilterslist.- 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/listgrouped 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 bynumber_of_entities). Entries withnumber_of_entities <= 0are filtered out server-side via thepostFilter.- 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 benull.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 /nullmeans "no status filter".- Throws:
IOException
-