mirror of
https://github.com/ergochat/ergo.git
synced 2024-11-25 21:39:25 +01:00
Integrate StackImpact profiling
This commit is contained in:
parent
2bd4d03ecc
commit
5c518531be
@ -173,6 +173,13 @@ func (sts *STSConfig) Value() string {
|
||||
return val
|
||||
}
|
||||
|
||||
// StackImpactConfig is the config used for StackImpact's profiling.
|
||||
type StackImpactConfig struct {
|
||||
Enabled bool
|
||||
AgentKey string `yaml:"agent-key"`
|
||||
AppName string `yaml:"app-name"`
|
||||
}
|
||||
|
||||
// Config defines the overall configuration.
|
||||
type Config struct {
|
||||
Network struct {
|
||||
@ -215,6 +222,10 @@ type Config struct {
|
||||
|
||||
Logging []LoggingConfig
|
||||
|
||||
Debug struct {
|
||||
StackImpact StackImpactConfig
|
||||
}
|
||||
|
||||
Limits struct {
|
||||
AwayLen uint `yaml:"awaylen"`
|
||||
ChanListModes uint `yaml:"chan-list-modes"`
|
||||
|
16
oragono.go
16
oragono.go
@ -16,6 +16,7 @@ import (
|
||||
"github.com/DanielOaks/oragono/irc/logger"
|
||||
"github.com/DanielOaks/oragono/mkcerts"
|
||||
"github.com/docopt/docopt-go"
|
||||
stackimpact "github.com/stackimpact/stackimpact-go"
|
||||
"golang.org/x/crypto/ssh/terminal"
|
||||
)
|
||||
|
||||
@ -107,6 +108,21 @@ Options:
|
||||
if !arguments["--quiet"].(bool) {
|
||||
logger.Info("startup", fmt.Sprintf("Oragono v%s starting", irc.SemVer))
|
||||
}
|
||||
|
||||
// profiling
|
||||
if config.Debug.StackImpact.Enabled {
|
||||
if config.Debug.StackImpact.AgentKey == "" || config.Debug.StackImpact.AppName == "" {
|
||||
logger.Error("startup", "Could not start StackImpact - agent-key or app-name are undefined")
|
||||
return
|
||||
}
|
||||
|
||||
agent := stackimpact.NewAgent()
|
||||
agent.Start(stackimpact.Options{AgentKey: config.Debug.StackImpact.AgentKey, AppName: config.Debug.StackImpact.AppName})
|
||||
defer agent.RecordPanic()
|
||||
|
||||
logger.Info("startup", fmt.Sprintf("StackImpact profiling started as %s", config.Debug.StackImpact.AppName))
|
||||
}
|
||||
|
||||
server, err := irc.NewServer(configfile, config, logger)
|
||||
if err != nil {
|
||||
logger.Error("startup", fmt.Sprintf("Could not load server: %s", err.Error()))
|
||||
|
13
oragono.yaml
13
oragono.yaml
@ -236,6 +236,19 @@ logging:
|
||||
type: localconnect localconnect-ip
|
||||
level: debug
|
||||
|
||||
# debug options
|
||||
debug:
|
||||
# enabling StackImpact profiling
|
||||
stackimpact:
|
||||
# whether to use StackImpact
|
||||
enabled: false
|
||||
|
||||
# the AgentKey to use
|
||||
agent-key: examplekeyhere
|
||||
|
||||
# the app name to report
|
||||
app-name: Oragono
|
||||
|
||||
# datastore configuration
|
||||
datastore:
|
||||
# path to the datastore
|
||||
|
Loading…
Reference in New Issue
Block a user