You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
By upgrading prometheus/client_model, several test functions had to be re-written due to 2 breaking changes made in protobuf when parsing messages to text:
1. '<' and '>' characters were replaced with '{' and '}' respectively.
2. The text format is non-deterministic. More information in golang/protobuf#1121
Signed-off-by: Arthur Silva Sens <[email protected]>
Copy file name to clipboardExpand all lines: prometheus/example_metricvec_test.go
+2-4
Original file line number
Diff line number
Diff line change
@@ -14,8 +14,6 @@
14
14
package prometheus_test
15
15
16
16
import (
17
-
"fmt"
18
-
19
17
"google.golang.org/protobuf/proto"
20
18
21
19
dto "github.com/prometheus/client_model/go"
@@ -126,8 +124,8 @@ func ExampleMetricVec() {
126
124
iferr!=nil||len(metricFamilies) !=1 {
127
125
panic("unexpected behavior of custom test registry")
128
126
}
129
-
fmt.Println(metricFamilies[0].String())
127
+
printlnNormalized(metricFamilies[0])
130
128
131
129
// Output:
132
-
// name:"library_version_info"help:"Versions of the libraries used in this binary."type:GAUGEmetric:<label:<name:"library"value:"k8s.io/client-go" > label:<name:"version"value:"0.18.8" > gauge:<value:1 > > metric:<label:<name:"library"value:"prometheus/client_golang" > label:<name:"version"value:"1.7.1" > gauge:<value:1 > >
130
+
// {"name":"library_version_info","help":"Versions of the libraries used in this binary.","type":"GAUGE","metric":[{"label":[{"name":"library","value":"k8s.io/client-go"},{"name":"version","value":"0.18.8"}],"gauge":{"value":1}},{"label":[{"name":"library","value":"prometheus/client_golang"},{"name":"version","value":"1.7.1"}],"gauge":{"value":1}}]}
// {"name":"pond_temperature_celsius","help":"The temperature of the frog pond.","type":"SUMMARY","metric":[{"label":[{"name":"species","value":"leiopelma-hochstetteri"}],"summary":{"sampleCount":"0","sampleSum":0,"quantile":[{"quantile":0.5,"value":"NaN"},{"quantile":0.9,"value":"NaN"},{"quantile":0.99,"value":"NaN"}]}},{"label":[{"name":"species","value":"lithobates-catesbeianus"}],"summary":{"sampleCount":"1000","sampleSum":31956.100000000017,"quantile":[{"quantile":0.5,"value":32.4},{"quantile":0.9,"value":41.4},{"quantile":0.99,"value":41.9}]}},{"label":[{"name":"species","value":"litoria-caerulea"}],"summary":{"sampleCount":"1000","sampleSum":29969.50000000001,"quantile":[{"quantile":0.5,"value":31.1},{"quantile":0.9,"value":41.3},{"quantile":0.99,"value":41.9}]}}]}
// We expect error collected metric "temperature_kelvin" { label:<name:"location" value:"outside" > gauge:<value:265.3 > } was collected before with the same name and label values
572
+
// We cannot assert it because of https://github.com/golang/protobuf/issues/1121
// collected metric "temperature_kelvin" { label:<name:"location" value:"outside" > gauge:<value:265.3 > } was collected before with the same name and label values
0 commit comments