Class VManagerVplanClient

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

public final class VManagerVplanClient extends Object
Thin client around the vManager /rest/vplan/get endpoint used to obtain VPLAN_LEVEL attribute values for a build.

Payload shape:

{
   "hierarchy": "...",                              // omitted when blank
   "sticky-context": {
     "runs-rs": {
       "filter": { "@c":".RelationFilter", "relationName":"session",
                   "filter": { "@c":".InFilter", "attName":"name",
                               "operand":"IN", "values":[...] } }
     },
     "refinement-files":       [...],
     "vplan":                  "APB_UART",
     "db-vplan":               true,
     "vplan-refinement-files": [...]
   },
   "projection": { "selection": ["attr_id_1", "attr_id_2"] }
 }

The response is either a single JSON object whose keys match the projected attribute ids, or a JSON array of such objects. Numeric values are summed across rows; sentinel value -1 is rewritten to 0.0.

Per-build routing is handled via VplanRoutingContext: the first call for a given (vplan, type) pair sends only x-vmgr-routing-retain: 1; subsequent calls echo back the x-vmgr-routing-oid returned by the previous response for the same pair. The same pair may carry its OID across chart boundaries within one build.

  • Method Details

    • fetchVplanMetricSums

      public static Map<String,Double> fetchVplanMetricSums(String baseUrl, String hierarchy, Collection<String> sessionNames, Collection<String> refinementFiles, Collection<String> vplanRefinementFiles, String vplan, boolean dbVplan, Collection<String> attributeIds, com.cloudbees.plugins.credentials.common.StandardUsernamePasswordCredentials creds, VplanRoutingContext routingCtx, TaskListener listener) throws IOException
      Posts a vplan-get query and returns the summed numeric value for each requested attribute id.
      Parameters:
      baseUrl - vManager server base URL.
      hierarchy - hierarchy path; if null/blank the hierarchy key is omitted entirely.
      sessionNames - session names; null/empty returns zeros.
      refinementFiles - filesystem paths to refinement files; may be null/empty.
      vplanRefinementFiles - filesystem paths to vPlan refinement files; may be null/empty.
      vplan - vPlan name (e.g. "APB_UART").
      dbVplan - true for DB-stored vPlan, false for file-based vPlan.
      attributeIds - attribute ids to project; null/empty returns an empty map.
      creds - HTTP Basic credentials; may be null.
      routingCtx - per-build routing-OID holder keyed by (vplan, type); may be null.
      listener - build console for payload / header logging; may be null.
      Returns:
      map of attribute id → summed value (entries pre-seeded to 0.0). Never null.
      Throws:
      IOException