agent: Enable dumping telemetry on SIGUSR1

This commit is contained in:
Armon Dadgar 2014-02-20 13:51:51 -08:00
parent b3087aceb2
commit d0b044692b
1 changed files with 11 additions and 0 deletions

View File

@ -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