File tree 1 file changed +8
-2
lines changed 1 file changed +8
-2
lines changed Original file line number Diff line number Diff line change @@ -116,7 +116,13 @@ func NegotiateIncludingOpenMetrics(h http.Header) Format {
116
116
// for FmtOpenMetrics, but a future (breaking) release will add the Close method
117
117
// to the Encoder interface directly. The current version of the Encoder
118
118
// interface is kept for backwards compatibility.
119
- func NewEncoder (w io.Writer , format Format ) Encoder {
119
+ //
120
+ // NewEncoder can be called with additional options to customize the OpenMetrics text output.
121
+ // For example:
122
+ // NewEncoder(w, FmtOpenMetrics_1_0_0, WithCreatedLines())
123
+ //
124
+ // Extra options are ignored for all other formats.
125
+ func NewEncoder (w io.Writer , format Format , options ... ToOpenMetricsOption ) Encoder {
120
126
switch format {
121
127
case FmtProtoDelim :
122
128
return encoderCloser {
@@ -153,7 +159,7 @@ func NewEncoder(w io.Writer, format Format) Encoder {
153
159
case FmtOpenMetrics_0_0_1 , FmtOpenMetrics_1_0_0 :
154
160
return encoderCloser {
155
161
encode : func (v * dto.MetricFamily ) error {
156
- _ , err := MetricFamilyToOpenMetrics (w , v )
162
+ _ , err := MetricFamilyToOpenMetrics (w , v , options ... )
157
163
return err
158
164
},
159
165
close : func () error {
You can’t perform that action at this time.
0 commit comments