ToQuery builds a Query proto.
(from, to int64, matchers []*labels.Matcher, hints *storage.SelectHints)
| 102 | |
| 103 | // ToQuery builds a Query proto. |
| 104 | func ToQuery(from, to int64, matchers []*labels.Matcher, hints *storage.SelectHints) (*prompb.Query, error) { |
| 105 | ms, err := ToLabelMatchers(matchers) |
| 106 | if err != nil { |
| 107 | return nil, err |
| 108 | } |
| 109 | |
| 110 | var rp *prompb.ReadHints |
| 111 | if hints != nil { |
| 112 | rp = &prompb.ReadHints{ |
| 113 | StartMs: hints.Start, |
| 114 | EndMs: hints.End, |
| 115 | StepMs: hints.Step, |
| 116 | Func: hints.Func, |
| 117 | Grouping: hints.Grouping, |
| 118 | By: hints.By, |
| 119 | RangeMs: hints.Range, |
| 120 | } |
| 121 | } |
| 122 | |
| 123 | return &prompb.Query{ |
| 124 | StartTimestampMs: from, |
| 125 | EndTimestampMs: to, |
| 126 | Matchers: ms, |
| 127 | Hints: rp, |
| 128 | }, nil |
| 129 | } |
| 130 | |
| 131 | // ToQueryResult builds a QueryResult proto. |
| 132 | func ToQueryResult(ss storage.SeriesSet, sampleLimit int) (*prompb.QueryResult, annotations.Annotations, error) { |
searching dependent graphs…