Skip to content

Commit

Permalink
Add unit to expect field in proto format, correct typo
Browse files Browse the repository at this point in the history
Signed-off-by: Arianna Vespri <[email protected]>
  • Loading branch information
vesari committed Feb 13, 2024
1 parent c1c06ad commit 1755cb6
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 2 deletions.
2 changes: 1 addition & 1 deletion expfmt/openmetrics_create.go
Original file line number Diff line number Diff line change
Expand Up @@ -170,7 +170,7 @@ func MetricFamilyToOpenMetrics(out io.Writer, in *dto.MetricFamily, options ...T
if err != nil {
return
}
n, err = wwriteName(w, compliantName)
n, err = writeName(w, compliantName)
written += n
if err != nil {
return
Expand Down
1 change: 1 addition & 0 deletions model/metric.go
Original file line number Diff line number Diff line change
Expand Up @@ -204,6 +204,7 @@ func EscapeMetricFamily(v *dto.MetricFamily, scheme EscapingScheme) *dto.MetricF
out := &dto.MetricFamily{
Help: v.Help,
Type: v.Type,
Unit: v.Unit,
}

// If the name is nil, copy as-is, don't try to escape.
Expand Down
2 changes: 1 addition & 1 deletion model/metric_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -615,7 +615,7 @@ func TestProtoFormatUnchanged(t *testing.T) {
{
name: "MetricFamily",
input: &dto.MetricFamily{},
expectFields: []string{"name", "help", "type", "metric"},
expectFields: []string{"name", "help", "type", "metric", "unit"},
},
{
name: "Metric",
Expand Down

0 comments on commit 1755cb6

Please sign in to comment.