From e1f216522fa69586b4f0dc3015b2d0e3ff434e9e Mon Sep 17 00:00:00 2001 From: Anderson Queiroz Date: Wed, 15 Jun 2022 17:28:53 +0200 Subject: [PATCH] . --- CHANGELOG.next.asciidoc | 79 ------------------- .../application/pipeline/emitter/emitter.go | 1 + .../application/pipeline/router/router.go | 5 +- internal/pkg/agent/stateresolver/resolve.go | 4 +- .../pkg/agent/stateresolver/stateresolver.go | 4 +- internal/pkg/core/plugin/process/app.go | 7 -- 6 files changed, 8 insertions(+), 92 deletions(-) diff --git a/CHANGELOG.next.asciidoc b/CHANGELOG.next.asciidoc index a89584e2851..647ca078b64 100644 --- a/CHANGELOG.next.asciidoc +++ b/CHANGELOG.next.asciidoc @@ -176,85 +176,6 @@ - Update ack response schema and processing, add retrier for acks {pull}200[200] - Enhance error messages and logs for process start {pull}225[225] - Changed the default policy selection logic. When the agent has no policy id or name defined, it will fall back to defaults (defined by $FLEET_SERVER_POLICY_ID and $FLEET_DEFAULT_TOKEN_POLICY_NAME environment variables respectively). {issue}29774[29774] {pull}226[226] -- Fix rename *ConfigChange to *PolicyChange to align on changes in the UI. {pull-beats}20779[20779] -- Thread safe sorted set {pull-beats}21290[21290] -- Copy Action store on upgrade {pull-beats}21298[21298] -- Include inputs in action store actions {pull-beats}21298[21298] -- Fix issue where inputs without processors defined would panic {pull-beats}21628[21628] -- Prevent reporting ecs version twice {pull-beats}21616[21616] -- Partial extracted beat result in failure to spawn beat {issue-beats}21718[21718] -- Use symlink path for reexecutions {pull-beats}21835[21835] -- Use ML_SYSTEM to detect if agent is running as a service {pull-beats}21884[21884] -- Use local temp instead of system one {pull-beats}21883[21883] -- Rename monitoring index from `elastic.agent` to `elastic_agent` {pull-beats}21932[21932] -- Fix issue with named pipes on Windows 7 {pull-beats}21931[21931] -- Fix missing elastic_agent event data {pull-beats}21994[21994] -- Ensure shell wrapper path exists before writing wrapper on install {pull-beats}22144[22144] -- Fix deb/rpm packaging for Elastic Agent {pull-beats}22153[22153] -- Fix composable input processor promotion to fix duplicates {pull-beats}22344[22344] -- Fix sysv init files for deb/rpm installation {pull-beats}22543[22543] -- Fix shell wrapper for deb/rpm packaging {pull-beats}23038[23038] -- Fixed parsing of npipe URI {pull-beats}22978[22978] -- Select default agent policy if no enrollment token provided. {pull-beats}23973[23973] -- Remove artifacts on transient download errors {pull-beats}23235[23235] -- Support for linux/arm64 {pull-beats}23479[23479] -- Skip top level files when unziping archive during upgrade {pull-beats}23456[23456] -- Do not take ownership of Endpoint log path {pull-beats}23444[23444] -- Fixed fetching DBus service PID {pull-beats}23496[23496] -- Fix issue of missing log messages from filebeat monitor {pull-beats}23514[23514] -- Increase checkin grace period to 30 seconds {pull-beats}23568[23568] -- Fix libbeat from reporting back degraded on config update {pull-beats}23537[23537] -- Rewrite check if agent is running with admin rights on Windows {pull-beats}23970[23970] -- Fix issues with dynamic inputs and conditions {pull-beats}23886[23886] -- Fix bad substitution of API key. {pull-beats}24036[24036] -- Fix docker enrollment issue related to Fleet Server change. {pull-beats}24155[24155] -- Improve log on failure of Endpoint Security installation. {pull-beats}24429[24429] -- Verify communication to Kibana before updating Fleet client. {pull-beats}24489[24489] -- Fix nil pointer when null is generated as list item. {issue-beats}23734[23734] -- Add support for filestream input. {pull-beats}24820[24820] -- Add check for URL set when cert and cert key. {pull-beats}24904[24904] -- Fix install command for Fleet Server bootstrap, remove need for --enrollment-token when using --fleet-server {pull-beats}24981[24981] -- Respect host configuration for exposed processes endpoint {pull-beats}25114[25114] -- Set --inscure in container when FLEET_SERVER_ENABLE and FLEET_INSECURE set {pull-beats}25137[25137] -- Fixed: limit for retries to Kibana configurable {issue-beats}25063[25063] -- Fix issue with status and inspect inside of container {pull-beats}25204[25204] -- Remove FLEET_SERVER_POLICY_NAME env variable as it was not used {pull-beats}25149[25149] -- Reduce log level for listener cleanup to debug {pull-beats}25274 -- Passing in policy id to container command works {pull-beats}25352[25352] -- Reduce log level for listener cleanup to debug {pull-beats}25274[25274] -- Delay the restart of application when a status report of failure is given {pull-beats}25339[25339] -- Don't log when upgrade capability doesn't apply {pull-beats}25386[25386] -- Fixed issue when unversioned home is set and invoked watcher failing with ENOENT {issue-beats}25371[25371] -- Fixed Elastic Agent: expecting Dict and received *transpiler.Key for '0' {issue-beats}24453[24453] -- Fix AckBatch to do nothing when no actions passed {pull-beats}25562[25562] -- Add error log entry when listener creation fails {issue-beats}23483[23482] -- Handle case where policy doesn't contain Fleet connection information {pull-beats}25707[25707] -- Fix fleet-server.yml spec to not overwrite existing keys {pull-beats}25741[25741] -- Agent sends wrong log level to Endpoint {issue-beats}25583[25583] -- Fix startup with failing configuration {pull-beats}26057[26057] -- Change timestamp in elatic-agent-json.log to use UTC {issue-beats}25391[25391] -- Fix add support for Logstash output. {pull-beats}24305[24305] -- Do not log Elasticsearch configuration for monitoring output when running with debug. {pull-beats}26583[26583] -- Fix issue where proxy enrollment options broke enrollment command. {pull-beats}26749[26749] -- Remove symlink.prev from previously failed upgrade {pull-beats}26785[26785] -- Fix apm-server supported outputs not being in sync with supported output types. {pull-beats}26885[26885] -- Set permissions during installation {pull-beats}26665[26665] -- Disable monitoring during fleet-server bootstrapping. {pull-beats}27222[27222] -- Fix issue with atomic extract running in K8s {pull-beats}27396[27396] -- Fix issue with install directory in state path in K8s {pull-beats}27396[27396] -- Disable monitoring during fleet-server bootstrapping. {pull-beats}27222[27222] -- Change output.elasticsearch.proxy_disabled flag to output.elasticsearch.proxy_disable so fleet uses it. {issue-beats}27670[27670] {pull-beats}27671[27671] -- Add validation for certificate flags to ensure they are absolute paths. {pull-beats}27779[27779] -- Migrate state on upgrade {pull-beats}27825[27825] -- Add "_monitoring" suffix to monitoring instance names to remove ambiguity with the status command. {issue-beats}25449[25449] -- Ignore ErrNotExists when fixing permissions. {issue-beats}27836[27836] {pull-beats}27846[27846] -- Snapshot artifact lookup will use agent.download proxy settings. {issue-beats}27903[27903] {pull-beats}27904[27904] -- Fix lazy acker to only add new actions to the batch. {pull-beats}27981[27981] -- Allow HTTP metrics to run in bootstrap mode. Add ability to adjust timeouts for Fleet Server. {pull-beats}28260[28260] -- Fix agent configuration overwritten by default fleet config. {pull-beats}29297[29297] -- Allow agent containers to use basic auth to create a service token. {pull-beats}29651[29651] -- Fix issue where a failing artifact verification does not remove the bad artifact. {pull-beats}30281[30281] -- Reduce Elastic Agent shut down time by stopping processes concurrently {pull-beats}29650[29650] - Move `context cancelled` error from fleet gateway into debug level. {pull}187[187] - Update library containerd to 1.5.10. {pull}186[186] - Add fleet-server to output of elastic-agent inspect output command (and diagnostic bundle). {pull}243[243] diff --git a/internal/pkg/agent/application/pipeline/emitter/emitter.go b/internal/pkg/agent/application/pipeline/emitter/emitter.go index 7855fb51602..9dc7bd9038a 100644 --- a/internal/pkg/agent/application/pipeline/emitter/emitter.go +++ b/internal/pkg/agent/application/pipeline/emitter/emitter.go @@ -32,6 +32,7 @@ func New(ctx context.Context, log *logger.Logger, agentInfo *info.AgentInfo, con if err != nil { return nil, errors.New(err, "failed to start composable controller") } + return func(ctx context.Context, c *config.Config) (err error) { span, ctx := apm.StartSpan(ctx, "update", "app.internal") defer func() { diff --git a/internal/pkg/agent/application/pipeline/router/router.go b/internal/pkg/agent/application/pipeline/router/router.go index e1f1d63c8b5..bdb7703aa5c 100644 --- a/internal/pkg/agent/application/pipeline/router/router.go +++ b/internal/pkg/agent/application/pipeline/router/router.go @@ -51,8 +51,9 @@ func (r *router) Route(ctx context.Context, id string, grpProg map[pipeline.Rout for _, rk := range s.Keys() { active[rk] = true - // Are we already runnings this streams? - // When it doesn't exist we just create it, if it already exist we forward the configuration. + // Are we already running's this streams? + // When it doesn't exist we just create it, if it already exists we + // forward the configuration. p, ok := r.routes.Get(rk) var err error if !ok { diff --git a/internal/pkg/agent/stateresolver/resolve.go b/internal/pkg/agent/stateresolver/resolve.go index 5afe2256cb6..cd9adcdf86c 100644 --- a/internal/pkg/agent/stateresolver/resolve.go +++ b/internal/pkg/agent/stateresolver/resolve.go @@ -113,7 +113,7 @@ func converge(s state, cfg cfgReq) (state, []configrequest.Step) { } } - // What need to be started or updated. + // What needs to be started or updated. for _, p := range cfg.Programs() { a, found := s.Active[p.Identifier()] if !found { @@ -161,7 +161,7 @@ func converge(s state, cfg cfgReq) (state, []configrequest.Step) { } } - // What need to be updated. + // What needs to be updated. return newState, steps } diff --git a/internal/pkg/agent/stateresolver/stateresolver.go b/internal/pkg/agent/stateresolver/stateresolver.go index d63cc482cde..0980321c762 100644 --- a/internal/pkg/agent/stateresolver/stateresolver.go +++ b/internal/pkg/agent/stateresolver/stateresolver.go @@ -12,7 +12,7 @@ import ( "github.com/elastic/elastic-agent/pkg/core/logger" ) -// Acker allow to ack the should state from a converge operation. +// Acker allow to ack the state from a converge operation. type Acker func() // StateResolver is a resolver of a config state change @@ -52,7 +52,7 @@ func (s *StateResolver) Resolve( s.l.Debugf("step %d: %s", i, step.String()) } - // Allow the operator to ack the should state when applying the steps is done correctly. + // Allow the operator to ack the state when applying the steps is done correctly. ack := func() { s.ack(newState) } diff --git a/internal/pkg/core/plugin/process/app.go b/internal/pkg/core/plugin/process/app.go index acb38ee92df..8c0d320bb66 100644 --- a/internal/pkg/core/plugin/process/app.go +++ b/internal/pkg/core/plugin/process/app.go @@ -290,12 +290,8 @@ func (a *Application) gracefulKill(proc *process.Info) { a.logger.Errorf("failed to stop %s: %v", a.Name(), err) } - var wg sync.WaitGroup doneChan := make(chan struct{}) - wg.Add(1) go func() { - wg.Done() - if _, err := proc.Process.Wait(); err != nil { // process is not a child - some OSs requires process to be child a.externalProcess(proc.Process) @@ -303,9 +299,6 @@ func (a *Application) gracefulKill(proc *process.Info) { close(doneChan) }() - // wait for awaiter - wg.Wait() - // kill in case it's still running after timeout t := time.NewTimer(procExitTimeout) defer t.Stop()