@@ -41,6 +41,7 @@ import (
4141type sample struct {
4242 t int64
4343 v float64
44+ h * histogram.Histogram
4445}
4546
4647func TestQueryableCreator_MaxResolution (t * testing.T ) {
@@ -74,12 +75,12 @@ func TestQueryableCreator_MaxResolution(t *testing.T) {
7475func TestQuerier_DownsampledData (t * testing.T ) {
7576 testProxy := & testStoreServer {
7677 resps : []* storepb.SeriesResponse {
77- storeSeriesResponse (t , labels .FromStrings ("__name__" , "a" , "zzz" , "a" , "aaa" , "bbb" ), []sample {{99 , 1 }, {199 , 5 }}), // Downsampled chunk from Store.
78- storeSeriesResponse (t , labels .FromStrings ("__name__" , "a" , "zzz" , "b" , "bbbb" , "eee" ), []sample {{99 , 3 }, {199 , 8 }}), // Downsampled chunk from Store.
79- storeSeriesResponse (t , labels .FromStrings ("__name__" , "a" , "zzz" , "c" , "qwe" , "wqeqw" ), []sample {{99 , 5 }, {199 , 15 }}), // Downsampled chunk from Store.
80- storeSeriesResponse (t , labels .FromStrings ("__name__" , "a" , "zzz" , "c" , "htgtreytr" , "vbnbv" ), []sample {{99 , 123 }, {199 , 15 }}), // Downsampled chunk from Store.
81- storeSeriesResponse (t , labels .FromStrings ("__name__" , "a" , "zzz" , "d" , "asdsad" , "qweqwewq" ), []sample {{22 , 5 }, {44 , 8 }, {199 , 15 }}), // Raw chunk from Sidecar.
82- storeSeriesResponse (t , labels .FromStrings ("__name__" , "a" , "zzz" , "d" , "asdsad" , "qweqwebb" ), []sample {{22 , 5 }, {44 , 8 }, {199 , 15 }}), // Raw chunk from Sidecar.
78+ storeSeriesResponse (t , labels .FromStrings ("__name__" , "a" , "zzz" , "a" , "aaa" , "bbb" ), []sample {{t : 99 , v : 1 }, {t : 199 , v : 5 }}), // Downsampled chunk from Store.
79+ storeSeriesResponse (t , labels .FromStrings ("__name__" , "a" , "zzz" , "b" , "bbbb" , "eee" ), []sample {{t : 99 , v : 3 }, {t : 199 , v : 8 }}), // Downsampled chunk from Store.
80+ storeSeriesResponse (t , labels .FromStrings ("__name__" , "a" , "zzz" , "c" , "qwe" , "wqeqw" ), []sample {{t : 99 , v : 5 }, {t : 199 , v : 15 }}), // Downsampled chunk from Store.
81+ storeSeriesResponse (t , labels .FromStrings ("__name__" , "a" , "zzz" , "c" , "htgtreytr" , "vbnbv" ), []sample {{t : 99 , v : 123 }, {t : 199 , v : 15 }}), // Downsampled chunk from Store.
82+ storeSeriesResponse (t , labels .FromStrings ("__name__" , "a" , "zzz" , "d" , "asdsad" , "qweqwewq" ), []sample {{t : 22 , v : 5 }, {t : 44 , v : 8 }, {t : 199 , v : 15 }}), // Raw chunk from Sidecar.
83+ storeSeriesResponse (t , labels .FromStrings ("__name__" , "a" , "zzz" , "d" , "asdsad" , "qweqwebb" ), []sample {{t : 22 , v : 5 }, {t : 44 , v : 8 }, {t : 199 , v : 15 }}), // Raw chunk from Sidecar.
8384 },
8485 }
8586
@@ -444,12 +445,12 @@ func TestQuerier_Select(t *testing.T) {
444445 storeEndpoints : []storepb.StoreServer {
445446 & testStoreServer {
446447 resps : []* storepb.SeriesResponse {
447- storeSeriesResponse (t , labels .FromStrings ("a" , "a" ), []sample {{0 , 0 }, {2 , 1 }, {3 , 2 }}),
448+ storeSeriesResponse (t , labels .FromStrings ("a" , "a" ), []sample {{t : 0 , v : 0 }, {t : 2 , v : 1 }, {t : 3 , v : 2 }}),
448449 storepb .NewWarnSeriesResponse (errors .New ("partial error" )),
449- storeSeriesResponse (t , labels .FromStrings ("a" , "a" ), []sample {{5 , 5 }, {6 , 6 }, {7 , 7 }}),
450- storeSeriesResponse (t , labels .FromStrings ("a" , "a" ), []sample {{5 , 5 }, {6 , 66 }}),
451- storeSeriesResponse (t , labels .FromStrings ("a" , "b" ), []sample {{2 , 2 }, {3 , 3 }, {4 , 4 }}, []sample {{1 , 1 }, {2 , 2 }, {3 , 3 }}),
452- storeSeriesResponse (t , labels .FromStrings ("a" , "c" ), []sample {{100 , 1 }, {300 , 3 }, {400 , 4 }}),
450+ storeSeriesResponse (t , labels .FromStrings ("a" , "a" ), []sample {{t : 5 , v : 5 }, {t : 6 , v : 6 }, {t : 7 , v : 7 }}),
451+ storeSeriesResponse (t , labels .FromStrings ("a" , "a" ), []sample {{t : 5 , v : 5 }, {t : 6 , v : 66 }}),
452+ storeSeriesResponse (t , labels .FromStrings ("a" , "b" ), []sample {{t : 2 , v : 2 }, {t : 3 , v : 3 }, {t : 4 , v : 4 }}, []sample {{t : 1 , v : 1 }, {t : 2 , v : 2 }, {t : 3 , v : 3 }}),
453+ storeSeriesResponse (t , labels .FromStrings ("a" , "c" ), []sample {{t : 100 , v : 1 }, {t : 300 , v : 3 }, {t : 400 , v : 4 }}),
453454 },
454455 },
455456 },
@@ -464,21 +465,21 @@ func TestQuerier_Select(t *testing.T) {
464465 expected : []series {
465466 {
466467 lset : labels .FromStrings ("a" , "a" ),
467- samples : []sample {{2 , 1 }, {3 , 2 }, {5 , 5 }, {6 , 66 }, {7 , 7 }},
468+ samples : []sample {{t : 2 , v : 1 }, {t : 3 , v : 2 }, {t : 5 , v : 5 }, {t : 6 , v : 66 }, {t : 7 , v : 7 }},
468469 },
469470 {
470471 lset : labels .FromStrings ("a" , "b" ),
471- samples : []sample {{1 , 1 }, {2 , 2 }, {3 , 3 }, {4 , 4 }},
472+ samples : []sample {{t : 1 , v : 1 }, {t : 2 , v : 2 }, {t : 3 , v : 3 }, {t : 4 , v : 4 }},
472473 },
473474 {
474475 lset : labels .FromStrings ("a" , "c" ),
475- samples : []sample {{100 , 1 }, {300 , 3 }},
476+ samples : []sample {{t : 100 , v : 1 }, {t : 300 , v : 3 }},
476477 },
477478 },
478479 expectedAfterDedup : []series {{
479480 lset : nil ,
480481 // We don't expect correctness here, it's just random non-replica data.
481- samples : []sample {{1 , 1 }, {2 , 2 }, {3 , 3 }, {5 , 5 }, {6 , 6 }, {7 , 7 }},
482+ samples : []sample {{t : 1 , v : 1 }, {t : 2 , v : 2 }, {t : 3 , v : 3 }, {t : 5 , v : 5 }, {t : 6 , v : 6 }, {t : 7 , v : 7 }},
482483 }},
483484 expectedWarning : "partial error" ,
484485 },
@@ -632,18 +633,18 @@ func TestQuerier_Select(t *testing.T) {
632633 storeEndpoints : []storepb.StoreServer {
633634 & testStoreServer {
634635 resps : []* storepb.SeriesResponse {
635- storeSeriesResponse (t , labels .FromStrings ("a" , "1" , "r" , "1" , "w" , "1" ), []sample {{0 , 0 }, {2 , 1 }, {3 , 2 }}),
636- storeSeriesResponse (t , labels .FromStrings ("a" , "1" , "r" , "1" , "w" , "1" ), []sample {{5 , 5 }, {6 , 6 }, {7 , 7 }}),
637- storeSeriesResponse (t , labels .FromStrings ("a" , "1" , "r" , "1" , "x" , "1" ), []sample {{2 , 2 }, {3 , 3 }, {4 , 4 }}, []sample {{1 , 1 }, {2 , 2 }, {3 , 3 }}),
638- storeSeriesResponse (t , labels .FromStrings ("a" , "1" , "r" , "1" , "x" , "1" ), []sample {{100 , 1 }, {300 , 3 }, {400 , 4 }}),
639- storeSeriesResponse (t , labels .FromStrings ("a" , "1" , "r" , "2" , "w" , "1" ), []sample {{5 , 5 }, {7 , 7 }}),
636+ storeSeriesResponse (t , labels .FromStrings ("a" , "1" , "r" , "1" , "w" , "1" ), []sample {{t : 0 , v : 0 }, {t : 2 , v : 1 }, {t : 3 , v : 2 }}),
637+ storeSeriesResponse (t , labels .FromStrings ("a" , "1" , "r" , "1" , "w" , "1" ), []sample {{t : 5 , v : 5 }, {t : 6 , v : 6 }, {t : 7 , v : 7 }}),
638+ storeSeriesResponse (t , labels .FromStrings ("a" , "1" , "r" , "1" , "x" , "1" ), []sample {{t : 2 , v : 2 }, {t : 3 , v : 3 }, {t : 4 , v : 4 }}, []sample {{t : 1 , v : 1 }, {t : 2 , v : 2 }, {t : 3 , v : 3 }}),
639+ storeSeriesResponse (t , labels .FromStrings ("a" , "1" , "r" , "1" , "x" , "1" ), []sample {{t : 100 , v : 1 }, {t : 300 , v : 3 }, {t : 400 , v : 4 }}),
640+ storeSeriesResponse (t , labels .FromStrings ("a" , "1" , "r" , "2" , "w" , "1" ), []sample {{t : 5 , v : 5 }, {t : 7 , v : 7 }}),
640641 },
641642 },
642643 & testStoreServer {
643644 resps : []* storepb.SeriesResponse {
644- storeSeriesResponse (t , labels .FromStrings ("a" , "1" , "r" , "2" , "w" , "1" ), []sample {{2 , 1 }}),
645- storeSeriesResponse (t , labels .FromStrings ("a" , "1" , "r" , "2" , "w" , "1" ), []sample {{5 , 5 }, {6 , 6 }, {7 , 7 }}),
646- storeSeriesResponse (t , labels .FromStrings ("a" , "1" , "r" , "2" , "x" , "2" ), []sample {{10 , 10 }, {30 , 30 }, {40 , 40 }}),
645+ storeSeriesResponse (t , labels .FromStrings ("a" , "1" , "r" , "2" , "w" , "1" ), []sample {{t : 2 , v : 1 }}),
646+ storeSeriesResponse (t , labels .FromStrings ("a" , "1" , "r" , "2" , "w" , "1" ), []sample {{t : 5 , v : 5 }, {t : 6 , v : 6 }, {t : 7 , v : 7 }}),
647+ storeSeriesResponse (t , labels .FromStrings ("a" , "1" , "r" , "2" , "x" , "2" ), []sample {{t : 10 , v : 10 }, {t : 30 , v : 30 }, {t : 40 , v : 40 }}),
647648 },
648649 },
649650 },
@@ -654,36 +655,36 @@ func TestQuerier_Select(t *testing.T) {
654655 expected : []series {
655656 {
656657 lset : labels .FromStrings ("a" , "1" , "r" , "1" , "w" , "1" ),
657- samples : []sample {{2 , 1 }, {3 , 2 }, {5 , 5 }, {6 , 6 }, {7 , 7 }},
658+ samples : []sample {{t : 2 , v : 1 }, {t : 3 , v : 2 }, {t : 5 , v : 5 }, {t : 6 , v : 6 }, {t : 7 , v : 7 }},
658659 },
659660 {
660661 lset : labels .FromStrings ("a" , "1" , "r" , "1" , "x" , "1" ),
661- samples : []sample {{1 , 1 }, {2 , 2 }, {3 , 3 }, {4 , 4 }, {100 , 1 }, {300 , 3 }},
662+ samples : []sample {{t : 1 , v : 1 }, {t : 2 , v : 2 }, {t : 3 , v : 3 }, {t : 4 , v : 4 }, {t : 100 , v : 1 }, {t : 300 , v : 3 }},
662663 },
663664 {
664665 lset : labels .FromStrings ("a" , "1" , "r" , "2" , "w" , "1" ),
665- samples : []sample {{2 , 1 }, {5 , 5 }, {6 , 6 }, {7 , 7 }},
666+ samples : []sample {{t : 2 , v : 1 }, {t : 5 , v : 5 }, {t : 6 , v : 6 }, {t : 7 , v : 7 }},
666667 },
667668 {
668669 lset : labels .FromStrings ("a" , "1" , "r" , "2" , "x" , "2" ),
669- samples : []sample {{10 , 10 }, {30 , 30 }, {40 , 40 }},
670+ samples : []sample {{t : 10 , v : 10 }, {t : 30 , v : 30 }, {t : 40 , v : 40 }},
670671 },
671672 },
672673 expectedAfterDedup : []series {
673674 {
674675 lset : labels .FromStrings ("a" , "1" , "w" , "1" ),
675676 // We don't expect correctness here, it's just random non-replica data.
676- samples : []sample {{2 , 1 }, {3 , 2 }, {5 , 5 }, {6 , 6 }, {7 , 7 }},
677+ samples : []sample {{t : 2 , v : 1 }, {t : 3 , v : 2 }, {t : 5 , v : 5 }, {t : 6 , v : 6 }, {t : 7 , v : 7 }},
677678 },
678679 {
679680 lset : labels .FromStrings ("a" , "1" , "x" , "1" ),
680681 // We don't expect correctness here, it's just random non-replica data.
681- samples : []sample {{1 , 1 }, {2 , 2 }, {3 , 3 }, {100 , 1 }, {300 , 3 }},
682+ samples : []sample {{t : 1 , v : 1 }, {t : 2 , v : 2 }, {t : 3 , v : 3 }, {t : 100 , v : 1 }, {t : 300 , v : 3 }},
682683 },
683684 {
684685 lset : labels .FromStrings ("a" , "1" , "x" , "2" ),
685686 // We don't expect correctness here, it's just random non-replica data.
686- samples : []sample {{10 , 10 }, {30 , 30 }, {40 , 40 }},
687+ samples : []sample {{t : 10 , v : 10 }, {t : 30 , v : 30 }, {t : 40 , v : 40 }},
687688 },
688689 },
689690 },
@@ -692,25 +693,25 @@ func TestQuerier_Select(t *testing.T) {
692693 storeEndpoints : []storepb.StoreServer {
693694 & testStoreServer {
694695 resps : []* storepb.SeriesResponse {
695- storeSeriesResponse (t , labels .FromStrings ("a" , "1" , "r" , "1" , "w" , "1" ), []sample {{0 , 0 }, {2 , 1 }, {3 , 2 }}),
696- storeSeriesResponse (t , labels .FromStrings ("a" , "1" , "r" , "1" , "w" , "1" ), []sample {{5 , 5 }, {6 , 6 }, {7 , 7 }}),
697- storeSeriesResponse (t , labels .FromStrings ("a" , "1" , "r" , "1" , "x" , "1" ), []sample {{2 , 2 }, {3 , 3 }, {4 , 4 }}, []sample {{1 , 1 }, {2 , 2 }, {3 , 3 }}),
698- storeSeriesResponse (t , labels .FromStrings ("a" , "1" , "r" , "1" , "x" , "1" ), []sample {{100 , 1 }, {300 , 3 }, {400 , 4 }}),
699- storeSeriesResponse (t , labels .FromStrings ("a" , "1" , "r" , "2" , "w" , "1" ), []sample {{5 , 5 }, {7 , 7 }}),
696+ storeSeriesResponse (t , labels .FromStrings ("a" , "1" , "r" , "1" , "w" , "1" ), []sample {{t : 0 , v : 0 }, {t : 2 , v : 1 }, {t : 3 , v : 2 }}),
697+ storeSeriesResponse (t , labels .FromStrings ("a" , "1" , "r" , "1" , "w" , "1" ), []sample {{t : 5 , v : 5 }, {t : 6 , v : 6 }, {t : 7 , v : 7 }}),
698+ storeSeriesResponse (t , labels .FromStrings ("a" , "1" , "r" , "1" , "x" , "1" ), []sample {{t : 2 , v : 2 }, {t : 3 , v : 3 }, {t : 4 , v : 4 }}, []sample {{t : 1 , v : 1 }, {t : 2 , v : 2 }, {t : 3 , v : 3 }}),
699+ storeSeriesResponse (t , labels .FromStrings ("a" , "1" , "r" , "1" , "x" , "1" ), []sample {{t : 100 , v : 1 }, {t : 300 , v : 3 }, {t : 400 , v : 4 }}),
700+ storeSeriesResponse (t , labels .FromStrings ("a" , "1" , "r" , "2" , "w" , "1" ), []sample {{t : 5 , v : 5 }, {t : 7 , v : 7 }}),
700701 },
701702 respsWithoutReplicaLabels : []* storepb.SeriesResponse {
702- storeSeriesResponse (t , labels .FromStrings ("a" , "1" , "w" , "1" ), []sample {{5 , 5 }, {7 , 7 }}),
703- storeSeriesResponse (t , labels .FromStrings ("a" , "1" , "w" , "1" ), []sample {{0 , 0 }, {2 , 1 }, {3 , 2 }}),
704- storeSeriesResponse (t , labels .FromStrings ("a" , "1" , "w" , "1" ), []sample {{5 , 5 }, {6 , 6 }, {7 , 7 }}),
705- storeSeriesResponse (t , labels .FromStrings ("a" , "1" , "x" , "1" ), []sample {{2 , 2 }, {3 , 3 }, {4 , 4 }}, []sample {{1 , 1 }, {2 , 2 }, {3 , 3 }}),
706- storeSeriesResponse (t , labels .FromStrings ("a" , "1" , "x" , "1" ), []sample {{100 , 1 }, {300 , 3 }, {400 , 4 }}),
703+ storeSeriesResponse (t , labels .FromStrings ("a" , "1" , "w" , "1" ), []sample {{t : 5 , v : 5 }, {t : 7 , v : 7 }}),
704+ storeSeriesResponse (t , labels .FromStrings ("a" , "1" , "w" , "1" ), []sample {{t : 0 , v : 0 }, {t : 2 , v : 1 }, {t : 3 , v : 2 }}),
705+ storeSeriesResponse (t , labels .FromStrings ("a" , "1" , "w" , "1" ), []sample {{t : 5 , v : 5 }, {t : 6 , v : 6 }, {t : 7 , v : 7 }}),
706+ storeSeriesResponse (t , labels .FromStrings ("a" , "1" , "x" , "1" ), []sample {{t : 2 , v : 2 }, {t : 3 , v : 3 }, {t : 4 , v : 4 }}, []sample {{t : 1 , v : 1 }, {t : 2 , v : 2 }, {t : 3 , v : 3 }}),
707+ storeSeriesResponse (t , labels .FromStrings ("a" , "1" , "x" , "1" ), []sample {{t : 100 , v : 1 }, {t : 300 , v : 3 }, {t : 400 , v : 4 }}),
707708 },
708709 },
709710 & testStoreServer {
710711 resps : []* storepb.SeriesResponse {
711- storeSeriesResponse (t , labels .FromStrings ("a" , "1" , "r" , "2" , "w" , "1" ), []sample {{2 , 1 }}),
712- storeSeriesResponse (t , labels .FromStrings ("a" , "1" , "r" , "2" , "w" , "1" ), []sample {{5 , 5 }, {6 , 6 }, {7 , 7 }}),
713- storeSeriesResponse (t , labels .FromStrings ("a" , "1" , "r" , "2" , "x" , "2" ), []sample {{10 , 10 }, {30 , 30 }, {40 , 40 }}),
712+ storeSeriesResponse (t , labels .FromStrings ("a" , "1" , "r" , "2" , "w" , "1" ), []sample {{t : 2 , v : 1 }}),
713+ storeSeriesResponse (t , labels .FromStrings ("a" , "1" , "r" , "2" , "w" , "1" ), []sample {{t : 5 , v : 5 }, {t : 6 , v : 6 }, {t : 7 , v : 7 }}),
714+ storeSeriesResponse (t , labels .FromStrings ("a" , "1" , "r" , "2" , "x" , "2" ), []sample {{t : 10 , v : 10 }, {t : 30 , v : 30 }, {t : 40 , v : 40 }}),
714715 },
715716 },
716717 },
@@ -721,36 +722,36 @@ func TestQuerier_Select(t *testing.T) {
721722 expected : []series {
722723 {
723724 lset : labels .FromStrings ("a" , "1" , "r" , "1" , "w" , "1" ),
724- samples : []sample {{2 , 1 }, {3 , 2 }, {5 , 5 }, {6 , 6 }, {7 , 7 }},
725+ samples : []sample {{t : 2 , v : 1 }, {t : 3 , v : 2 }, {t : 5 , v : 5 }, {t : 6 , v : 6 }, {t : 7 , v : 7 }},
725726 },
726727 {
727728 lset : labels .FromStrings ("a" , "1" , "r" , "1" , "x" , "1" ),
728- samples : []sample {{1 , 1 }, {2 , 2 }, {3 , 3 }, {4 , 4 }, {100 , 1 }, {300 , 3 }},
729+ samples : []sample {{t : 1 , v : 1 }, {t : 2 , v : 2 }, {t : 3 , v : 3 }, {t : 4 , v : 4 }, {t : 100 , v : 1 }, {t : 300 , v : 3 }},
729730 },
730731 {
731732 lset : labels .FromStrings ("a" , "1" , "r" , "2" , "w" , "1" ),
732- samples : []sample {{2 , 1 }, {5 , 5 }, {6 , 6 }, {7 , 7 }},
733+ samples : []sample {{t : 2 , v : 1 }, {t : 5 , v : 5 }, {t : 6 , v : 6 }, {t : 7 , v : 7 }},
733734 },
734735 {
735736 lset : labels .FromStrings ("a" , "1" , "r" , "2" , "x" , "2" ),
736- samples : []sample {{10 , 10 }, {30 , 30 }, {40 , 40 }},
737+ samples : []sample {{t : 10 , v : 10 }, {t : 30 , v : 30 }, {t : 40 , v : 40 }},
737738 },
738739 },
739740 expectedAfterDedup : []series {
740741 {
741742 lset : labels .FromStrings ("a" , "1" , "w" , "1" ),
742743 // We don't expect correctness here, it's just random non-replica data.
743- samples : []sample {{2 , 1 }, {3 , 2 }, {5 , 5 }, {6 , 6 }, {7 , 7 }},
744+ samples : []sample {{t : 2 , v : 1 }, {t : 3 , v : 2 }, {t : 5 , v : 5 }, {t : 6 , v : 6 }, {t : 7 , v : 7 }},
744745 },
745746 {
746747 lset : labels .FromStrings ("a" , "1" , "x" , "1" ),
747748 // We don't expect correctness here, it's just random non-replica data.
748- samples : []sample {{1 , 1 }, {2 , 2 }, {3 , 3 }, {100 , 1 }, {300 , 3 }},
749+ samples : []sample {{t : 1 , v : 1 }, {t : 2 , v : 2 }, {t : 3 , v : 3 }, {t : 100 , v : 1 }, {t : 300 , v : 3 }},
749750 },
750751 {
751752 lset : labels .FromStrings ("a" , "1" , "x" , "2" ),
752753 // We don't expect correctness here, it's just random non-replica data.
753- samples : []sample {{10 , 10 }, {30 , 30 }, {40 , 40 }},
754+ samples : []sample {{t : 10 , v : 10 }, {t : 30 , v : 30 }, {t : 40 , v : 40 }},
754755 },
755756 },
756757 },
@@ -1211,7 +1212,7 @@ func expandSeries(t testing.TB, it chunkenc.Iterator) (res []sample) {
12111212 if math .IsNaN (v ) {
12121213 v = hackyStaleMarker
12131214 }
1214- res = append (res , sample {t , v })
1215+ res = append (res , sample {t : t , v : v })
12151216 }
12161217 testutil .Ok (t , it .Err ())
12171218 return res
0 commit comments