1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139
|
package testing
import (
"time"
"github.com/gophercloud/utils/gnocchi/metric/v1/measures"
)
// MeasuresListResult represents a raw server response from a server to a List call.
const MeasuresListResult = `
[
[
"2018-01-10T12:00:00+00:00",
3600.0,
15.0
],
[
"2018-01-10T13:00:00+00:00",
3600.0,
10.0
],
[
"2018-01-10T14:00:00+00:00",
3600.0,
20.0
]
]
`
// ListMeasuresExpected represents an expected repsonse from a List request.
var ListMeasuresExpected = []measures.Measure{
{
Timestamp: time.Date(2018, 1, 10, 12, 0, 0, 0, time.UTC),
Granularity: 3600.0,
Value: 15.0,
},
{
Timestamp: time.Date(2018, 1, 10, 13, 0, 0, 0, time.UTC),
Granularity: 3600.0,
Value: 10.0,
},
{
Timestamp: time.Date(2018, 1, 10, 14, 0, 0, 0, time.UTC),
Granularity: 3600.0,
Value: 20.0,
},
}
// MeasuresCreateRequest represents a request to create measures for a single metric.
const MeasuresCreateRequest = `
[
{
"timestamp": "2018-01-18T12:31:00",
"value": 101.2
},
{
"timestamp": "2018-01-18T14:32:00",
"value": 102
}
]
`
// MeasuresBatchCreateMetricsRequest represents a request to create measures for a single metric.
const MeasuresBatchCreateMetricsRequest = `
{
"777a01d6-4694-49cb-b86a-5ba9fd4e609e": [
{
"timestamp": "2018-01-10T01:00:00",
"value": 200
},
{
"timestamp": "2018-01-10T02:45:00",
"value": 300
}
],
"6dbc97c5-bfdf-47a2-b184-02e7fa348d21": [
{
"timestamp": "2018-01-10T01:00:00",
"value": 111
},
{
"timestamp": "2018-01-10T02:45:00",
"value": 222
}
]
}
`
// MeasuresBatchCreateResourcesMetricsRequest represents a request to create measures for a single metric.
const MeasuresBatchCreateResourcesMetricsRequest = `
{
"75274f99-faf6-4112-a6d5-2794cb07c789": {
"network.incoming.bytes.rate": {
"archive_policy_name": "high",
"unit": "B/s",
"measures": [
{
"timestamp": "2018-01-20T12:30:00",
"value": 1562.82
},
{
"timestamp": "2018-01-20T13:15:00",
"value": 768.1
}
]
},
"network.outgoing.bytes.rate": {
"archive_policy_name": "high",
"unit": "B/s",
"measures": [
{
"timestamp": "2018-01-20T12:30:00",
"value": 273
},
{
"timestamp": "2018-01-20T13:15:00",
"value": 3141.14
}
]
}
},
"23d5d3f7-9dfa-4f73-b72b-8b0b0063ec55": {
"disk.write.bytes.rate": {
"archive_policy_name": "low",
"unit": "B/s",
"measures": [
{
"timestamp": "2018-01-20T12:30:00",
"value": 1237
},
{
"timestamp": "2018-01-20T13:15:00",
"value": 132.12
}
]
}
}
}
`
|