// QueryRangeUsingClient performs a range query within a window
QueryRangeUsingClient performs a range query within a window
// QueryRangeUsingClient performs a range query within a window
func (p *PrometheusClient) QueryRangeUsingClient(ctx context.Context, query string, startTime, endTime time.Time, step time.Duration) (promModel.Value, error) {
	c, _ := promAPI.NewClient(promAPI.Config{
		Address: p.promURL,
	})
	qc := promQAPI.NewAPI(c)
	result, _, err := qc.QueryRange(ctx, query, promQAPI.Range{
		Start: startTime,
		End:   endTime,
		Step:  step,
	})
	if err != nil {
		err := errors.Wrapf(err, "error fetching data for query: %s, with start: %v, end: %v, step: %v", query, startTime, endTime, step)
		logrus.Error(err)
		return nil, err
	}
	return result, nil
}
func ( p * PrometheusClient ) QueryRangeUsingClient ( ctx context . Context , query string , startTime , endTime time . Time , step time . Duration ) ( promModel . Value , error ) { c , _ := promAPI . NewClient ( promAPI . Config { Address : p . promURL , } ) qc := promQAPI . NewAPI ( c ) result , _ , err := qc . QueryRange ( ctx , query , promQAPI . Range { Start : startTime , End : endTime , Step : step , } ) if err != nil { err := errors . Wrapf ( err , " " , query , startTime , endTime , step ) logrus . Error ( err ) return nil , err } return result , nil }
QueryRangeUsingClient performs a range query within a window
QueryRangeUsingClient performs a range query within a window