@@ -1414,6 +1414,46 @@ func TestQuerier_DetectedLabels(t *testing.T) {
1414
1414
assert .Len (t , detectedLabels , 0 )
1415
1415
})
1416
1416
1417
+ t .Run ("allows boolean values, even if numeric" , func (t * testing.T ) {
1418
+ ingesterResponse := logproto.LabelToValuesResponse {Labels : map [string ]* logproto.UniqueLabelValues {
1419
+ "boolean-ints" : {Values : []string {"0" , "1" }},
1420
+ "boolean-bools" : {Values : []string {"true" , "false" }},
1421
+ "boolean-bools-uppercase" : {Values : []string {"TRUE" , "FALSE" }},
1422
+ "single-id" : {Values : []string {"751e8ee6-b377-4b2e-b7b5-5508fbe980ef" }},
1423
+ "non-boolean-ints" : {Values : []string {"6" , "7" }},
1424
+ }}
1425
+
1426
+ ingesterClient := newQuerierClientMock ()
1427
+ storeClient := newStoreMock ()
1428
+
1429
+ ingesterClient .On ("GetDetectedLabels" , mock .Anything , mock .Anything , mock .Anything , mock .Anything , mock .Anything ).
1430
+ Return (& ingesterResponse , nil )
1431
+ storeClient .On ("LabelNamesForMetricName" , mock .Anything , mock .Anything , mock .Anything , mock .Anything , mock .Anything , mock .Anything ).
1432
+ Return ([]string {}, nil )
1433
+
1434
+ querier , err := newQuerier (
1435
+ conf ,
1436
+ mockIngesterClientConfig (),
1437
+ newIngesterClientMockFactory (ingesterClient ),
1438
+ mockReadRingWithOneActiveIngester (),
1439
+ & mockDeleteGettter {},
1440
+ storeClient , limits )
1441
+ require .NoError (t , err )
1442
+
1443
+ resp , err := querier .DetectedLabels (ctx , & request )
1444
+ require .NoError (t , err )
1445
+
1446
+ detectedLabels := resp .DetectedLabels
1447
+ assert .Len (t , detectedLabels , 3 )
1448
+
1449
+ foundLabels := make ([]string , 0 , len (detectedLabels ))
1450
+ for _ , d := range detectedLabels {
1451
+ foundLabels = append (foundLabels , d .Label )
1452
+ }
1453
+
1454
+ assert .ElementsMatch (t , []string {"boolean-ints" , "boolean-bools" , "boolean-bools-uppercase" }, foundLabels )
1455
+ })
1456
+
1417
1457
t .Run ("static labels are always returned no matter their cardinality or value types" , func (t * testing.T ) {
1418
1458
ingesterResponse := logproto.LabelToValuesResponse {Labels : map [string ]* logproto.UniqueLabelValues {
1419
1459
"cluster" : {Values : []string {"val1" }},
0 commit comments