MCPcopy Create free account
hub / github.com/cortexproject/cortex / createWriteRequest

Function createWriteRequest

pkg/cortexpb/extensions_test.go:88–125  ·  view source on GitHub ↗
(numTs int, exemplar bool, family string, help string, unit string)

Source from the content-addressed store, hash-verified

86}
87
88func createWriteRequest(numTs int, exemplar bool, family string, help string, unit string) *WriteRequest {
89 w := &WriteRequest{}
90 w.Metadata = []*MetricMetadata{
91 {
92 MetricFamilyName: family,
93 Help: help,
94 Unit: unit,
95 },
96 }
97
98 for i := range numTs {
99 w.Timeseries = append(w.Timeseries, PreallocTimeseries{
100 TimeSeries: &TimeSeries{
101 Labels: []LabelAdapter{
102 {
103 Name: fmt.Sprintf("Name-%v", i),
104 Value: fmt.Sprintf("Value-%v", i),
105 },
106 },
107 },
108 })
109
110 if exemplar {
111 w.Timeseries[i].Exemplars = []Exemplar{
112 {
113 Labels: []LabelAdapter{
114 {
115 Name: fmt.Sprintf("Ex-Name-%v", i),
116 Value: fmt.Sprintf("Ex-Value-%v", i),
117 },
118 },
119 },
120 }
121 }
122 }
123
124 return w
125}

Callers 2

BenchmarkSignRequestFunction · 0.85
TestWriteRequest_SignFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected