-
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
Cherry-pick #19135 to 7.x: Apply Autodiscovery dynamic fields in autoreloading #19708
Conversation
Pinging @elastic/integrations-services (Team:Services) |
💔 Build FailedExpand to view the summary
Build stats
Test stats 🧪
Steps errorsExpand to view the steps failures
Log outputExpand to view the last 100 lines of log output
|
(cherry picked from commit e76e914)
CI is all green. Uploading some results failed. |
Cherry-pick of PR #19135 to 7.x branch. Original message:
What does this PR do?
Add a helper
WithDynamicFields
topipetool
package to configure dynamic fields added by Autodiscovery in a more consistent manner.Instead of the Beats having to add dynamic fields, the addition will be handled in libbeat only now.
In order to ease testing without the full beats publishing pipeline a FakeConnector and FakeClient have been added to
libbeat/pipeline/testing
Remove the configuration of dynamic fields from each filebeat input.
Why is it important?
Dynamic fields is a feature that was introduced to beats by autodiscovery. Instead of configuring fields a pointer to the fields to be added is shared. The autodiscovery provider can update the pointer to a new MapStr in order to reconfigure the fields without having to restart the input/module.
Currently each input needs to apply DynamicFields when connecting to the publisher pipeline. In Filebeat each Input has to add the fields when connecting, while Metricbeat and Heartbeat use custom wrappers.
With this change dynamic fields from autodiscovery are handled by libbeat in one single place only. This reduces duplication and sharing of responsibilities regarding autodiscovery specific code among the beats code base.
Note: responsibility for applying dynamic fields is still shared between autodiscovery and the cfgfile package. As the future of both package is somewhat in the flux I will not continue refactoring these two package for now (unless changes are required for the v2 input API).
This change is introduced to prepare for the input v2 API introduction in Beats. Moving common functionality up into more appropriate layers removes the need to reimplement the functionality in the new API.
Note: I didn't check in detail, but it looks like this changes fixes a bug in heartbeat not picking up dynamic field changes triggered by kuberenetes events.
Checklist
- [ ] I have made corresponding changes to the documentation- [ ] I have made corresponding change to the default configuration filesCHANGELOG.next.asciidoc
orCHANGELOG-developer.next.asciidoc
.How to test this PR locally
The change should not be user visible. But in order to verify no regression is introduced some simple tests with kubernetes autodiscovery would be helpful (@exekias can you give details/instructions?)
Developer Docs
The
cfgfile.RunnerFactory
interface has been modified. The interface is used to integrate with AutoDiscovery or input configuration reloading. The last parameter of typecommon.MapStrPointer
has been removed. TheProcessing.DynamicFields
is not required to be set anymore when callingpipeline.ConnectWith
.Related issues