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