-
Notifications
You must be signed in to change notification settings - Fork 6
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
Replace gostats with tally #162
Conversation
server/server.go
Outdated
statsScope := stats.NewDefaultStore().Scope(userConfig.StatsNamespace) | ||
statsScope.Store().AddStatGenerator(stats.NewRuntimeStats(statsScope.Scope("go"))) | ||
// statsScope := stats.NewDefaultStore().Scope(userConfig.StatsNamespace) | ||
// statsScope.Store().AddStatGenerator(stats.NewRuntimeStats(statsScope.Scope("go"))) |
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.
delete?
server/metrics/statsd.go
Outdated
tallystatsd "github.com/uber-go/tally/statsd" | ||
) | ||
|
||
func NewLoggingScope(logger logging.SimpleLogging, statsNamespace string) (tally.Scope, io.Closer, error) { |
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.
This seems to only be used by tests? Can you leave a comment about it?
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.
It'll be used by the local server setup as well if it's running in debug mode.
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.
Looks good, couple comments.
server/metrics/statsd.go
Outdated
} | ||
|
||
func newReporter(cfg valid.Metrics, logger logging.SimpleLogging) (tally.StatsReporter, error) { | ||
if cfg.Statsd == nil { |
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.
Is this always the case? What if there was a misconfigation that somehow set the statsd to nil? Shouldn't we return an error here? Looks like newLoggingReporter
is only used by tests.
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.
the idea is here is to have a set of fields in that config object for statsd, prometheus and really any time of metrics supported by tally.
We are checking to see which metrics object is populated and if nothing is, we just return the logging scope.
Co-authored-by: Sarvar Muminov <43311+msarvar@users.noreply.github.com>
Basically I create a
Metrics
object invalid.GlobalCfg
which contains statsd info. This object should technically be parsed from yaml config and should eventually be used to support prometheus or any other metrics provider. (This will be done in a followup PR to not blow up the scope)I also added runtime stats publishing to our executor service. This means that when we OSS this change, we'll need to move executor service out from the lyft package.
This is the first PR to get this out of the door and ensure our stats are working as expected.