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 missing namespace field in http server metricset #7890

Merged
merged 1 commit into from
Aug 7, 2018

Conversation

vjsamuel
Copy link
Contributor

@vjsamuel vjsamuel commented Aug 7, 2018

This PR adds back the missing metricset.namespace field in to payloads generated by http server.

@elasticmachine
Copy link
Collaborator

Since this is a community submitted pull request, a Jenkins build has not been kicked off automatically. Can an Elastic organization member please verify the contents of this patch and then kick off a build manually?

Copy link
Member

@ruflin ruflin left a comment

Choose a reason for hiding this comment

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

@@ -83,10 +84,10 @@ func (m *MetricSet) Run(reporter mb.PushReporterV2) {
reporter.Error(err)
} else {
event := mb.Event{}
event.ModuleFields = common.MapStr{}
metricSetName := fields[mb.NamespaceKey].(string)
ns := fields[mb.NamespaceKey].(string)
Copy link
Member

Choose a reason for hiding this comment

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

Could you add an , ok check to make sure type conversion works?

delete(fields, mb.NamespaceKey)
event.ModuleFields.Put(metricSetName, fields)
event.MetricSetFields = fields
Copy link
Member

Choose a reason for hiding this comment

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

Did you check if this has the expected outcome? Will this put it always under server or the namespace set below?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

it will put under the http.<namespace>

@vjsamuel
Copy link
Contributor Author

vjsamuel commented Aug 7, 2018

@ruflin the data.json matches the default config where the default namespace is always server:
https://github.com/elastic/beats/blob/master/metricbeat/module/http/server/config.go#L41

if ok {
ns = fmt.Sprintf("http.%s", ns)
delete(fields, mb.NamespaceKey)
} else {
Copy link
Member

Choose a reason for hiding this comment

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

Why do you have an else here?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

my bad

@ruflin ruflin merged commit 08dfd03 into elastic:master Aug 7, 2018
@vjsamuel vjsamuel deleted the add_back_http_namespace branch August 7, 2018 21:02
@opsnull
Copy link

opsnull commented Nov 14, 2018

@jsoriano
Copy link
Member

Yes, I'd say we should backport it, I'll do it.

jsoriano pushed a commit to jsoriano/beats that referenced this pull request Nov 14, 2018
This PR adds back the missing `metricset.namespace` field in to payloads generated by http server.

(cherry picked from commit 08dfd03)
jsoriano pushed a commit to jsoriano/beats that referenced this pull request Nov 14, 2018
This PR adds back the missing `metricset.namespace` field in to payloads generated by http server.

(cherry picked from commit 08dfd03)
jsoriano pushed a commit to jsoriano/beats that referenced this pull request Nov 14, 2018
This PR adds back the missing `metricset.namespace` field in to payloads generated by http server.

(cherry picked from commit 08dfd03)
jsoriano added a commit that referenced this pull request Nov 19, 2018
This PR adds back the missing `metricset.namespace` field in to payloads generated by http server.

(cherry picked from commit 08dfd03)

Co-authored-by: Vijay Samuel <vjsamuel1990@gmail.com>
jsoriano added a commit that referenced this pull request Nov 23, 2018
This PR adds back the missing `metricset.namespace` field in to payloads generated by http server.

(cherry picked from commit 08dfd03)

Co-authored-by: Vijay Samuel <vjsamuel1990@gmail.com>
leweafan pushed a commit to leweafan/beats that referenced this pull request Apr 28, 2023
…lastic#9071)

This PR adds back the missing `metricset.namespace` field in to payloads generated by http server.

(cherry picked from commit 21e1600)

Co-authored-by: Vijay Samuel <vjsamuel1990@gmail.com>
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.

5 participants