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

Switch back to kingpin for arg parsing #2

Merged
merged 4 commits into from
Apr 8, 2019
Merged

Conversation

Fiveside
Copy link

@Fiveside Fiveside commented Apr 4, 2019

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.

opts = append(opts, statsd.TagsFormat(tagFormat))
}

return statsd.New(opts...)
Copy link

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?

Copy link
Author

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)),
Copy link

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?

Copy link
Author

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(
Copy link

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?

Copy link
Author

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.

@Fiveside Fiveside merged commit 66ede95 into master Apr 8, 2019
@Fiveside Fiveside deleted the add-envar-overrides branch April 8, 2019 22:10
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

Successfully merging this pull request may close these issues.

2 participants