Skip to content

Commit

Permalink
code review
Browse files Browse the repository at this point in the history
  • Loading branch information
jalvz committed May 7, 2020
1 parent 02ea305 commit b0af77d
Showing 1 changed file with 11 additions and 8 deletions.
19 changes: 11 additions & 8 deletions libbeat/cmd/instance/beat.go
Original file line number Diff line number Diff line change
Expand Up @@ -123,14 +123,7 @@ var debugf = logp.MakeDebug("beat")

func init() {
initRand()

// By default, the APM tracer is active. We switch behaviour to not require users to have
// an APM Server running, making it opt-in
if os.Getenv("ELASTIC_APM_ACTIVE") == "" {
os.Setenv("ELASTIC_APM_ACTIVE", "false")
}
// we need to close the default tracer to prevent the beat sending events to localhost:8200
apm.DefaultTracer.Close()
preventDefaultTracing()
}

// initRand initializes the runtime random number generator seed using
Expand All @@ -150,6 +143,16 @@ func initRand() {
rand.Seed(seed)
}

func preventDefaultTracing() {
// By default, the APM tracer is active. We switch behaviour to not require users to have
// an APM Server running, making it opt-in
if os.Getenv("ELASTIC_APM_ACTIVE") == "" {
os.Setenv("ELASTIC_APM_ACTIVE", "false")
}
// we need to close the default tracer to prevent the beat sending events to localhost:8200
apm.DefaultTracer.Close()
}

// Run initializes and runs a Beater implementation. name is the name of the
// Beat (e.g. packetbeat or metricbeat). version is version number of the Beater
// implementation. bt is the `Creator` callback for creating a new beater
Expand Down

0 comments on commit b0af77d

Please sign in to comment.