-
Notifications
You must be signed in to change notification settings - Fork 486
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
Add usage reporter to track feature flags #1661
Conversation
Co-authored-by: brendamuir <100768211+brendamuir@users.noreply.github.com>
Co-authored-by: brendamuir <100768211+brendamuir@users.noreply.github.com>
Co-authored-by: brendamuir <100768211+brendamuir@users.noreply.github.com>
Co-authored-by: brendamuir <100768211+brendamuir@users.noreply.github.com>
Based on the past experiences of the Loki team, it's better to have this option |
Co-authored-by: Paschalis Tsilias <tpaschalis@users.noreply.github.com>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I haven't tested this (especially on Windows), but it looks okay to me!
pkg/usagestats/reporter.go
Outdated
// The interval is based off the creation of the agent seed to avoid all agents reporting at the same time. | ||
func nextReport(interval time.Duration, createdAt, now time.Time) time.Time { | ||
// createdAt * (x * interval ) >= now | ||
return createdAt.Add(time.Duration(math.Ceil(float64(now.Sub(createdAt))/float64(interval))) * interval) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Maybe separate this into a few statements for readability
Co-authored-by: brendamuir <100768211+brendamuir@users.noreply.github.com>
Co-authored-by: brendamuir <100768211+brendamuir@users.noreply.github.com>
Co-authored-by: brendamuir <100768211+brendamuir@users.noreply.github.com>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
A few small non critical things but overall good
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nice
PR Description
This PR adds the ability to pass the
usage-report
flag to the Grafana Agent to sendusage report of the enabled feature flags. The usage of this optional and disabled by default.
If enabled, it will send hourly the enabled flags to grafana.com.
Which issue(s) this PR fixes
Fixes #1488
Notes to the Reviewer
I followed a similar approach taken by grafana/loki#5361. I skipped
the part of leader selection when send the usage. I wasn't sure if we needed this bit.
I placed the initialization of the reporter in
entrypoint.,go
in functionStart
. Not sureif it should go there or somewhere else.
We can extend the reporter in the future to send any other kind of metrics.
PR Checklist