Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

How do I stop logging metrics? #257

Open
4alexey opened this issue Apr 16, 2019 · 1 comment
Open

How do I stop logging metrics? #257

4alexey opened this issue Apr 16, 2019 · 1 comment

Comments

@4alexey
Copy link

4alexey commented Apr 16, 2019

Hi, I'd like to log metrics once after command execution, log them or print them out, and exit. However the call to metrics.Log(r, 10*time.Second, histoLog) blocks and continues logging the metrics. How do I print metrics once, clean up, and exit? Thanks!

histoLog := logrus.New()
histoLog.Out = os.Stdout
metrics.Log(r, 10*time.Second, histoLog)
@4alexey
Copy link
Author

4alexey commented Apr 16, 2019

LogScaled uses time.Tick

func Tick(d Duration) <-chan Time

Tick is a convenience wrapper for NewTicker providing access to the ticking channel only. While Tick is useful for clients that have no need to shut down the Ticker, be aware that without a way to shut it down the underlying Ticker cannot be recovered by the garbage collector; it "leaks". Unlike NewTicker, Tick will return nil if d <= 0.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant