chore(cli): minor metrics-related cleanups (#1995)

* stop ticker to release resources
* nit: fix typo
* nit: add new line at EOF
This commit is contained in:
Julio Lopez
2022-05-31 14:04:01 -07:00
committed by GitHub
parent 99fb50118f
commit 511f4aa65d
2 changed files with 6 additions and 4 deletions

2
.github/config.yml vendored
View File

@@ -1,2 +1,2 @@
PR_TITLE_REGEX: /(feat|fix|breaking|build|chore|docs|style|refactor|test)\((app|cli|server|providers|deps|site|ci|infra|general)\): .*/
COMMIT_MESSAGE_REGEX: /(feat|fix|breaking|build|chore|docs|style|refactor|test)\((app|cli|server|providers|deps|site|ci|infra|general)\): .*/
COMMIT_MESSAGE_REGEX: /(feat|fix|breaking|build|chore|docs|style|refactor|test)\((app|cli|server|providers|deps|site|ci|infra|general)\): .*/

View File

@@ -25,7 +25,7 @@
)
// nolint:gochecknoglobals
var matricsPushFormats = map[string]expfmt.Format{
var metricsPushFormats = map[string]expfmt.Format{
"text": expfmt.FmtText,
"proto-text": expfmt.FmtProtoText,
"proto-delim": expfmt.FmtProtoDelim,
@@ -68,7 +68,7 @@ func (c *observabilityFlags) setup(app *kingpin.Application) {
var formats []string
for k := range matricsPushFormats {
for k := range metricsPushFormats {
formats = append(formats, k)
}
@@ -122,7 +122,7 @@ func (c *observabilityFlags) startMetrics(ctx context.Context) error {
}
if c.metricsPushFormat != "" {
pusher.Format(matricsPushFormats[c.metricsPushFormat])
pusher.Format(metricsPushFormats[c.metricsPushFormat])
}
log(ctx).Infof("starting prometheus pusher on %v every %v", c.metricsPushAddr, c.metricsPushInterval)
@@ -195,7 +195,9 @@ func (c *observabilityFlags) pushPeriodically(ctx context.Context, p *push.Pushe
c.pushOnce(ctx, "periodic", p)
case <-c.stopPusher:
ticker.Stop()
c.pushOnce(ctx, "final", p)
return
}
}