Skip to content

Commit 1755cb6

Browse files
committed
Add unit to expect field in proto format, correct typo
Signed-off-by: Arianna Vespri <[email protected]>
1 parent c1c06ad commit 1755cb6

File tree

3 files changed

+3
-2
lines changed

3 files changed

+3
-2
lines changed

expfmt/openmetrics_create.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -170,7 +170,7 @@ func MetricFamilyToOpenMetrics(out io.Writer, in *dto.MetricFamily, options ...T
170170
if err != nil {
171171
return
172172
}
173-
n, err = wwriteName(w, compliantName)
173+
n, err = writeName(w, compliantName)
174174
written += n
175175
if err != nil {
176176
return

model/metric.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -204,6 +204,7 @@ func EscapeMetricFamily(v *dto.MetricFamily, scheme EscapingScheme) *dto.MetricF
204204
out := &dto.MetricFamily{
205205
Help: v.Help,
206206
Type: v.Type,
207+
Unit: v.Unit,
207208
}
208209

209210
// If the name is nil, copy as-is, don't try to escape.

model/metric_test.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -615,7 +615,7 @@ func TestProtoFormatUnchanged(t *testing.T) {
615615
{
616616
name: "MetricFamily",
617617
input: &dto.MetricFamily{},
618-
expectFields: []string{"name", "help", "type", "metric"},
618+
expectFields: []string{"name", "help", "type", "metric", "unit"},
619619
},
620620
{
621621
name: "Metric",

0 commit comments

Comments
 (0)