Skip to content

Commit

Permalink
[automation] update libbeat and beats packaging (#7559)
Browse files Browse the repository at this point in the history
* Update to elastic/beats@49a7ebdde9ef

* Move Manager.Start() and Manager.Stop() in the beat execution.

This move the Manager.Start and Stop into the Beats' run method, this
move ensure that the system is configured and ready to receive events.

Having the Manager started and stopped at the Libbeat level was causing
inconsistency when configuring the Beats by the Elastic Agent.
The problem would lead to the following behavior:

- Zombie Beats with only outputs configured
- Beats without any inputs configured
- Beats with some of the input configured.

The problem was often cause by restarting the agent and having the
machine under a significant load.

See: elastic/beats#30694 for details

* Update mock Manager implementation

Co-authored-by: apmmachine <infra-root-apmmachine@elastic.co>
Co-authored-by: Pier-Hugues Pellerin <phpellerin@gmail.com>
Co-authored-by: Andrew Wilkins <axw@elastic.co>
  • Loading branch information
4 people authored Mar 18, 2022
1 parent c28d7e2 commit 0ea7029
Show file tree
Hide file tree
Showing 5 changed files with 28 additions and 14 deletions.
8 changes: 4 additions & 4 deletions NOTICE.txt
Original file line number Diff line number Diff line change
Expand Up @@ -260,11 +260,11 @@ SOFTWARE.

--------------------------------------------------------------------------------
Dependency : github.com/elastic/beats/v7
Version: v7.0.0-alpha2.0.20220316020502-44b52e99fb40
Version: v7.0.0-alpha2.0.20220316202234-49a7ebdde9ef
Licence type (autodetected): Elastic
--------------------------------------------------------------------------------

Contents of probable licence file $GOMODCACHE/github.com/elastic/beats/v7@v7.0.0-alpha2.0.20220316020502-44b52e99fb40/LICENSE.txt:
Contents of probable licence file $GOMODCACHE/github.com/elastic/beats/v7@v7.0.0-alpha2.0.20220316202234-49a7ebdde9ef/LICENSE.txt:

Source code in this repository is variously licensed under the Apache License
Version 2.0, an Apache compatible license, or the Elastic License. Outside of
Expand Down Expand Up @@ -16386,11 +16386,11 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.

--------------------------------------------------------------------------------
Dependency : golang.org/x/sys
Version: v0.0.0-20220315194320-039c03cc5b86
Version: v0.0.0-20220317022123-2c4bbad7e934
Licence type (autodetected): BSD-3-Clause
--------------------------------------------------------------------------------

Contents of probable licence file $GOMODCACHE/golang.org/x/sys@v0.0.0-20220315194320-039c03cc5b86/LICENSE:
Contents of probable licence file $GOMODCACHE/golang.org/x/sys@v0.0.0-20220317022123-2c4bbad7e934/LICENSE:

Copyright (c) 2009 The Go Authors. All rights reserved.

Expand Down
8 changes: 8 additions & 0 deletions beater/beater.go
Original file line number Diff line number Diff line change
Expand Up @@ -203,6 +203,14 @@ func (bt *beater) run(ctx context.Context, cancelContext context.CancelFunc, b *
ctx, reload.ReloadableFunc(reloader.reloadOutput),
)
})

