diff --git a/base/constants.go b/base/constants.go index ed02018fce..ca804d9533 100644 --- a/base/constants.go +++ b/base/constants.go @@ -154,6 +154,9 @@ const ( // ServerlessChannelLimit is hard limit on channels allowed per user when running in serverless mode ServerlessChannelLimit = 500 + + // FromConnStrWarningThreshold determines the amount of time it should take before we warn about parsing a connstr (mostly for DNS resolution) + FromConnStrWarningThreshold = 10 * time.Second ) const ( diff --git a/base/dcp_client.go b/base/dcp_client.go index 46547ec52b..a973e7dd38 100644 --- a/base/dcp_client.go +++ b/base/dcp_client.go @@ -320,10 +320,17 @@ func (dc *DCPClient) initAgent(spec BucketSpec) error { } agentConfig := gocbcore.DCPAgentConfig{} + DebugfCtx(context.TODO(), KeyAll, "Parsing cluster connection string %q", UD(connStr)) + beforeFromConnStr := time.Now() connStrError := agentConfig.FromConnStr(connStr) if connStrError != nil { return fmt.Errorf("Unable to start DCP Client - error building conn str: %v", connStrError) } + if d := time.Since(beforeFromConnStr); d > FromConnStrWarningThreshold { + WarnfCtx(context.TODO(), "Parsed cluster connection string %q in: %v", UD(connStr), d) + } else { + DebugfCtx(context.TODO(), KeyAll, "Parsed cluster connection string %q in: %v", UD(connStr), d) + } auth, authErr := spec.GocbcoreAuthProvider() if authErr != nil { diff --git a/rest/server_context.go b/rest/server_context.go index 2cb270627e..3166947dd1 100644 --- a/rest/server_context.go +++ b/rest/server_context.go @@ -1523,10 +1523,17 @@ func initClusterAgent(ctx context.Context, clusterAddress, clusterUser, clusterP }, } + base.DebugfCtx(ctx, base.KeyAll, "Parsing cluster connection string %q", base.UD(clusterAddress)) + beforeFromConnStr := time.Now() err = config.FromConnStr(clusterAddress) if err != nil { return nil, err } + if d := time.Since(beforeFromConnStr); d > base.FromConnStrWarningThreshold { + base.WarnfCtx(ctx, "Parsed cluster connection string %q in: %v", base.UD(clusterAddress), d) + } else { + base.DebugfCtx(ctx, base.KeyAll, "Parsed cluster connection string %q in: %v", base.UD(clusterAddress), d) + } agent, err := gocbcore.CreateAgent(&config) if err != nil { @@ -1838,9 +1845,9 @@ func (sc *ServerContext) Database(ctx context.Context, name string) *db.Database } func (sc *ServerContext) initializeCouchbaseServerConnections(ctx context.Context) error { - base.InfofCtx(ctx, base.KeyAll, "initializing server connections") + base.InfofCtx(ctx, base.KeyAll, "Initializing server connections") defer func() { - base.InfofCtx(ctx, base.KeyAll, "finished initializing server connections") + base.InfofCtx(ctx, base.KeyAll, "Finished initializing server connections") }() goCBAgent, err := sc.initializeGoCBAgent(ctx) if err != nil {