Skip to content

Commit ad42fa5

Browse files
committed
Return 0.0.1 with no version for backwards compatibility
Signed-off-by: Goutham Veeramachaneni <[email protected]>
1 parent 5012e7c commit ad42fa5

File tree

2 files changed

+4
-4
lines changed

2 files changed

+4
-4
lines changed

expfmt/encode.go

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -100,10 +100,10 @@ func NegotiateIncludingOpenMetrics(h http.Header) Format {
100100
return FmtText
101101
}
102102
if ac.Type+"/"+ac.SubType == OpenMetricsType && (ver == OpenMetricsVersion_0_0_1 || ver == OpenMetricsVersion_1_0_0 || ver == "") {
103-
if ver == OpenMetricsVersion_0_0_1 {
104-
return FmtOpenMetrics_0_0_1
103+
if ver == OpenMetricsVersion_1_0_0 {
104+
return FmtOpenMetrics_1_0_0
105105
}
106-
return FmtOpenMetrics_1_0_0
106+
return FmtOpenMetrics_0_0_1
107107
}
108108
}
109109
return FmtText

expfmt/encode_test.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,7 @@ func TestNegotiateOpenMetrics(t *testing.T) {
7272
{
7373
name: "OM format, no version",
7474
acceptHeaderValue: "application/openmetrics-text",
75-
expectedFmt: string(FmtOpenMetrics_1_0_0),
75+
expectedFmt: string(FmtOpenMetrics_0_0_1),
7676
},
7777
{
7878
name: "OM format, 0.0.1 version",

0 commit comments

Comments
 (0)