Skip to content

Commit 3fc249a

Browse files
committed
Deprecate format strings
Add deprecation notice to format strings to allow transition to new functionality. Signed-off-by: SuperQ <superq@gmail.com>
1 parent bb1fa18 commit 3fc249a

File tree

1 file changed

+16
-8
lines changed

1 file changed

+16
-8
lines changed

expfmt/expfmt.go

Lines changed: 16 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -32,22 +32,30 @@ type Format string
3232
// it on the wire, new content-type strings will have to be agreed upon and
3333
// added here.
3434
const (
35-
TextVersion = "0.0.4"
36-
ProtoType = `application/vnd.google.protobuf`
37-
ProtoProtocol = `io.prometheus.client.MetricFamily`
35+
TextVersion = "0.0.4"
36+
ProtoType = `application/vnd.google.protobuf`
37+
ProtoProtocol = `io.prometheus.client.MetricFamily`
38+
// Deprecated: Use expfmt.NewFormat(expfmt.TypeProtoCompact) instead.
3839
ProtoFmt = ProtoType + "; proto=" + ProtoProtocol + ";"
3940
OpenMetricsType = `application/openmetrics-text`
4041
OpenMetricsVersion_0_0_1 = "0.0.1"
4142
OpenMetricsVersion_1_0_0 = "1.0.0"
4243

4344
// The Content-Type values for the different wire protocols. Do not do direct
4445
// comparisons to these constants, instead use the comparison functions.
45-
FmtUnknown Format = `<unknown>`
46-
FmtText Format = `text/plain; version=` + TextVersion + `; charset=utf-8`
47-
FmtProtoDelim Format = ProtoFmt + ` encoding=delimited`
48-
FmtProtoText Format = ProtoFmt + ` encoding=text`
49-
FmtProtoCompact Format = ProtoFmt + ` encoding=compact-text`
46+
// Deprecated: Use expfmt.NewFormat(expfmt.TypeUnknown) instead.
47+
FmtUnknown Format = `<unknown>`
48+
// Deprecated: Use expfmt.NewFormat(expfmt.TypeTextPlain) instead.
49+
FmtText Format = `text/plain; version=` + TextVersion + `; charset=utf-8`
50+
// Deprecated: Use expfmt.NewFormat(expfmt.TypeProtoDelim) instead.
51+
FmtProtoDelim Format = ProtoFmt + ` encoding=delimited`
52+
// Deprecated: Use expfmt.NewFormat(expfmt.TypeProtoText) instead.
53+
FmtProtoText Format = ProtoFmt + ` encoding=text`
54+
// Deprecated: Use expfmt.NewFormat(expfmt.TypeProtoCompact) instead.
55+
FmtProtoCompact Format = ProtoFmt + ` encoding=compact-text`
56+
// Deprecated: Use expfmt.NewFormat(expfmt.TypeOpenMetrics) instead.
5057
FmtOpenMetrics_1_0_0 Format = OpenMetricsType + `; version=` + OpenMetricsVersion_1_0_0 + `; charset=utf-8`
58+
// Deprecated: Use expfmt.NewFormat(expfmt.TypeOpenMetrics) instead.
5159
FmtOpenMetrics_0_0_1 Format = OpenMetricsType + `; version=` + OpenMetricsVersion_0_0_1 + `; charset=utf-8`
5260
)
5361

0 commit comments

Comments
 (0)