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

Refactor http.server metricset #7100

Merged
merged 6 commits into from May 31, 2018

Conversation

ruflin
Copy link
Member

@ruflin ruflin commented May 15, 2018

This PR cleans up the http.server metricset which fixes a bug but also has breaking changes.

Breaking changes:

  • Before events were put under http.http prefix by default which was not intended. Now it is http.server by default.
  • Config options for the metricset are prefixed now by server. as we have for other metricsets.

Further changes

  • Metricset now uses PushReporterV2 interface
  • System test added to confirm data structure
  • Add more docs

@ruflin ruflin added in progress Pull request is currently in progress. module review Metricbeat Metricbeat labels May 15, 2018
@@ -77,6 +77,7 @@ func (p *metricProcessor) Process(event server.Event) (common.MapStr, error) {
return nil, errors.New(fmt.Sprintf("Unsupported Content-Type: %s", contentType))
}

// QUESTION: What is the exact expected behaviour here if no list of paths is set
Copy link
Member Author

Choose a reason for hiding this comment

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

@vjsamuel Could you comment here? It seems right now if I just run it the events end up under http/http. Not sure if that is expected.

Copy link
Contributor

Choose a reason for hiding this comment

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

func defaultHttpServerConfig() HttpServerConfig {
	return HttpServerConfig{
		DefaultPath: PathConfig{
			Path:      "/",
			Namespace: "http",
		},
	}
}

it just exposes an API on / where you can send the data and the default namespace would be http

Copy link
Member Author

Choose a reason for hiding this comment

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

Ok, at the moment the default is http/http so this is a bug I assume.

@ruflin ruflin force-pushed the http-server-push-reporter-v2 branch 2 times, most recently from ca5173a to 6d39dee Compare May 17, 2018 11:20
@ruflin ruflin changed the title Move http server to push reporter v2 Refactor http.server metricset May 17, 2018
@ruflin ruflin removed the in progress Pull request is currently in progress. label May 17, 2018
@ruflin
Copy link
Member Author

ruflin commented May 17, 2018

@vjsamuel As I already touched the metricset I cleaned it up a bit which also means some breaking changes. Please have a look.

@ruflin ruflin force-pushed the http-server-push-reporter-v2 branch from 6d39dee to 5b0b400 Compare May 17, 2018 12:12
Copy link
Contributor

@exekias exekias left a comment

Choose a reason for hiding this comment

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

LGTM

Paths []PathConfig `config:"paths"`
DefaultPath PathConfig `config:"default_path"`
Paths []PathConfig `config:"server.paths"`
DefaultPath PathConfig `config:"server.default_path"`
Copy link
Contributor

Choose a reason for hiding this comment

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

LGTM, if you want to do a softer deprecation you could still read old settings before these, but I don't think this is a hard requirement.

Copy link
Member

@jsoriano jsoriano left a comment

Choose a reason for hiding this comment

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

Mosly LGTM, one small comment in tests.

port: "8080"
server.paths:
- path: "/foo"
namespace: "foo"
Copy link
Member

Choose a reason for hiding this comment

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

Cool


self.wait_until(lambda: self.log_contains("Starting http server on localhost:8080"))

requests.post('http://localhost:8080/', json={'hello': 'world'}, headers={'Content-Type': 'application/json'})
Copy link
Member

Choose a reason for hiding this comment

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

This request should go to the value in $HTTP_HOST instead of to localhost.

@ruflin
Copy link
Member Author

ruflin commented May 24, 2018

PR updated with review comment.

@jsoriano
Copy link
Member

Failure in travis could be related https://travis-ci.org/elastic/beats/jobs/383064425#L4420

@ruflin ruflin force-pushed the http-server-push-reporter-v2 branch from aa8feac to 44358cf Compare May 29, 2018 04:45
This PR cleans up the http.server metricset which fixes a bug but also has breaking changes.

Breaking changes:

* Before events were put under `http.http` prefix by default which was not intended. Now it is `http.server` by default.
* Config options for the metricset are prefixed now by `server.` as we have for other metricsets.

Further changes

* Metricset now uses PushReporterV2 interface
* System test added to confirm data structure
* Add more docs
@jsoriano jsoriano merged commit f1c1aec into elastic:master May 31, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants