Class VManagerMetricsClient
java.lang.Object
org.jenkinsci.plugins.vmanager.charts.util.VManagerMetricsClient
Thin client around the vManager
/rest/metrics/get endpoint used to
obtain coverage / vPlan attribute values for a build.
The endpoint expects a POST with a JSON body of the form:
{
"hierarchy": "Verification Metrics/Instances",
"sticky-context": {
"runs-rs": {
"filter": {
"@c": ".RelationFilter",
"relationName":"session",
"filter": { "@c":".InFilter", "attName":"name", "operand":"IN",
"values":["session_1","session_2"] }
}
},
"refinement-files": ["/abs/path/to/file1", "/abs/path/to/file2"]
},
"projection": { "selection": ["attribute_id_1", "attribute_id_2"] },
"verification-scope": "..."
}
The response is a JSON array of objects; each object contains the projected attribute ids as keys. Numeric values are summed across rows.
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final StringDefault value used when the user-supplied hierarchy is blank. -
Method Summary
Modifier and TypeMethodDescriptionfetchMetricSums(String baseUrl, String hierarchy, String verificationScope, Collection<String> sessionNames, Collection<String> refinementFiles, Collection<String> attributeIds, com.cloudbees.plugins.credentials.common.StandardUsernamePasswordCredentials creds, CoverageRoutingContext routingCtx, TaskListener listener) Posts a metrics-get query and returns the summed numeric value for each requested attribute id across all rows the server returns.
-
Field Details
-
DEFAULT_HIERARCHY
Default value used when the user-supplied hierarchy is blank.- See Also:
-
-
Method Details
-
fetchMetricSums
public static Map<String,Double> fetchMetricSums(String baseUrl, String hierarchy, String verificationScope, Collection<String> sessionNames, Collection<String> refinementFiles, Collection<String> attributeIds, com.cloudbees.plugins.credentials.common.StandardUsernamePasswordCredentials creds, CoverageRoutingContext routingCtx, TaskListener listener) throws IOException Posts a metrics-get query and returns the summed numeric value for each requested attribute id across all rows the server returns.- Parameters:
baseUrl- vManager server base URL.hierarchy- coverage / vPlan hierarchy path; ifnull/blank,DEFAULT_HIERARCHYis used.verificationScope- verification scope string;nullis sent as empty.sessionNames- session names that drive theRelationFilter;null/empty returns zeros.refinementFiles- absolute filesystem paths to refinement files; may benull/empty.attributeIds- attribute ids to project;null/empty returns an empty map.creds- HTTP Basic credentials; may benull.routingCtx- per-build routing-OID holder. The first call within a build is sent withoutx-vmgr-routing-oid; subsequent calls echo back the value the server returned in the previous response. May benull(no routing headers sent).listener- build console for payload / header logging; may benull.- Returns:
- map of attribute id → summed value (entries pre-seeded to
0.0for every requested id). Nevernull. - Throws:
IOException
-