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

Chore: Add pprof to otto server #658

Closed
wants to merge 1 commit into from

Conversation

StrongMonkey
Copy link
Contributor

Going to add pprof to be able to troubleshoot cpu usage in testing env.

@@ -15,6 +16,11 @@ import (
var log = logger.Package()

func Run(ctx context.Context, c services.Config) error {
go func() {
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 this to be always on? now that we have a released version, we probably want this off by default so that people aren't accidentally exposing debug info to the world.

Copy link
Member

@njhale njhale Nov 21, 2024

Choose a reason for hiding this comment

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

I'm a fan of leaving it on in production, because that's where we're most likely to run into issues that will require profiling info to resolve.

Is there's some other way to ensure we don't accidentally expose the port publicly?

Copy link
Contributor

Choose a reason for hiding this comment

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

I don't have an issue with us having it on in production per se, but we shouldn't expose it for everybody who might run a copy of otto themselves.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

it is fine, I can only run it behind an env variable 👍

@@ -15,6 +16,11 @@ import (
var log = logger.Package()

func Run(ctx context.Context, c services.Config) error {
go func() {
log.Infof("Starting pprof on :6060")
log.Errorf(http.ListenAndServe("localhost:6060", nil).Error())
Copy link
Member

Choose a reason for hiding this comment

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

pico-nit: The chance of one of us configuring otto8 wrong is basically zero, but if we wanted to be really pedantic, we could check c.HTTPListenPort and return an error if it conflicts with the pprof port

@StrongMonkey
Copy link
Contributor Author

This is already enabled through /debug/pprof, dropping.

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.

3 participants