wp
This commit is contained in:
@@ -302,28 +302,31 @@ func sendRequests(conn *client.Connection) {
|
||||
// fmt.Printf("\nCumulative metric %d added\n", cumulativeMetricID)
|
||||
// }
|
||||
|
||||
// // GET CUMULATIVE METRIC
|
||||
// GET CUMULATIVE METRIC
|
||||
|
||||
// cMetric, err := conn.GetMetric(cumulativeMetricID)
|
||||
// if err != nil {
|
||||
// log.Fatalf("conn.GetMetric: %s\n", err)
|
||||
// } else {
|
||||
// fmt.Printf(`
|
||||
// GetMetric:
|
||||
// metricID: %d
|
||||
// metricType: %s
|
||||
// fracDigits: %d
|
||||
// `,
|
||||
// cMetric.MetricID, metricTypeToName[cMetric.MetricType], cMetric.FracDigits)
|
||||
cMetric, err := conn.GetMetric(cumulativeMetricID)
|
||||
if err != nil {
|
||||
log.Fatalf("conn.GetMetric: %s\n", err)
|
||||
} else {
|
||||
fmt.Printf(`
|
||||
GetMetric:
|
||||
metricID: %d
|
||||
metricType: %s
|
||||
fracDigits: %d
|
||||
`,
|
||||
cMetric.MetricID, metricTypeToName[cMetric.MetricType], cMetric.FracDigits)
|
||||
}
|
||||
|
||||
// APPEND MEASURES
|
||||
|
||||
// cumulativeMeasures := GenerateCumulativeMeasures(200)
|
||||
// if len(cumulativeMeasures) > 65535 {
|
||||
// cumulativeMeasures = cumulativeMeasures[:65535]
|
||||
// }
|
||||
|
||||
// // APPEND MEASURES
|
||||
|
||||
// cumulativeMeasures := GenerateCumulativeMeasures(62)
|
||||
|
||||
// result, err := conn.AppendMeasures(proto.AppendMeasuresReq{
|
||||
// MetricID: cumulativeMetricID,
|
||||
// Measures: cumulativeMeasures[:1000],
|
||||
// Measures: cumulativeMeasures,
|
||||
// })
|
||||
// if err != nil {
|
||||
// log.Fatalf("conn.AppendMeasures: %s\n", err)
|
||||
@@ -344,7 +347,6 @@ func sendRequests(conn *client.Connection) {
|
||||
// }
|
||||
|
||||
// LIST CUMULATIVE MEASURES
|
||||
var cumulativeList []proto.CumulativeMeasure
|
||||
|
||||
// lastTimestamp = cumulativeMeasures[len(cumulativeMeasures)-1].Timestamp
|
||||
// until = time.Unix(int64(lastTimestamp), 0)
|
||||
@@ -368,14 +370,15 @@ func sendRequests(conn *client.Connection) {
|
||||
|
||||
// LIST ALL CUMULATIVE MEASURES
|
||||
|
||||
var cumulativeList []proto.CumulativeMeasure
|
||||
cumulativeList, err = conn.ListAllCumulativeMeasures(cumulativeMetricID)
|
||||
if err != nil {
|
||||
log.Fatalf("conn.ListAllCumulativeMeasures: %s\n", err)
|
||||
} else {
|
||||
fmt.Printf("\nListAllCumulativeMeasures (last 15 items):\n")
|
||||
//fmt.Printf("%#v\n", cumulativeList)
|
||||
for _, item := range cumulativeList[:15] {
|
||||
fmt.Printf(" %s => %.2f\n", formatTime(item.Timestamp), item.Value)
|
||||
for idx, item := range cumulativeList {
|
||||
fmt.Printf(" %d: %s => %.2f\n", idx, formatTime(item.Timestamp), item.Value)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -518,6 +521,7 @@ func GenerateCumulativeMeasures(days int) []proto.Measure {
|
||||
totalValue float64
|
||||
)
|
||||
|
||||
idx := 0
|
||||
for i := range totalHours {
|
||||
hourTime := since.Add(time.Duration(i) * time.Hour)
|
||||
for _, m := range minutes {
|
||||
@@ -539,6 +543,16 @@ func GenerateCumulativeMeasures(days int) []proto.Measure {
|
||||
measures = append(measures, measure)
|
||||
|
||||
totalValue += rand.Float64()
|
||||
|
||||
if idx < 1500 {
|
||||
fmt.Println(idx, measure.Timestamp)
|
||||
}
|
||||
idx++
|
||||
}
|
||||
}
|
||||
for i := 1; i < len(measures); i++ {
|
||||
if measures[i].Timestamp <= measures[i-1].Timestamp {
|
||||
fmt.Println("FUCK", i)
|
||||
}
|
||||
}
|
||||
return measures
|
||||
@@ -580,3 +594,9 @@ func GenerateInstantMeasures(days int, baseValue float64) []proto.Measure {
|
||||
}
|
||||
return measures
|
||||
}
|
||||
|
||||
//02 88 30 3e 88 31 1d 88 31 3e a3 04 87 7f 04 87 7f 04 87 7f 04 87 7f 04 87 7f 04 87 7f 04 87 7f 04 87 7f 04 87 7f 04 87 7f 04 87 7f 04 87 7f 04 87 7f 04 87 7f 04 87 7f 04 87 7f 04 87 7f 04 87 7f 04 87 28 68 05 6a
|
||||
//02 88 30 3e 88 31 1d 88 31 3e a3 04 87 7f 04 87 7f 04 87 7f 04 87 7f 04 87 7f 04 87 7f 04 87 7f 04 87 7f 04 87 7f 04 87 7f 04 87 7f 04 87 7f 04 87 7f 04 87 7f 04 87 7f 04 87 7f 04 87 7f 04 87 7f 04 87 28 68 05 6a
|
||||
|
||||
//02 88 4b 4c 88 4c 06 88 4c 39 ae 04 87 7f 04 87 7f 04 87 7f 04 87 7f 04 87 7f 04 87 7f 04 87 7f 04 87 7f 04 87 7f 04 87 7f 04 87 7f 04 87 7f 04 87 7f 04 87 7f 04 87 7f 04 87 7f 04 87 7f 04 87 7f 04 87 30 1b 2c 6a
|
||||
//02 88 4b 4c 88 4c 06 88 4c 39 ae 04 87 7f 04 87 7f 04 87 7f 04 87 7f 04 87 7f 04 87 7f 04 87 7f 04 87 7f 04 87 7f 04 87 7f 04 87 7f 04 87 7f 04 87 7f 04 87 7f 04 87 7f 04 87 7f 04 87 7f 04 87 7f 04 87 30 1b 2c 6a
|
||||
|
||||
Reference in New Issue
Block a user