-
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
Dedot kubernetes fields #6203
Dedot kubernetes fields #6203
Conversation
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? |
5ec5bbf
to
1418025
Compare
result[DeDot(key)] = DeDotJSON(value) | ||
} | ||
return result | ||
case MapStr: |
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.
Thanks for adding this option here. Could you add a test case for this "switch" option?
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.
@ruflin Tests added, and also made some changes to original test code...
@@ -54,11 +54,11 @@ func (g *metaGenerator) PodMetadata(pod *Pod) common.MapStr { | |||
} | |||
|
|||
if len(labelMap) != 0 { | |||
meta["labels"] = labelMap | |||
meta["labels"] = common.DeDotJSON(labelMap) |
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.
@exekias This is a breaking change. I wonder if you see an issue in this?
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.
We need this as a bugfix anyway, isn't it? Didn't follow previous conversations but I guess this is needed to avoid mapping issues?
In any case it's a breaking change and we should make it clear in the release notes
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.
As far as I know it didn't break yet but it would pretty soon :-) So yes having it as breaking change caused by a bug is a good way to state it.
jenkins, test it |
jenkins, test it |
input []byte | ||
output []byte | ||
valuer func() 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.
Thanks for converting this to a table test. It makes it much easier to compare input with output. It makes it a bit harder to write json then before but I think the benefits outweight here.
836260d
to
f91bdbc
Compare
f91bdbc
to
1c4e218
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.
thank you for taking this!
jenkins, test it please |
There should be a better way to handle this as it invokes disparity between how objects are represented in Kubernetes and how autodiscover is configured in Beats. For example a label |
I'm ok with making this optional, will open a PR for it 👍 I want to fix the way we handle metadata with dots too |
@walktall, autodiscover doesnt use this as it presets all the pod meta. so it would fail for that flow. |
The problem with the dotted keys is that they also caused some issues in the processors. But this should be solved by #5916 I agree we should make it optional as I would also prefer to have the same representation in ES as is delivered by k8s. It creates the potential issue of collisions as also discussed in micrometer-metrics/micrometer#154 (comment) My thinking here is that Metricbeat should have a way prevent such collisions at least for one single event. Meaning if there is +1 on having a processor for it. The important part with a processor is that we can specify which part of an event should be dedotted as in most cases it's only the labels. |
Related to #5942
@ruflin @exekias PTAL~