Add memory profiling for custom builds (#5584)

This commit is contained in:
Jim Kalafut
2018-10-31 11:11:45 -07:00
committed by GitHub
parent 0624908d8a
commit b2ead22689
4 changed files with 66 additions and 6 deletions

View File

@@ -20,12 +20,6 @@ import (
"sync"
"time"
"github.com/mitchellh/cli"
testing "github.com/mitchellh/go-testing-interface"
"github.com/posener/complete"
"google.golang.org/grpc/grpclog"
"github.com/armon/go-metrics"
"github.com/armon/go-metrics/circonus"
"github.com/armon/go-metrics/datadog"
@@ -49,11 +43,17 @@ import (
"github.com/hashicorp/vault/vault"
vaultseal "github.com/hashicorp/vault/vault/seal"
"github.com/hashicorp/vault/version"
"github.com/mitchellh/cli"
testing "github.com/mitchellh/go-testing-interface"
"github.com/posener/complete"
"google.golang.org/grpc/grpclog"
)
var _ cli.Command = (*ServerCommand)(nil)
var _ cli.CommandAutocomplete = (*ServerCommand)(nil)
var memProfilerEnabled = false
const storageMigrationLock = "core/migration"
type ServerCommand struct {
@@ -431,6 +431,10 @@ func (c *ServerCommand) Run(args []string) int {
log: os.Getenv("VAULT_GRPC_LOGGING") != "",
})
if memProfilerEnabled {
c.startMemProfiler()
}
// Ensure that a backend is provided
if config.Storage == nil {
c.UI.Output("A storage backend must be specified")