-
Notifications
You must be signed in to change notification settings - Fork 4.9k
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
Convert license struct to MapStr #14378
Conversation
Pinging @elastic/stack-monitoring (Stack monitoring) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The code looks good to me. I tried to test it but I think it requires the platinum ES license. Any unit test you can add for making sure ms-since-epoch values are marshaled correctly?
Changes looks good (but I am not terribly familiar with this code base or language). Thanks for fixing this ! |
Trial license works as well.
I've been trying to do this for the past couple hours, actually. From what I can tell the marshalling from int to double is happening at a lower level, perhaps in libbeat. So I'm not sure a simple unit test in the elasticsearch Metricbeat module would do the trick here. Since the symptom of the problem shows up in an Elasticsearch document, I might have to resort to a system test here. |
ac932f3
to
adb5796
Compare
@kaiyan-sheng I've added a system test per my previous comment. Please re-review when you get a chance. Thanks! [EDIT] FWIW, I ran the same system test on |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM, thanks for adding the test.
2e3b0d6
to
9d53df9
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Tested and works as expected. Code looks good as well. Nice work!
9d53df9
to
75a11b1
Compare
75a11b1
to
8234d04
Compare
* Convert license struct to MapStr * Adding CHANGELOG entry * Fixing structure * Adding system test
Currently when the
elasticsearch
module prepares acluster_stats
document to index into.monitoring-es-*
, it marshals any values representing ms-since-epoch into scientific notation, e.g.1.572634502804E12
. Elasticsearch needs these values to be preserved as regular integers, e.g.1572634502804
.Turns out this only happens when marshaling a
struct
containing such values. Marshaling acommon.MapStr
marshals the values as expected.Looking through the
elasticsearch
module code for thecluster_stats
metricset, the only struct that was being used in preparing the document for ES was theLicense
struct. This PR adds atoMapStr()
method to this struct and uses its results in the document instead.Testing this PR
Start up Elasticsearch.
Build Metricbeat with this PR.
Enable the
elasticsearch-xpack
Metricbeat module.Run Metricbeat
Verify that
type:cluster_stats
documents in.monitoring-es-*
contain regular integer values for ms-since-epoch fields under thelicense
field.