@@ -308,6 +308,29 @@ collected metric named "complex_count" collides with previously collected summar
308
308
309
309
collected metric named "complex_count" collides with previously collected histogram named "complex"
310
310
` )
311
+ externalMetricFamilyWithDuplicateLabel := & dto.MetricFamily {
312
+ Name : proto .String ("broken_metric" ),
313
+ Help : proto .String ("The registry should detect the duplicate label." ),
314
+ Type : dto .MetricType_COUNTER .Enum (),
315
+ Metric : []* dto.Metric {
316
+ {
317
+ Label : []* dto.LabelPair {
318
+ {
319
+ Name : proto .String ("foo" ),
320
+ Value : proto .String ("bar" ),
321
+ },
322
+ {
323
+ Name : proto .String ("foo" ),
324
+ Value : proto .String ("baz" ),
325
+ },
326
+ },
327
+ Counter : & dto.Counter {
328
+ Value : proto .Float64 (2.7 ),
329
+ },
330
+ },
331
+ },
332
+ }
333
+ duplicateLabelMsg := []byte (`duplicate label mumble mumble` )
311
334
312
335
type output struct {
313
336
headers map [string ]string
@@ -646,6 +669,20 @@ collected metric named "complex_count" collides with previously collected histog
646
669
externalMetricFamilyWithBucketSuffix ,
647
670
},
648
671
},
672
+ { // 22
673
+ headers : map [string ]string {
674
+ "Accept" : "text/plain" ,
675
+ },
676
+ out : output {
677
+ headers : map [string ]string {
678
+ "Content-Type" : `text/plain; version=0.0.4; charset=utf-8` ,
679
+ },
680
+ body : duplicateLabelMsg ,
681
+ },
682
+ externalMF : []* dto.MetricFamily {
683
+ externalMetricFamilyWithDuplicateLabel ,
684
+ },
685
+ },
649
686
}
650
687
for i , scenario := range scenarios {
651
688
registry := prometheus .NewPedanticRegistry ()
0 commit comments