Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add pprof config and start up logic #478

Merged
merged 3 commits into from
Dec 22, 2017
Merged

add pprof config and start up logic #478

merged 3 commits into from
Dec 22, 2017

Conversation

wxing1292
Copy link
Contributor

No description provided.

@wxing1292 wxing1292 self-assigned this Dec 21, 2017
@coveralls
Copy link

Coverage Status

Coverage increased (+0.02%) to 66.638% when pulling 6739ea4 on pprof into 26303d5 on master.


type (
// PProfInitializer initialize the pprof based on config
PProfInitializer interface {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do we need an interface for this? We will likely only ever have one implementation. We can just use the struct directly.

Copy link
Contributor Author

@wxing1292 wxing1292 Dec 21, 2017

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

i am keeping the interface since every else is using a interface / impl pattern.
and i agree that the interface is redundant......

}

// Initialize the pprof based on config
func (initializer *PProfInitializerImpl) Initialize() error {
Copy link
Contributor

@madhuravi madhuravi Dec 21, 2017

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: We often use "Start" for this and have that method on a lot of our structures. I would recommend naming this Start as well to keep it consistent. Will leave it to you to decide.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

sure

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

changed to start

)

// NewInitializer create a new instance of PProf Initializer
func (cfg *PProf) NewInitializer(logger bark.Logger) *PProfInitializerImpl {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I would rather have a method NewInitializer(cfg *PProf, logger bark.Logger). That's how we do it everywhere and not much reason for this to be a member of PProf.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I see why you did this now w.r.t other members in the config. The reason this one seems weird is PProf is a config struct. We use config to create a NewInitializer, seems to fit more as a parameter using which a new initializer is created.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

in common/service, rpc.go and ringpop.go are using the same pattern.....
seems i should follow the same pattern....

host/onebox.go Outdated
ports = append(ports, port)
}

c.logger.Infof("History pprof prots: %v", ports)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: typo prots->ports

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do we want to log this? Other ones aren't being logged.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

the server, when starts, actually shows the address and port:
INFO[2017-12-21T15:23:09-08:00] Created RPC dispatcher for 'cadence-matching' and listening at '127.0.0.1:7935'
INFO[2017-12-21T15:23:09-08:00] Created RPC dispatcher for 'cadence-frontend' and listening at '127.0.0.1:7933'
INFO[2017-12-21T15:23:09-08:00] Created RPC dispatcher for 'cadence-history' and listening at '127.0.0.1:7934'

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

typo updated

Copy link
Contributor

@madhuravi madhuravi left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good overall. Mostly minor comments.

@@ -116,6 +119,10 @@ func (h *serviceImpl) Start() {
h.metricsScope.Counter(metrics.RestartCount).Inc(1)
h.runtimeMetricsReporter.Start()

if err := h.pprofInitializer.Initialize(); err != nil {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You probably want to allow service startup if the pprof initializer is not set.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

fixed

@coveralls
Copy link

Coverage Status

Coverage decreased (-0.04%) to 66.577% when pulling acb8583 on pprof into 26303d5 on master.

@coveralls
Copy link

Coverage Status

Coverage decreased (-0.07%) to 66.577% when pulling 1814aac on pprof into 3c1e5bb on master.

@wxing1292 wxing1292 merged commit 1fdb543 into master Dec 22, 2017
@wxing1292 wxing1292 deleted the pprof branch December 22, 2017 01:25
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants