-
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
i5942: http/json module: Allow for modifying json field names with do… #5970
Conversation
Can one of the admins verify this patch? |
err = json.Unmarshal(actualJsonResponse, &actualJsonBody) | ||
assert.Nil(t, err) | ||
|
||
dedottedJsonResponse, err := ioutil.ReadFile(absPath + "/json_response_dedot.json") |
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.
var dedottedJsonResponse should be dedottedJSONResponse
assert.NotNil(t, absPath) | ||
assert.Nil(t, err) | ||
|
||
actualJsonResponse, err := ioutil.ReadFile(absPath + "/json_response_with_dots.json") |
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.
var actualJsonResponse should be actualJSONResponse
|
||
func TestEventMapper(t *testing.T) { | ||
var actualJsonBody map[string]interface{} | ||
var expectedJsonBody map[string]interface{} |
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.
var expectedJsonBody should be expectedJSONBody
) | ||
|
||
func TestEventMapper(t *testing.T) { | ||
var actualJsonBody map[string]interface{} |
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.
var actualJsonBody should be actualJSONBody
cd78d85
to
06a9a92
Compare
…ts in them in beats
06a9a92
to
da79a70
Compare
Included changes from #5957, ready for review from my side. |
@@ -153,3 +162,16 @@ func (m *MetricSet) getHeaders(header http.Header) map[string]string { | |||
} | |||
return headers | |||
} | |||
|
|||
func replaceDots(data interface{}) interface{} { |
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.
I wonder if we should have this recursive function also in libbeat later 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.
I actually had the very same idea as it is quite likely that also beats have json as payload where in all keys "dots" shall be replaced.
I can open a new PR for this if you OK.
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.
Sounds like a good idea.
jenkins, test it |
dedot.enabled
, with default valuefalse
.