Skip to content

Commit

Permalink
Fix metrics
Browse files Browse the repository at this point in the history
  • Loading branch information
prymitive committed Jul 28, 2022
1 parent ef1e921 commit 6dfc349
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 2 deletions.
6 changes: 4 additions & 2 deletions cmd/pint/scan.go
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ func tryDecodingYamlError(err error) (l int, s string) {
}

func checkRules(ctx context.Context, workers int, cfg config.Config, entries []discovery.Entry) (summary reporter.Summary) {
checkIterationChecks.Set(float64(len(entries)))
checkIterationChecks.Set(0)
checkIterationChecksDone.Set(0)

start := time.Now()
Expand Down Expand Up @@ -107,14 +107,14 @@ func checkRules(ctx context.Context, workers int, cfg config.Config, entries []d

checkList := cfg.GetChecksForRule(ctx, entry.Path, entry.Rule)
for _, check := range checkList {
checkIterationChecks.Inc()
check := check
if check.Meta().IsOnline {
onlineChecksCount.Inc()
} else {
offlineChecksCount.Inc()
}
jobs <- scanJob{entry: entry, allEntries: entries, check: check}
checkIterationChecksDone.Inc()
}
default:
if entry.Rule.Error.Err != nil {
Expand Down Expand Up @@ -201,6 +201,8 @@ func scanWorker(ctx context.Context, jobs <-chan scanJob, results chan<- reporte
}
}
}

checkIterationChecksDone.Inc()
}
}

Expand Down
4 changes: 4 additions & 0 deletions docs/changelog.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,10 @@
will be needed for storing results of given query.
`bytesPerSample` option that was previously used to calculate this was removed.

### Fixed

- `pint_last_run_checks` and `pint_last_run_checks_done` were not updated properly.

## v0.27.0

### Added
Expand Down

0 comments on commit 6dfc349

Please sign in to comment.