@@ -694,6 +694,55 @@ request_duration_microseconds_count 2693
694
694
options : []EncoderOption {WithUnit ()},
695
695
out : `# HELP name doc string
696
696
# TYPE name counter
697
+ ` ,
698
+ },
699
+ // 18: Counter, timestamp given, unit opted in, _total suffix.
700
+ {
701
+ in : & dto.MetricFamily {
702
+ Name : proto .String ("some_measure_total" ),
703
+ Help : proto .String ("some testing measurement" ),
704
+ Type : dto .MetricType_COUNTER .Enum (),
705
+ Unit : proto .String ("seconds" ),
706
+ Metric : []* dto.Metric {
707
+ {
708
+ Label : []* dto.LabelPair {
709
+ {
710
+ Name : proto .String ("labelname" ),
711
+ Value : proto .String ("val1" ),
712
+ },
713
+ {
714
+ Name : proto .String ("basename" ),
715
+ Value : proto .String ("basevalue" ),
716
+ },
717
+ },
718
+ Counter : & dto.Counter {
719
+ Value : proto .Float64 (42 ),
720
+ },
721
+ },
722
+ {
723
+ Label : []* dto.LabelPair {
724
+ {
725
+ Name : proto .String ("labelname" ),
726
+ Value : proto .String ("val2" ),
727
+ },
728
+ {
729
+ Name : proto .String ("basename" ),
730
+ Value : proto .String ("basevalue" ),
731
+ },
732
+ },
733
+ Counter : & dto.Counter {
734
+ Value : proto .Float64 (.23 ),
735
+ },
736
+ TimestampMs : proto .Int64 (1234567890 ),
737
+ },
738
+ },
739
+ },
740
+ options : []EncoderOption {WithUnit ()},
741
+ out : `# HELP some_measure_seconds some testing measurement
742
+ # TYPE some_measure_seconds counter
743
+ # UNIT some_measure_seconds seconds
744
+ some_measure_seconds_total{labelname="val1",basename="basevalue"} 42.0
745
+ some_measure_seconds_total{labelname="val2",basename="basevalue"} 0.23 1.23456789e+06
697
746
` ,
698
747
},
699
748
}
0 commit comments