mirror of https://github.com/hashicorp/consul
agent: Enable dumping telemetry on SIGUSR1
parent
b3087aceb2
commit
d0b044692b
|
@ -3,6 +3,7 @@ package agent
|
||||||
import (
|
import (
|
||||||
"flag"
|
"flag"
|
||||||
"fmt"
|
"fmt"
|
||||||
|
"github.com/armon/go-metrics"
|
||||||
"github.com/hashicorp/logutils"
|
"github.com/hashicorp/logutils"
|
||||||
"github.com/mitchellh/cli"
|
"github.com/mitchellh/cli"
|
||||||
"io"
|
"io"
|
||||||
|
@ -187,6 +188,16 @@ func (c *Command) Run(args []string) int {
|
||||||
return 1
|
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
|
// Create the agent
|
||||||
if err := c.setupAgent(config, logOutput, logWriter); err != nil {
|
if err := c.setupAgent(config, logOutput, logWriter); err != nil {
|
||||||
return 1
|
return 1
|
||||||
|
|
Loading…
Reference in New Issue