Skip to content
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

[Do not merge] Bug investigation #3507

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 4 additions & 1 deletion internal/pkg/monitor/subscription_monitor.go
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
"time"

"github.com/elastic/fleet-server/v7/internal/pkg/es"
"github.com/elastic/fleet-server/v7/internal/pkg/sleep"
"github.com/elastic/fleet-server/v7/internal/pkg/sqn"
"github.com/rs/zerolog"

Expand Down Expand Up @@ -116,7 +117,9 @@
// Run starts the Monitor.
func (m *monitorT) Run(ctx context.Context) (err error) {
g, gctx := errgroup.WithContext(ctx)

sleep.WithContext(ctx, 500*time.Millisecond)

Check failure on line 120 in internal/pkg/monitor/subscription_monitor.go

View workflow job for this annotation

GitHub Actions / lint (linux)

Error return value of `sleep.WithContext` is not checked (errcheck)
zerolog.Ctx(ctx).Info().
Str("ctx", "subscription monitor").Msg("run subscription monitor")
g.Go(func() error {
return m.sm.Run(gctx)
})
Expand Down
4 changes: 4 additions & 0 deletions internal/pkg/server/agent.go
Original file line number Diff line number Diff line change
Expand Up @@ -86,6 +86,7 @@

// Run starts a Server instance using config from the configured client.
func (a *Agent) Run(ctx context.Context) error {
sleep.WithContext(ctx, 500*time.Millisecond)

Check failure on line 89 in internal/pkg/server/agent.go

View workflow job for this annotation

GitHub Actions / lint (linux)

Error return value of `sleep.WithContext` is not checked (errcheck)
log := zerolog.Ctx(ctx)
a.agent.RegisterDiagnosticHook("fleet-server config", "fleet-server's current configuration", "fleet-server.yml", "application/yml", func() []byte {
a.l.RLock()
Expand Down Expand Up @@ -422,10 +423,12 @@
}

if expAPMCFG := expInput.APMConfig; expAPMCFG != nil {
zerolog.Ctx(ctx).Info().Any("expAPMCFG", expAPMCFG).Msg("apm config to instrumentation")
instrumentationCfg, err := apmConfigToInstrumentation(expAPMCFG)
if err != nil {
zerolog.Ctx(ctx).Warn().Err(err).Msg("Unable to parse expected APM config as instrumentation config")
} else {
zerolog.Ctx(ctx).Info().Any("instrumentationCfg", instrumentationCfg).Any("cfgData before", cfgData).Msg("instrumentation cfg")
obj := map[string]interface{}{
"inputs": []interface{}{map[string]interface{}{
"server": map[string]interface{}{
Expand All @@ -437,6 +440,7 @@
if err != nil {
zerolog.Ctx(ctx).Warn().Err(err).Msg("Failed to merge APM config into cfgData")
}
zerolog.Ctx(ctx).Info().Any("cfgData after", cfgData).Msg("merged new instrumentation config to cfgData")
}

}
Expand Down
6 changes: 4 additions & 2 deletions internal/pkg/server/fleet.go
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
"time"

"github.com/elastic/elastic-agent-client/v7/pkg/client"
"github.com/elastic/fleet-server/v7/internal/pkg/sleep"
"github.com/elastic/fleet-server/v7/internal/pkg/state"

"go.elastic.co/apm/v2"
Expand Down Expand Up @@ -76,6 +77,7 @@

// Run runs the fleet server
func (f *Fleet) Run(ctx context.Context, initCfg *config.Config) error {
sleep.WithContext(ctx, 500*time.Millisecond)

Check failure on line 80 in internal/pkg/server/fleet.go

View workflow job for this annotation

GitHub Actions / lint (linux)

Error return value of `sleep.WithContext` is not checked (errcheck)
log := zerolog.Ctx(ctx)
err := initCfg.LoadServerLimits()
if err != nil {
Expand Down Expand Up @@ -179,7 +181,7 @@
stop(srvCancel, srvEg)
select {
case err := <-ech:
log.Debug().Err(err).Msg("Server stopped intercepted expected context cancel error.")
log.Info().Err(err).Msg("Server stopped intercepted expected context cancel error.")
case <-time.After(time.Second * 5):
log.Warn().Msg("Server stopped expected context cancel error missing.")
}
Expand Down Expand Up @@ -285,7 +287,7 @@
func loggedRunFunc(ctx context.Context, tag string, runfn runFunc) func() error {
log := zerolog.Ctx(ctx)
return func() error {
log.Debug().Msg(tag + " started")
log.Info().Msg(tag + " started")

err := runfn(ctx)

Expand Down
Loading