Commit 316ad18e by David Ellis

address comments, and sign off for DCO

Signed-off-by: 's avatarDavid Ellis <ellisda@gmail.com>
parent f478b5bb
......@@ -252,7 +252,7 @@ func lintUnitAbbreviations(mf dto.MetricFamily) []Problem {
n := strings.ToLower(mf.GetName())
for _, s := range unitAbbreviations {
if strings.Contains(n, "_"+s+"_") || strings.HasSuffix(n, "_"+s) {
problems.Add(mf, "metric names should not used abbreviated units")
problems.Add(mf, "metric names should not contain abbreviated units")
}
}
return problems
......@@ -322,6 +322,9 @@ var (
// Common abbreviations that we'd like to discourage.
unitAbbreviations = []string{
"s",
"ms",
"us",
"ns",
"sec",
"b",
"kb",
......
......@@ -532,7 +532,7 @@ func TestLintUnitAbbreviations(t *testing.T) {
problems: []promlint.Problem{
promlint.Problem{
Metric: n,
Text: "metric names should not used abbreviated units",
Text: "metric names should not contain abbreviated units",
},
},
}
......@@ -547,6 +547,9 @@ func TestLintUnitAbbreviations(t *testing.T) {
genTest("instance_memory_limit_pb"),
genTest("request_duration_s"),
genTest("request_duration_ms"),
genTest("request_duration_us"),
genTest("request_duration_ns"),
genTest("request_duration_sec"),
genTest("request_duration_sec_summary"),
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment