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 support in jolokia get response for single value #11075

Merged
merged 5 commits into from
Mar 6, 2019
Merged

Add support in jolokia get response for single value #11075

merged 5 commits into from
Mar 6, 2019

Conversation

kaiyan-sheng
Copy link
Contributor

@kaiyan-sheng kaiyan-sheng commented Mar 5, 2019

Jolokia module fails to parse some responses fetched using the GET method with error:

json: cannot unmarshal number into Go struct field Entry.Value of type map[string]interface {}
failed to unmarshal jolokia JSON response '{"request":{"mbean":"java.lang:type=Runtime","attribute":"Uptime","type":"read"},"value":88622,"timestamp":1551739190,"status":200}'

This is because value field can be a map[string]interface or it can also be just a float.

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.

Thanks for this! I have added some comments, let me know what you think.

metricbeat/module/jolokia/jmx/data.go Outdated Show resolved Hide resolved
metricbeat/module/jolokia/jmx/data.go Show resolved Hide resolved
metricbeat/module/jolokia/jmx/data_test.go Show resolved Hide resolved
metricbeat/module/jolokia/jmx/data_test.go Outdated Show resolved Hide resolved
@kaiyan-sheng kaiyan-sheng self-assigned this Mar 5, 2019
@kaiyan-sheng kaiyan-sheng added bug Metricbeat Metricbeat needs_backport PR is waiting to be backported to other branches. v7.0.0 Team:Integrations Label for the Integrations team in progress Pull request is currently in progress. labels Mar 5, 2019
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.

It looks great, thanks for fixing this!

metricbeat/module/jolokia/jmx/data.go Show resolved Hide resolved
metricbeat/module/jolokia/jmx/data.go Show resolved Hide resolved
metricbeat/module/jolokia/jmx/data.go Show resolved Hide resolved
@jsoriano
Copy link
Member

jsoriano commented Mar 6, 2019

@kaiyan-sheng what do you think about backporting this too to 6.7 and 6.6?

@kaiyan-sheng
Copy link
Contributor Author

@jsoriano Yes backporting to 6.7 and 6.6 for sure! I will add the labels. How about anything earlier than that?

@jsoriano
Copy link
Member

jsoriano commented Mar 6, 2019

@kaiyan-sheng earlier versions are not affected, support for GET method was introduced in 6.6.0.

@kaiyan-sheng kaiyan-sheng merged commit c238ea2 into elastic:master Mar 6, 2019
@kaiyan-sheng kaiyan-sheng deleted the jolokia_parse branch March 6, 2019 16:32
kaiyan-sheng added a commit that referenced this pull request Mar 6, 2019
…lue (#11075) (#11115)

* Add support in jolokia get response for single value (#11075)

* Add support in jolokia get response for single value

* Use reflect.TypeOf to check attribute and value type

* Add changelog

* Replace reflect by type switching

* Fix indentation for comments

(cherry picked from commit c238ea2)

* Fix changelog rebase

* Rerun TestData to generate data.json
kaiyan-sheng added a commit that referenced this pull request Mar 7, 2019
…lue (#11075) (#11117)

* Add support in jolokia get response for single value (#11075)

(cherry picked from commit c238ea2)
kaiyan-sheng added a commit that referenced this pull request Mar 7, 2019
…lue (#11075) (#11116)

* Add support in jolokia get response for single value (#11075)
(cherry picked from commit c238ea2)
@kaiyan-sheng kaiyan-sheng removed in progress Pull request is currently in progress. needs_backport PR is waiting to be backported to other branches. labels Mar 7, 2019
leweafan pushed a commit to leweafan/beats that referenced this pull request Apr 28, 2023
…lue (elastic#11075) (elastic#11117)

* Add support in jolokia get response for single value (elastic#11075)

(cherry picked from commit 1d966f2)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Metricbeat Metricbeat Team:Integrations Label for the Integrations team
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants