-
Notifications
You must be signed in to change notification settings - Fork 0
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
Switch back to kingpin for arg parsing #2
Conversation
opts = append(opts, statsd.TagsFormat(tagFormat)) | ||
} | ||
|
||
return statsd.New(opts...) |
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.
Should this be statsd.New(), nil
or does statsd.New return an (instance, error)
itself?
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.
statsd.New
returns (instance, error)
stats.Gauge(fmt.Sprintf("consumer_lag,%s", strings.Join(tags, ",")), lag) | ||
stats := statsdClient.Clone( | ||
statsd.Tags("topic", topic), | ||
statsd.Tags("partition", strconv.FormatInt(int64(partitionID), 10)), |
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 there any risk of this throwing? Say partitionID
is 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.
partitionID
is an int32. Int32 isn't a pointer, so it can't be nil. This is just doing a int->str conversion.
tags = append(tags, fmt.Sprintf("partition=%d", partitionID)) | ||
tags = append(tags, "consumer_group="+cg) | ||
stats.Gauge(fmt.Sprintf("consumer_lag,%s", strings.Join(tags, ",")), lag) | ||
stats := statsdClient.Clone( |
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.
Does Go garbage collect automatically?
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.
Yes, go is a garbage collected language. The cloned client also doesn't need to be .Close()
d because when the main client is closed, all cloned clients are also closed.
It allows for parameter passing via environment variables.
Also hit it with that
go mod tidy
to get rid of some of the unused dependencies.