mirror of https://github.com/status-im/consul.git
agent: Enable dumping telemetry on SIGUSR1
This commit is contained in:
parent
b3087aceb2
commit
d0b044692b
|
@ -3,6 +3,7 @@ package agent
|
|||
import (
|
||||
"flag"
|
||||
"fmt"
|
||||
"github.com/armon/go-metrics"
|
||||
"github.com/hashicorp/logutils"
|
||||
"github.com/mitchellh/cli"
|
||||
"io"
|
||||
|
@ -187,6 +188,16 @@ func (c *Command) Run(args []string) int {
|
|||
return 1
|
||||
}
|
||||
|
||||
/* Setup telemetry
|
||||
Aggregate on 10 second intervals for 1 minute. Expose the
|
||||
metrics over stderr when there is a SIGUSR1 received.
|
||||
*/
|
||||
inm := metrics.NewInmemSink(10*time.Second, time.Minute)
|
||||
metrics.DefaultInmemSignal(inm)
|
||||
metricsConf := metrics.DefaultConfig("consul")
|
||||
metricsConf.EnableHostname = false
|
||||
metrics.NewGlobal(metricsConf, inm)
|
||||
|
||||
// Create the agent
|
||||
if err := c.setupAgent(config, logOutput, logWriter); err != nil {
|
||||
return 1
|
||||
|
|
Loading…
Reference in New Issue