With the migration to Metrics v2, there are some minor updates required by the client to make it compatible with both versions (deprecation will come later).
To start, for v1, when you request "Give me metrics for Gate XYZ", you'll get something like this:
[
{
"id": {
"type": "DeploymentFrequencyMetric", // The Metric Name
"metricScope": "GATE", // The "depth" of the metric
"valueStreamId": "806853778--DevOptics-Deliver-Value-Stream", // ValueStreamId (always present)
"phaseId": "HylprF40Z7", // PhaseId (only if metric is a "PHASE" or "GATE" metric
"gateId": "H16rFNCbm", // GateId (only if a metric is a "GATE" metric
"version": 1
},
"timestamp": 1535483948985, // When the metric was calculated
"devOpticsId": "cloudbees",
"deploymentFrequency": 3.0 // The value,
"errors": [ "valueStreamDeploymentFrequencyNoDataInRange", ... ] // Errors within the metric
},
... // more Metrics for the same scope
]
The result is a returned list of metrics with the similar IDs, a timestamp
value, a specific metric-based value, namely deploymentFrequency
above, and then a errors
array containing a list of string errors that map directly to keys in the resource file in devoptics-ui.
For Metrics v2, the same request will result in a single object, called a MetricsRollupBucket
which will collapse a lot of the shared information across the above metrics. This object will contain a list of metrics, within the data
property:
{
"startTime": 1534338349617, // Data points used in calc had to occur here or after
"endTime": 1535547949617, // Data points used in calc had to occur here or before
"scope": { // Represents where the calc was compiled
"devOpticsId": "cloudbees",
"valueStreamId": "219174495--Acme-Online-SDLC",
"phaseId": "build", // Not included in a VS-scoped metric
"gateId": "checkout" // Not included in a Phase- or VS-scoped metric
},
"data": [{ // The metrics
"@c": ".DeploymentFrequencyMetric", // ignore @c - used by the backend
"value": 0.0, // The metric value
"name": "deploymentFrequency" // the metric name
}, {
"@c": ".MeanTimeToRecoveryMetric",
"errors": ["meanTimeToRecoveryNoTtrsAvailable"], // Errors look the same
"name": "meanTimeToRecovery"
}, {
"@c": ".ChangeFailureRateMetric",
"errors": ["changeFailureRateNoDataInRange"],
"name": "changeFailureRate"
}]
}
A MetricsRollupBucket
will have a scope
parameter outlining the scope that the metric was calculated for. A startTime
and endTime
representing the date range that the calculation was compiled across, and a data
property containing a list of Metrics
.
Each Metric
will have a value
property representing its individual value, an errors
array following the same format as v1 (list of strings that map to resource keys), and a name
property to identify the metric.