@@ -71,7 +71,7 @@ type distributorTestCase struct {
7171func testDistributorWithCachingUnmarshalData (t * testing.T , cachingUnmarshalDataEnabled bool ) {
7272 queryEnd := time .Now ().Round (time .Second )
7373 queryStart := queryEnd .Add (- 1 * time .Hour )
74- queryStep := 10 * time .Minute
74+ queryStep := 5 * time .Minute
7575
7676 overridesWithExemplars := func (maxExemplars int ) string {
7777 return fmt .Sprintf ("overrides:\n \" %s\" :\n max_global_exemplars_per_user: %d\n " , userID , maxExemplars )
@@ -140,6 +140,55 @@ func testDistributorWithCachingUnmarshalData(t *testing.T, cachingUnmarshalDataE
140140 },
141141 },
142142
143+ "simple counter with created timestamp" : {
144+ rw1request : nil , // Not supported in RW1
145+ rw2request : []promRW2.Request {
146+ {
147+ Timeseries : []promRW2.TimeSeries {
148+ {
149+ LabelsRefs : []uint32 {0 , 1 },
150+ Samples : []promRW2.Sample {{Timestamp : queryStart .Add (1 * time .Second ).UnixMilli (), Value : 100 }},
151+ Metadata : promRW2.Metadata {
152+ Type : promRW2 .Metadata_METRIC_TYPE_COUNTER ,
153+ HelpRef : 2 ,
154+ UnitRef : 3 ,
155+ },
156+ CreatedTimestamp : queryStart .UnixMilli (),
157+ },
158+ },
159+ Symbols : []string {"__name__" , "foobarC_CT_total" , "some helpC_CT" , "someunitC_CT" },
160+ },
161+ },
162+ queries : map [string ]model.Matrix {
163+ "foobarC_CT_total" : {{
164+ Metric : model.Metric {"__name__" : "foobarC_CT_total" },
165+ Values : []model.SamplePair {
166+ {Timestamp : model .Time (queryStart .UnixMilli ()), Value : model .SampleValue (0 )},
167+ {Timestamp : model .Time (queryStart .Add (5 * time .Minute ).UnixMilli ()), Value : model .SampleValue (100 )},
168+ },
169+ }},
170+ },
171+ metadataQueries : map [string ]metadataResponse {
172+ "foobarC_CT_total" : {
173+ Status : "success" ,
174+ Data : map [string ][]metadataResponseItem {
175+ "foobarC_CT_total" : {{
176+ Type : "counter" ,
177+ Help : "some helpC_CT" ,
178+ Unit : "someunitC_CT" ,
179+ }},
180+ },
181+ },
182+ },
183+ expectedStats : []promRemote.WriteResponseStats {
184+ {
185+ Samples : 1 ,
186+ Histograms : 0 ,
187+ Exemplars : 0 ,
188+ },
189+ },
190+ },
191+
143192 "simple gauge" : {
144193 rw1request : []prompb.WriteRequest {
145194 {
0 commit comments