MCPcopy Index your code
hub / github.com/prometheus/prometheus / ToQuery

Function ToQuery

storage/remote/codec.go:104–129  ·  view source on GitHub ↗

ToQuery builds a Query proto.

(from, to int64, matchers []*labels.Matcher, hints *storage.SelectHints)

Source from the content-addressed store, hash-verified

102
103// ToQuery builds a Query proto.
104func 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.
132func ToQueryResult(ss storage.SeriesSet, sampleLimit int) (*prompb.QueryResult, annotations.Annotations, error) {

Callers 5

TestSampledReadEndpointFunction · 0.85
TestStreamReadEndpointFunction · 0.85
SelectMethod · 0.85

Calls 1

ToLabelMatchersFunction · 0.85

Tested by 4

TestSampledReadEndpointFunction · 0.68
TestStreamReadEndpointFunction · 0.68

Used in the wild real call sites across dependent graphs

searching dependent graphs…