Skip to content

Commit

Permalink
Do not watch monitors (#27192)
Browse files Browse the repository at this point in the history
  • Loading branch information
michalpristas authored Aug 3, 2021
1 parent 51027bd commit 335e99f
Showing 1 changed file with 10 additions and 2 deletions.
12 changes: 10 additions & 2 deletions x-pack/elastic-agent/pkg/agent/operation/operator.go
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ import (
"github.com/elastic/beats/v7/x-pack/elastic-agent/pkg/core/app"
"github.com/elastic/beats/v7/x-pack/elastic-agent/pkg/core/logger"
"github.com/elastic/beats/v7/x-pack/elastic-agent/pkg/core/monitoring"
"github.com/elastic/beats/v7/x-pack/elastic-agent/pkg/core/monitoring/noop"
"github.com/elastic/beats/v7/x-pack/elastic-agent/pkg/core/plugin/process"
"github.com/elastic/beats/v7/x-pack/elastic-agent/pkg/core/plugin/service"
"github.com/elastic/beats/v7/x-pack/elastic-agent/pkg/core/server"
Expand Down Expand Up @@ -293,6 +294,13 @@ func (o *Operator) getApp(p Descriptor) (Application, error) {
// TODO: (michal) join args into more compact options version
var a Application
var err error

monitor := o.monitor
if app.IsSidecar(p) {
// make watchers unmonitorable
monitor = noop.NewMonitor()
}

if p.ServicePort() == 0 {
// Applications without service ports defined are ran as through the process application type.
a, err = process.NewApplication(
Expand All @@ -306,7 +314,7 @@ func (o *Operator) getApp(p Descriptor) (Application, error) {
o.config,
o.logger,
o.reporter,
o.monitor,
monitor,
o.statusController)
} else {
// Service port is defined application is ran with service application type, with it fetching
Expand All @@ -323,7 +331,7 @@ func (o *Operator) getApp(p Descriptor) (Application, error) {
o.config,
o.logger,
o.reporter,
o.monitor,
monitor,
o.statusController)
}

Expand Down

0 comments on commit 335e99f

Please sign in to comment.