Skip to content

Commit

Permalink
feat: address review comments
Browse files Browse the repository at this point in the history
  • Loading branch information
rahulguptajss committed Jun 26, 2023
1 parent 367f489 commit 139bfaf
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 6 deletions.
5 changes: 3 additions & 2 deletions cmd/tools/grafana/dashboard_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ var aggregationPattern = regexp.MustCompile(`\b(sum|count|min|max)\b`)
func checkThreshold(t *testing.T, path string, data []byte) {
path = shortPath(path)
var thresholdMap = map[string][]string{
// _latency are in microseconds
"_latency": {
"[\"green\",\"orange\",\"red\"]",
"[null,20000,30000]",
Expand Down Expand Up @@ -235,8 +236,8 @@ func TestUnitsAndExprMatch(t *testing.T) {
}

for _, l := range location {
match := reg.FindString(l.expr)
if match != "" {
matchString := reg.FindString(l.expr)
if matchString != "" {
if expectedGrafanaUnit == unit {
t.Errorf(`%s should not have unit=%s because there is a division by a number %s path=%s title="%s"`,
metric, unit, l.dashboard, l.path, l.title)
Expand Down
6 changes: 2 additions & 4 deletions cmd/tools/grafana/unit.go
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ func parseUnits() map[string]Metric {
"svm_nfs_throughput": {},
"svm_nfs_write_throughput": {},
}
filePath := "units.yaml" // Replace with the actual file path
filePath := "units.yaml"

// Read the YAML file
yamlData, err := os.ReadFile(filePath)
Expand All @@ -48,9 +48,7 @@ func parseUnits() map[string]Metric {

// Populate the map using the metric name as the key
for _, metric := range metrics {
if _, ok := excludeValidationMap[metric.Metric]; ok {
metric.skipValidate = true
}
_, metric.skipValidate = excludeValidationMap[metric.Metric]
metricsMap[metric.Metric] = metric
}
return metricsMap
Expand Down

0 comments on commit 139bfaf

Please sign in to comment.