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

Add HTTP helper for Metricsets #3413

Merged
merged 1 commit into from
Jan 20, 2017
Merged

Conversation

ruflin
Copy link
Contributor

@ruflin ruflin commented Jan 19, 2017

This should simplify the implementation of MetricSets based on HTTP.

client *http.Client // HTTP client that is reused across requests.
}

// NewHttpMetricset creates new instance of HttpMetriSset
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Type in HttpMetricSet.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks more like the comment is out of date, it should be "creates a new instance of Http". Btw, HTTP is an acronym so usually it shows up as HTTP in Go code, right? That might look weird though.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah, in the first version it was call HttpMetricset because it was not in the metricset package.

You are right based on our standard it should be called HTTP, but it will look wiered :-( I would prefer to leave it. @urso Thoughts.

Copy link
Contributor

@tsg tsg left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM, this is great. It now makes sense to add some unit tests for the Http type. I'm good with having it in a future PR.

@ruflin ruflin force-pushed the http-helper branch 2 times, most recently from 6daf205 to 0ca6c80 Compare January 20, 2017 09:53
@ruflin ruflin mentioned this pull request Jan 20, 2017
Copy link
Member

@andrewkroh andrewkroh left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is a nice improvement!

"github.com/elastic/beats/metricbeat/mb"
)

type Http struct {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Http should be HTTP.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

:-) @tsg and me had the same discussion, but came to the conclusion HTTP will look ugly :-) What would you call the private variable in this case? http?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What private variable?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't see anything wrong with http *helper.HTTP. It's not much different from http *helper.Http. Or am I missing something?

This should simplify the implementation of MetricSets based on HTTP.
@ruflin ruflin changed the title Add http helper for metricsets Add HTTP helper for Metricsets Jan 20, 2017
@andrewkroh andrewkroh merged commit 77cec5a into elastic:master Jan 20, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants