Пример #1
0
func (b *Blueflood) FetchMultipleTimeseries(request api.FetchMultipleTimeseriesRequest) (api.SeriesList, error) {
	defer request.Profiler.Record("Blueflood FetchMultipleTimeseries")()
	if request.Cancellable == nil {
		panic("The cancellable component of a FetchMultipleTimeseriesRequest cannot be nil")
	}
	works := make([]func() (api.Timeseries, error), len(request.Metrics))

	singleRequests := request.ToSingle()
	for i := range singleRequests {
		//Make sure we close around the specific individual request
		//and not the ranged/copied request.
		singleRequest := singleRequests[i]
		works[i] = func() (api.Timeseries, error) {
			return b.FetchSingleTimeseries(singleRequest)
		}
	}

	resultSeries, err := b.fetchManyLazy(request.Cancellable, works)
	if err != nil {
		return api.SeriesList{}, err
	}

	return api.SeriesList{
		Series:    resultSeries,
		Timerange: request.Timerange,
	}, nil
}
Пример #2
0
func (b movingAverageBackend) FetchMultipleTimeseries(r api.FetchMultipleTimeseriesRequest) (api.SeriesList, error) {
	timeseries := make([]api.Timeseries, 0)
	singleRequests := r.ToSingle()
	for _, request := range singleRequests {
		series, _ := b.FetchSingleTimeseries(request)
		timeseries = append(timeseries, series)
	}
	return api.SeriesList{
		Series: timeseries,
	}, nil
}
Пример #3
0
func (f FakeTimeseriesStorageAPI) FetchMultipleTimeseries(request api.FetchMultipleTimeseriesRequest) (api.SeriesList, error) {
	defer request.Profiler.Record("Mock FetchMultipleTimeseries")()
	timeseries := make([]api.Timeseries, 0)

	singleRequests := request.ToSingle()
	for _, singleRequest := range singleRequests {
		series, err := f.FetchSingleTimeseries(singleRequest)
		if err != nil {
			continue
		}
		timeseries = append(timeseries, series)
	}

	return api.SeriesList{
		Series:    timeseries,
		Timerange: request.Timerange,
	}, nil
}