func activateEndpoints(endpoints []*scotty.Endpoint, s *store.Store) { aMetric := metrics.SimpleList{ { Path: "/foo/first", Description: "A description", }, { Path: "/foo/second", Description: "A description", }, { Path: "/foo/third", Description: "A description", }, { Path: "/foo/fourth", Description: "A description", }, } for i := range aMetric { aMetric[i].Value = int64(i) } for i := range endpoints { s.AddBatch(endpoints[i], 1.0, aMetric[:]) } }
func addValues( t *testing.T, aStore *store.Store, endpointId interface{}, path string, data ...float64) { if len(data)%2 != 0 { t.Fatal("Timestamp value pairs expected") } aMetric := metrics.SimpleList{ { Path: path, Description: "A description", }, } dataLen := len(data) for i := 0; i < dataLen; i += 2 { aMetric[0].TimeStamp = duration.FloatToTime(data[i]) aMetric[0].Value = data[i+1] if _, err := aStore.AddBatch(endpointId, 1000.0, aMetric); err != nil { t.Fatal(err) } } }