// Start the manager after all the hooks are initialized
// and defined this ensure reloading consistency..
if err := b.Manager.Start(); err != nil {
return err
}
defer b.Manager.Stop()

} else {
// Management disabled, use statically defined config.
reloader.namespace = "default"
Expand Down
7 changes: 7 additions & 0 deletions beater/server_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -1024,3 +1024,10 @@ type mockManager struct {
func (m *mockManager) Enabled() bool {
return m.enabled
}

func (m *mockManager) Start() error {
return nil
}

func (m *mockManager) Stop() {
}
7 changes: 3 additions & 4 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -13,13 +13,12 @@ require (
github.com/dop251/goja_nodejs v0.0.0-20211022123610-8dd9abb0616d // indirect
github.com/dustin/go-humanize v1.0.0
github.com/elastic/apm-server/approvaltest v0.0.0-00010101000000-000000000000
github.com/elastic/beats/v7 v7.0.0-alpha2.0.20220316020502-44b52e99fb40
github.com/elastic/beats/v7 v7.0.0-alpha2.0.20220316202234-49a7ebdde9ef
github.com/elastic/ecs v1.12.0
github.com/elastic/elastic-agent-client/v7 v7.0.0-20210922110810-e6f1f402a9ed // indirect
github.com/elastic/gmux v0.2.0
github.com/elastic/go-elasticsearch/v8 v8.0.0-20220127104600-bc3eb8ef52ea
github.com/elastic/go-hdrhistogram v0.1.0
github.com/elastic/go-lookslike v0.3.0
github.com/elastic/go-ucfg v0.8.4
github.com/fatih/color v1.13.0 // indirect
github.com/go-sourcemap/sourcemap v2.1.3+incompatible
Expand All @@ -34,7 +33,7 @@ require (
github.com/josephspurrier/goversioninfo v1.4.0 // indirect
github.com/json-iterator/go v1.1.12
github.com/libp2p/go-reuseport v0.0.2
github.com/magefile/mage v1.12.1
github.com/magefile/mage v1.13.0
github.com/mattn/go-colorable v0.1.12 // indirect
github.com/mitchellh/hashstructure v1.1.0 // indirect
github.com/modern-go/reflect2 v1.0.2
Expand All @@ -61,7 +60,7 @@ require (
golang.org/x/crypto v0.0.0-20220315160706-3147a52a75dd // indirect
golang.org/x/net v0.0.0-20220225172249-27dd8689420f
golang.org/x/sync v0.0.0-20210220032951-036812b2e83c
golang.org/x/sys v0.0.0-20220315194320-039c03cc5b86 // indirect
golang.org/x/sys v0.0.0-20220317022123-2c4bbad7e934 // indirect
golang.org/x/time v0.0.0-20210723032227-1f47c861a9ac
golang.org/x/tools v0.1.10
google.golang.org/genproto v0.0.0-20220314164441-57ef72a4c106 // indirect
Expand Down
12 changes: 6 additions & 6 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -520,8 +520,8 @@ github.com/eclipse/paho.mqtt.golang v1.2.0/go.mod h1:H9keYFcgq3Qr5OUJm/JZI/i6U7j
github.com/eclipse/paho.mqtt.golang v1.3.5 h1:sWtmgNxYM9P2sP+xEItMozsR3w0cqZFlqnNN1bdl41Y=
github.com/eclipse/paho.mqtt.golang v1.3.5/go.mod h1:eTzb4gxwwyWpqBUHGQZ4ABAV7+Jgm1PklsYT/eo8Hcc=
github.com/edsrzf/mmap-go v1.0.0/go.mod h1:YO35OhQPt3KJa3ryjFM5Bs14WD66h8eGKpfaBNrHW5M=
github.com/elastic/beats/v7 v7.0.0-alpha2.0.20220316020502-44b52e99fb40 h1:mXXauEx1q4FjNLGQtJLkVwD1biqUHtFuag9MHW5eI5A=
github.com/elastic/beats/v7 v7.0.0-alpha2.0.20220316020502-44b52e99fb40/go.mod h1:JYWe2imk/uiS3rAdWlnCAT8XrTo34f/D8u4r4jBU4sw=
github.com/elastic/beats/v7 v7.0.0-alpha2.0.20220316202234-49a7ebdde9ef h1:ww/T08vucn3DBMVGMKQxA4osOrWOwPUUwkAC8gQMWSQ=
github.com/elastic/beats/v7 v7.0.0-alpha2.0.20220316202234-49a7ebdde9ef/go.mod h1:JYWe2imk/uiS3rAdWlnCAT8XrTo34f/D8u4r4jBU4sw=
github.com/elastic/ecs v1.12.0 h1:u6WZ2AWtxv5vHvTQ4EuVZdWZ51mKHQ2UIltRePcta5U=
github.com/elastic/ecs v1.12.0/go.mod h1:pgiLbQsijLOJvFR8OTILLu0Ni/R/foUNg0L+T6mU9b4=
github.com/elastic/elastic-agent-client/v7 v7.0.0-20210727140539-f0905d9377f6/go.mod h1:uh/Gj9a0XEbYoM4NYz4LvaBVARz3QXLmlNjsrKY9fTc=
Expand Down Expand Up @@ -1261,8 +1261,8 @@ github.com/lucasb-eyer/go-colorful v1.0.3/go.mod h1:R4dSotOR9KMtayYi1e77YzuveK+i
github.com/lyft/protoc-gen-validate v0.0.13/go.mod h1:XbGvPuh87YZc5TdIa2/I4pLk0QoUACkjt2znoq26NVQ=
github.com/magefile/mage v1.9.0/go.mod h1:z5UZb/iS3GoOSn0JgWuiw7dxlurVYTu+/jHXqQg881A=
github.com/magefile/mage v1.11.0/go.mod h1:z5UZb/iS3GoOSn0JgWuiw7dxlurVYTu+/jHXqQg881A=
github.com/magefile/mage v1.12.1 h1:oGdAbhIUd6iKamKlDGVtU6XGdy5SgNuCWn7gCTgHDtU=
github.com/magefile/mage v1.12.1/go.mod h1:z5UZb/iS3GoOSn0JgWuiw7dxlurVYTu+/jHXqQg881A=
github.com/magefile/mage v1.13.0 h1:XtLJl8bcCM7EFoO8FyH8XK3t7G5hQAeK+i4tq+veT9M=
github.com/magefile/mage v1.13.0/go.mod h1:z5UZb/iS3GoOSn0JgWuiw7dxlurVYTu+/jHXqQg881A=
github.com/magiconair/properties v1.8.0/go.mod h1:PppfXfuXeibc/6YijjN8zIbojt8czPbwD3XqdrwzmxQ=
github.com/magiconair/properties v1.8.5 h1:b6kJs+EmPFMYGkow9GiUyCyOvIwYetYJ3fSaWak/Gls=
github.com/magiconair/properties v1.8.5/go.mod h1:y3VJvCyxH9uVvJTWEGAELF3aiYNyPKd5NZ3oSwXrF60=
Expand Down Expand Up @@ -2260,8 +2260,8 @@ golang.org/x/sys v0.0.0-20210917161153-d61c044b1678/go.mod h1:oPkhp1MJrh7nUepCBc
golang.org/x/sys v0.0.0-20210927094055-39ccf1dd6fa6/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/sys v0.0.0-20211102192858-4dd72447c267/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/sys v0.0.0-20211216021012-1d35b9e2eb4e/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/sys v0.0.0-20220315194320-039c03cc5b86 h1:A9i04dxx7Cribqbs8jf3FQLogkL/CV2YN7hj9KWJCkc=
golang.org/x/sys v0.0.0-20220315194320-039c03cc5b86/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/sys v0.0.0-20220317022123-2c4bbad7e934 h1:GwUTNnIS5asZGjc34dMBLO/LLp4kEvyZr/8wlQs1Bt8=
golang.org/x/sys v0.0.0-20220317022123-2c4bbad7e934/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/term v0.0.0-20201117132131-f5c789dd3221/go.mod h1:Nr5EML6q2oocZ2LXRh80K7BxOlk5/8JxuGnuhpl+muw=
golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo=
golang.org/x/term v0.0.0-20210220032956-6a3ed077a48d/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo=
Expand Down

0 comments on commit 0ea7029

Please sign in to comment.