Skip to content

Commit

Permalink
[updatecli] Update to elastic/beats@04eac62055e9 (#15458)
Browse files Browse the repository at this point in the history
* chore: Update to elastic/beats@b5f726b81c7f

Made with ❤️️ by updatecli

* feat: bump beats

* test: update libbeat es config path

* lint: regenerate notice file

* chore: Update to elastic/beats@799870737a07

Made with ❤️️ by updatecli

* test: improve TestRunManager_Reloader_newRunnerError fail message

* feat: bump beats

* fix: update reloader to use errors.join instead of multierrors

beats updated the reloader code to use errors.Join instead of multierrors

* test: update error message after reloader fix

* chore: Update to elastic/beats@04eac62055e9

Made with ❤️️ by updatecli

---------

Co-authored-by: elastic-observability-automation[bot] <180520183+elastic-observability-automation[bot]@users.noreply.github.com>
Co-authored-by: kruskall <[email protected]>
  • Loading branch information
1 parent d019277 commit 826c2bb
Show file tree
Hide file tree
Showing 7 changed files with 290 additions and 298 deletions.
500 changes: 250 additions & 250 deletions NOTICE.txt

Large diffs are not rendered by default.

13 changes: 6 additions & 7 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ require (
github.com/dustin/go-humanize v1.0.1
github.com/elastic/apm-aggregation v1.2.0
github.com/elastic/apm-data v1.16.0
github.com/elastic/beats/v7 v7.0.0-alpha2.0.20241231140711-7806f1a2cb26
github.com/elastic/beats/v7 v7.0.0-alpha2.0.20250131124117-04eac62055e9
github.com/elastic/elastic-agent-client/v7 v7.17.0
github.com/elastic/elastic-agent-libs v0.18.3
github.com/elastic/elastic-agent-system-metrics v0.11.7
Expand All @@ -25,9 +25,7 @@ require (
github.com/google/go-cmp v0.6.0
github.com/gorilla/mux v1.8.1
github.com/hashicorp/golang-lru v1.0.2
github.com/joeshaw/multierror v0.0.0-20140124173710-69b34d4ec901
github.com/libp2p/go-reuseport v0.4.0
github.com/modern-go/reflect2 v1.0.2
github.com/patrickmn/go-cache v2.1.0+incompatible
github.com/pkg/errors v0.9.1
github.com/ryanuber/go-glob v1.0.0
Expand Down Expand Up @@ -74,16 +72,15 @@ require (
github.com/davecgh/go-spew v1.1.2-0.20180830191138-d8f796af33cc // indirect
github.com/dgryski/go-metro v0.0.0-20211217172704-adc40b04c140 // indirect
github.com/dlclark/regexp2 v1.8.1 // indirect
github.com/docker/go-connections v0.5.0 // indirect
github.com/dop251/goja v0.0.0-20230427124612-428fc442ff5f // indirect
github.com/dop251/goja_nodejs v0.0.0-20171011081505-adff31b136e6 // indirect
github.com/eapache/go-resiliency v1.7.0 // indirect
github.com/eapache/go-xerial-snappy v0.0.0-20230731223053-c322873962e3 // indirect
github.com/eapache/queue v1.1.0 // indirect
github.com/ebitengine/purego v0.8.0 // indirect
github.com/ebitengine/purego v0.8.1 // indirect
github.com/elastic/elastic-transport-go/v8 v8.6.0 // indirect
github.com/elastic/go-lumber v0.1.2-0.20220819171948-335fde24ea0f // indirect
github.com/elastic/go-structform v0.0.10 // indirect
github.com/elastic/go-structform v0.0.12 // indirect
github.com/elastic/go-windows v1.0.2 // indirect
github.com/elastic/gosigar v0.14.3 // indirect
github.com/elastic/opentelemetry-lib v0.14.0 // indirect
Expand All @@ -110,6 +107,7 @@ require (
github.com/jcmturner/goidentity/v6 v6.0.1 // indirect
github.com/jcmturner/gokrb5/v8 v8.4.4 // indirect
github.com/jcmturner/rpc/v2 v2.0.3 // indirect
github.com/joeshaw/multierror v0.0.0-20140124173710-69b34d4ec901 // indirect
github.com/json-iterator/go v1.1.12 // indirect
github.com/klauspost/compress v1.17.11 // indirect
github.com/kr/pretty v0.3.1 // indirect
Expand All @@ -119,6 +117,7 @@ require (
github.com/mattn/go-isatty v0.0.20 // indirect
github.com/mitchellh/hashstructure v1.1.0 // indirect
github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd // indirect
github.com/modern-go/reflect2 v1.0.2 // indirect
github.com/munnerz/goautoneg v0.0.0-20191010083416-a7dc8b61c822 // indirect
github.com/pbnjay/memory v0.0.0-20210728143218-7b4eea64cf58 // indirect
github.com/pierrec/lz4/v4 v4.1.21 // indirect
Expand All @@ -131,7 +130,7 @@ require (
github.com/prometheus/procfs v0.15.1 // indirect
github.com/rcrowley/go-metrics v0.0.0-20201227073835-cf1acfcdf475 // indirect
github.com/rogpeppe/go-internal v1.13.1 // indirect
github.com/shirou/gopsutil/v4 v4.24.9 // indirect
github.com/shirou/gopsutil/v4 v4.24.10 // indirect
github.com/tklauser/go-sysconf v0.3.12 // indirect
github.com/tklauser/numcpus v0.6.1 // indirect
github.com/xdg-go/pbkdf2 v1.0.0 // indirect
Expand Down
20 changes: 10 additions & 10 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -113,14 +113,14 @@ github.com/eapache/go-xerial-snappy v0.0.0-20230731223053-c322873962e3 h1:Oy0F4A
github.com/eapache/go-xerial-snappy v0.0.0-20230731223053-c322873962e3/go.mod h1:YvSRo5mw33fLEx1+DlK6L2VV43tJt5Eyel9n9XBcR+0=
github.com/eapache/queue v1.1.0 h1:YOEu7KNc61ntiQlcEeUIoDTJ2o8mQznoNvUhiigpIqc=
github.com/eapache/queue v1.1.0/go.mod h1:6eCeP0CKFpHLu8blIFXhExK/dRa7WDZfr6jVFPTqq+I=
github.com/ebitengine/purego v0.8.0 h1:JbqvnEzRvPpxhCJzJJ2y0RbiZ8nyjccVUrSM3q+GvvE=
github.com/ebitengine/purego v0.8.0/go.mod h1:iIjxzd6CiRiOG0UyXP+V1+jWqUXVjPKLAI0mRfJZTmQ=
github.com/ebitengine/purego v0.8.1 h1:sdRKd6plj7KYW33EH5As6YKfe8m9zbN9JMrOjNVF/BE=
github.com/ebitengine/purego v0.8.1/go.mod h1:iIjxzd6CiRiOG0UyXP+V1+jWqUXVjPKLAI0mRfJZTmQ=
github.com/elastic/apm-aggregation v1.2.0 h1:UndqG3ccBTjyxTqHujBVjcbVLb9qG1clxRcrp9JRelI=
github.com/elastic/apm-aggregation v1.2.0/go.mod h1:YllYwPYVV27pbuPfjRtQAKo6eSSrh13PZr38RKYd810=
github.com/elastic/apm-data v1.16.0 h1:LkJFoNkadIyqXNo3EMm98J38j9HWDMWUe6F74GaXtJ4=
github.com/elastic/apm-data v1.16.0/go.mod h1:ST2P1yshhN2U3IbBYyn+Ni3VOFTifavNzMfh7E9zLHY=
github.com/elastic/beats/v7 v7.0.0-alpha2.0.20241231140711-7806f1a2cb26 h1:qyI4AIRfdnTwesqHN9KYdbGpcJ4m4lIKlR+f8zbKIO0=
github.com/elastic/beats/v7 v7.0.0-alpha2.0.20241231140711-7806f1a2cb26/go.mod h1:CgYrkUfXIWj/lcPc5ipnO0/2OEx4GmstkLzyUHilme8=
github.com/elastic/beats/v7 v7.0.0-alpha2.0.20250131124117-04eac62055e9 h1:yV4r4O/aVyPXvXhqxpeRqDyF5G+sy2CmTOKpBFOsXQM=
github.com/elastic/beats/v7 v7.0.0-alpha2.0.20250131124117-04eac62055e9/go.mod h1:84zbls1RDKu/SHmRykLUkpaF0ZVme7P+TCDV6mZ7sKw=
github.com/elastic/elastic-agent-autodiscover v0.9.0 h1:+iWIKh0u3e8I+CJa3FfWe9h0JojNasPgYIA47gpuuns=
github.com/elastic/elastic-agent-autodiscover v0.9.0/go.mod h1:5iUxLHhVdaGSWYTveSwfJEY4RqPXTG13LPiFoxcpFd4=
github.com/elastic/elastic-agent-client/v7 v7.17.0 h1:TPLrEHF4kJ3RkmQzZPffrniY4WeW4vriHZbOAzM1hFo=
Expand All @@ -139,8 +139,8 @@ github.com/elastic/go-elasticsearch/v8 v8.17.0 h1:e9cWksE/Fr7urDRmGPGp47Nsp4/mvN
github.com/elastic/go-elasticsearch/v8 v8.17.0/go.mod h1:lGMlgKIbYoRvay3xWBeKahAiJOgmFDsjZC39nmO3H64=
github.com/elastic/go-lumber v0.1.2-0.20220819171948-335fde24ea0f h1:TsPpU5EAwlt7YZoupKlxZ093qTZYdGou3EhfTF1U0B4=
github.com/elastic/go-lumber v0.1.2-0.20220819171948-335fde24ea0f/go.mod h1:HHaWnZamYKWsR9/eZNHqRHob8iQDKnchHmmskT/SKko=
github.com/elastic/go-structform v0.0.10 h1:oy08o/Ih2hHTkNcRY/1HhaYvIp5z6t8si8gnCJPDo1w=
github.com/elastic/go-structform v0.0.10/go.mod h1:CZWf9aIRYY5SuKSmOhtXScE5uQiLZNqAFnwKR4OrIM4=
github.com/elastic/go-structform v0.0.12 h1:HXpzlAKyej8T7LobqKDThUw7BMhwV6Db24VwxNtgxCs=
github.com/elastic/go-structform v0.0.12/go.mod h1:CZWf9aIRYY5SuKSmOhtXScE5uQiLZNqAFnwKR4OrIM4=
github.com/elastic/go-sysinfo v1.15.0 h1:54pRFlAYUlVNQ2HbXzLVZlV+fxS7Eax49stzg95M4Xw=
github.com/elastic/go-sysinfo v1.15.0/go.mod h1:jPSuTgXG+dhhh0GKIyI2Cso+w5lPJ5PvVqKlL8LV/Hk=
github.com/elastic/go-ucfg v0.8.8 h1:54KIF/2zFKfl0MzsSOCGOsZ3O2bnjFQJ0nDJcLhviyk=
Expand Down Expand Up @@ -355,8 +355,8 @@ github.com/rogpeppe/go-internal v1.13.1/go.mod h1:uMEvuHeurkdAXX61udpOXGD/AzZDWN
github.com/russross/blackfriday/v2 v2.1.0/go.mod h1:+Rmxgy9KzJVeS9/2gXHxylqXiyQDYRxCVz55jmeOWTM=
github.com/ryanuber/go-glob v1.0.0 h1:iQh3xXAumdQ+4Ufa5b25cRpC5TYKlno6hsv6Cb3pkBk=
github.com/ryanuber/go-glob v1.0.0/go.mod h1:807d1WSdnB0XRJzKNil9Om6lcp/3a0v4qIHxIXzX/Yc=
github.com/shirou/gopsutil/v4 v4.24.9 h1:KIV+/HaHD5ka5f570RZq+2SaeFsb/pq+fp2DGNWYoOI=
github.com/shirou/gopsutil/v4 v4.24.9/go.mod h1:3fkaHNeYsUFCGZ8+9vZVWtbyM1k2eRnlL+bWO8Bxa/Q=
github.com/shirou/gopsutil/v4 v4.24.10 h1:7VOzPtfw/5YDU+jLEoBwXwxJbQetULywoSV4RYY7HkM=
github.com/shirou/gopsutil/v4 v4.24.10/go.mod h1:s4D/wg+ag4rG0WO7AiTj2BeYCRhym0vM7DHbZRxnIT8=
github.com/sirupsen/logrus v1.4.2/go.mod h1:tLMulIdttU9McNUspp0xgXVQah82FyeX6MwdIuYE2rE=
github.com/spf13/cobra v1.8.1 h1:e5/vxKd/rZsfSJMUX1agtjeTDf+qv1/JdBF8gg5k9ZM=
github.com/spf13/cobra v1.8.1/go.mod h1:wHxEcudfqmLYa8iTfL+OuZPbBZkmvliBWKIezN3kD9Y=
Expand Down Expand Up @@ -426,8 +426,8 @@ go.opentelemetry.io/collector/pdata v1.24.0 h1:D6j92eAzmAbQgivNBUnt8r9juOl8ugb+i
go.opentelemetry.io/collector/pdata v1.24.0/go.mod h1:cf3/W9E/uIvPS4MR26SnMFJhraUCattzzM6qusuONuc=
go.opentelemetry.io/collector/semconv v0.116.0 h1:63xCZomsKJAWmKGWD3lnORiE3WKW6AO4LjnzcHzGx3Y=
go.opentelemetry.io/collector/semconv v0.116.0/go.mod h1:N6XE8Q0JKgBN2fAhkUQtqK9LT7rEGR6+Wu/Rtbal1iI=
go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp v0.54.0 h1:TT4fX+nBOA/+LUkobKGW1ydGcn+G3vRw9+g5HwCphpk=
go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp v0.54.0/go.mod h1:L7UH0GbB0p47T4Rri3uHjbpCFYrVrwc1I25QhNPiGK8=
go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp v0.56.0 h1:UP6IpuHFkUgOQL9FFQFrZ+5LiwhhYRbi7VZSIx6Nj5s=
go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp v0.56.0/go.mod h1:qxuZLtbq5QDtdeSHsS7bcf6EH6uO6jUAgk764zd3rhM=
go.opentelemetry.io/otel v1.34.0 h1:zRLXxLCgL1WyKsPVrgbSdMN4c0FMkDAskSTQP+0hdUY=
go.opentelemetry.io/otel v1.34.0/go.mod h1:OWFPOQ+h4G8xpyjgqo4SxJYdDQ/qmRH+wivy7zzx9oI=
go.opentelemetry.io/otel/metric v1.34.0 h1:+eTR3U0MyfWjRDhmFMxe2SsW64QrZ84AOhvqS7Y+PoQ=
Expand Down
7 changes: 6 additions & 1 deletion internal/beatcmd/beat_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -563,7 +563,12 @@ func TestRunManager_Reloader_newRunnerError(t *testing.T) {
require.NoError(t, err)
defer manager.Stop()

assert.Equal(t, "failed to load input config: newRunner error", <-inputFailedMsg)
select {
case msg := <-inputFailedMsg:
assert.Equal(t, "failed to load input config: newRunner error", msg)
case <-time.After(10 * time.Second):
t.Fatal("timed out waiting for input failed msg")
}
}

func runBeat(t testing.TB, beat *Beat) (stop func() error) {
Expand Down
13 changes: 6 additions & 7 deletions internal/beatcmd/reloader.go
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,6 @@ import (
"fmt"
"sync"

"github.com/joeshaw/multierror"
"go.elastic.co/apm/module/apmotel/v2"
"go.opentelemetry.io/otel/metric"
"golang.org/x/sync/errgroup"
Expand Down Expand Up @@ -138,15 +137,15 @@ func (r *Reloader) Run(ctx context.Context) error {
// Note: reloadInputs may be called before the Reloader is running.
func (r *Reloader) reloadInputs(configs []*reload.ConfigWithMeta) error {
if n := len(configs); n != 1 {
var errs multierror.Errors
var errs []error
for _, cfg := range configs {
unitErr := cfgfile.UnitError{
Err: fmt.Errorf("only 1 input supported, got %d", n),
UnitID: cfg.InputUnitID,
}
errs = append(errs, unitErr)
}
return errs.Err()
return errors.Join(errs...)
}
r.mu.Lock()
defer r.mu.Unlock()
Expand All @@ -156,21 +155,21 @@ func (r *Reloader) reloadInputs(configs []*reload.ConfigWithMeta) error {
// increasing revision number.
revision, err := cfg.Int("revision", -1)
if err != nil {
return multierror.Errors{
return errors.Join(
cfgfile.UnitError{
Err: fmt.Errorf("failed to extract input config revision: %w", err),
UnitID: configs[0].InputUnitID,
},
}.Err()
)
}

if err := r.reload(cfg, r.outputConfig, r.apmTracingConfig); err != nil {
return multierror.Errors{
return errors.Join(
cfgfile.UnitError{
Err: fmt.Errorf("failed to load input config: %w", err),
UnitID: configs[0].InputUnitID,
},
}.Err()
)
}
r.inputConfig = cfg
r.logger.With(logp.Int64("revision", revision)).Info("loaded input config")
Expand Down
4 changes: 2 additions & 2 deletions internal/beatcmd/reloader_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@ func TestReloader(t *testing.T) {
err = registry.GetInputList().Reload([]*reload.ConfigWithMeta{{
Config: config.MustNewConfigFrom(`{}`),
}})
assert.EqualError(t, err, "1 error: failed to extract input config revision: missing field accessing 'revision'")
assert.EqualError(t, err, "failed to extract input config revision: missing field accessing 'revision'")
assertNoReload()

err = registry.GetInputList().Reload([]*reload.ConfigWithMeta{{
Expand Down Expand Up @@ -119,7 +119,7 @@ func TestReloader(t *testing.T) {
err = registry.GetInputList().Reload([]*reload.ConfigWithMeta{{
Config: config.MustNewConfigFrom(`{"revision": 2, "error": true}`),
}})
assert.EqualError(t, err, "1 error: failed to load input config: no runner for you")
assert.EqualError(t, err, "failed to load input config: no runner for you")
assertNoReload() // error occurred during reload, nothing changes
expectNoEvent(t, r1.stopped, "runner should not have been stopped")

Expand Down
31 changes: 10 additions & 21 deletions internal/elasticsearch/config_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -26,10 +26,8 @@ import (
"strings"
"testing"

// Imported to ensure the type data is available for reflection.
_ "github.com/elastic/beats/v7/libbeat/outputs/elasticsearch"
libbeates "github.com/elastic/beats/v7/libbeat/outputs/elasticsearch"

"github.com/modern-go/reflect2"
"github.com/stretchr/testify/assert"
"github.com/stretchr/testify/require"
)
Expand Down Expand Up @@ -101,31 +99,22 @@ func TestAddresses(t *testing.T) {
// TestBeatsConfigSynced helps ensure that our elasticsearch.Config struct is
// kept in sync with the config defined in libbeat/outputs/elasticsearch.
func TestBeatsConfigSynced(t *testing.T) {
libbeatType, _ := reflect2.TypeByPackageName(
"github.com/elastic/beats/v7/libbeat/outputs/elasticsearch",
"elasticsearchConfig",
).(reflect2.StructType)
require.NotNil(t, libbeatType)

localType, _ := reflect2.TypeByPackageName(
"github.com/elastic/apm-server/internal/elasticsearch",
"Config",
).(reflect2.StructType)
require.NotNil(t, localType)
libbeatType := reflect.TypeOf(libbeates.ElasticsearchConfig{})
localType := reflect.TypeOf(Config{})

type structField struct {
reflect2.StructField
reflect.StructField
structTag reflect.StructTag
}
getStructFields := func(typ reflect2.StructType) map[string]structField {
getStructFields := func(typ reflect.Type) map[string]structField {
out := make(map[string]structField)
for i := typ.NumField() - 1; i >= 0; i-- {
field := structField{StructField: typ.Field(i)}
field.structTag = field.Tag()
field.structTag = field.Tag
configTag := strings.Split(field.structTag.Get("config"), ",")
configName := configTag[0]
if configName == "" {
configName = strings.ToLower(field.Name())
configName = strings.ToLower(field.Name)
}
out[configName] = field
}
Expand Down Expand Up @@ -160,10 +149,10 @@ func TestBeatsConfigSynced(t *testing.T) {
libbeatStructField := libbeatStructFields[name]
assert.Equal(t, localStructField.structTag, libbeatStructField.structTag)
assert.Equal(t,
localStructField.Type(),
libbeatStructField.Type(),
localStructField.Type,
libbeatStructField.Type,
fmt.Sprintf("expected type %s for config field %q, got %s",
libbeatStructField.Type(), name, localStructField.Type(),
libbeatStructField.Type, name, localStructField.Type,
),
)
delete(libbeatStructFields, name)
Expand Down

0 comments on commit 826c2bb

Please sign in to comment.