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

feat(profiling): Run profiling on self-hosted #2154

Merged
merged 29 commits into from
Jun 2, 2023

Conversation

phacops
Copy link
Contributor

@phacops phacops commented May 17, 2023

This PR aims to add support for profiling on self-hosted.

Fixes #1838.

@phacops phacops mentioned this pull request May 17, 2023
5 tasks
Copy link
Collaborator

@aldy505 aldy505 left a comment

Choose a reason for hiding this comment

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

I don't see any configuration for integrating it with the web or snuba containers? Or is it meant to be just like this? I'd like to try it on my own server 😄

docker-compose.yml Outdated Show resolved Hide resolved
@phacops
Copy link
Contributor Author

phacops commented May 17, 2023

@aldy505 Good point, I added those.

@phacops
Copy link
Contributor Author

phacops commented May 17, 2023

We might need to wait for getsentry/snuba#4195.

docker-compose.yml Outdated Show resolved Hide resolved
@phacops phacops requested review from aldy505 and a team and removed request for aldy505 May 18, 2023 15:15
Copy link
Collaborator

@aldy505 aldy505 left a comment

Choose a reason for hiding this comment

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

Actually I'm a bit curious about the SENTRY_DSN environment variable that can be applied to snuba and vroom container. If they're left empty, I suppose no error message will be sent to the internal project of people's self-hosted instance.

Vroom's defined here: https://github.com/getsentry/vroom/blob/c2cf9653f5bb9b2e4a02f0548956b790547e9048/cmd/vroom/config.go#L8

Comment on lines 286 to 291
snuba-profiling-profiles-consumer:
<<: *snuba_defaults
command: consumer --storage profiles --auto-offset-reset=latest --max-batch-time-ms 1000 --no-strict-offset-reset
snuba-profiling-functions-consumer:
<<: *snuba_defaults
command: consumer --storage functions --auto-offset-reset=latest --max-batch-time-ms 1000 --no-strict-offset-reset
Copy link
Collaborator

Choose a reason for hiding this comment

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

Should these be added to the list of sentry image's depends_on field?

Here:

snuba-consumer:
<<: *depends_on-default
snuba-outcomes-consumer:
<<: *depends_on-default
snuba-sessions-consumer:
<<: *depends_on-default
snuba-transactions-consumer:
<<: *depends_on-default
snuba-subscription-consumer-events:
<<: *depends_on-default
snuba-subscription-consumer-transactions:
<<: *depends_on-default

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I added vroom as a depends_on since web needs to POST to vroom, but then the consumers only depends on kafka technically. I think it's good like this.

docker-compose.yml Outdated Show resolved Hide resolved
docker-compose.yml Show resolved Hide resolved
Copy link
Member

@hubertdeng123 hubertdeng123 left a comment

Choose a reason for hiding this comment

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

Will profiling be released under CalVer? If so, would need to add VROOM to

sed -i -e "s/^\(SENTRY\|SNUBA\|RELAY\|SYMBOLICATOR\)_IMAGE=\([^:]\+\):.\+\$/\1_IMAGE=\2:$NEW_VERSION/" .env

docker-compose.yml Outdated Show resolved Hide resolved
docker-compose.yml Outdated Show resolved Hide resolved
@phacops
Copy link
Contributor Author

phacops commented May 23, 2023

Actually I'm a bit curious about the SENTRY_DSN environment variable that can be applied to snuba and vroom container. If they're left empty, I suppose no error message will be sent to the internal project of people's self-hosted instance.

That's correct, the Sentry SDK won't be activated and nothing will be sent. I was expecting the user to pass the right DSN via an environment variable. Do you know how other services are handling that?

@aldy505
Copy link
Collaborator

aldy505 commented May 23, 2023

That's correct, the Sentry SDK won't be activated and nothing will be sent. I was expecting the user to pass the right DSN via an environment variable. Do you know how other services are handling that?

We might as well need to ping @hubertdeng123 for help.

There is an "internal" project that should've been set up during the first install of Sentry, but I don't know on how to acquire the DSN and put it into the environment variable / configuration that can be consumed by Snuba and Vroom.

@hubertdeng123
Copy link
Member

There is an "internal" project that should've been set up during the first install of Sentry, but I don't know on how to acquire the DSN and put it into the environment variable / configuration that can be consumed by Snuba and Vroom.

Snuba is very similar, retrieves SENTRY_DSN from the environment. I've never played around with it before but it should just be possible to put it into the configuration through the docker-compose.yml file. I don't think this is a large concern for this PR though. For the record, looks like a DSN for the internal project can be shown by going to /settings/${org}/projects/internal/keys/

@aldy505
Copy link
Collaborator

aldy505 commented May 23, 2023

Snuba is very similar, retrieves SENTRY_DSN from the environment. I've never played around with it before but it should just be possible to put it into the configuration through the docker-compose.yml file. I don't think this is a large concern for this PR though. For the record, looks like a DSN for the internal project can be shown by going to /settings/${org}/projects/internal/keys/

I guess we can skip that one for now?

@hubertdeng123
Copy link
Member

I guess we can skip that one for now?

Yep

sentry-zookeeper"

before=$(get_volumes)

test "$before" == "" || test "$before" == "$expected_volumes"

source install/create-docker-volumes.sh
Copy link
Member

Choose a reason for hiding this comment

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

got it, safe to remove then

fixtures/envelope-with-profile.json Outdated Show resolved Hide resolved
Copy link
Member

@BYK BYK left a comment

Choose a reason for hiding this comment

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

🚀

_integration-test/run.sh Outdated Show resolved Hide resolved
docker-compose.yml Show resolved Hide resolved
Copy link
Member

@chadwhitacre chadwhitacre left a comment

Choose a reason for hiding this comment

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

Let's hold off on merging until we cut 23.5.2 (related to inc-389).

@hubertdeng123
Copy link
Member

23.5.2 is out now, this can be merged now

@chadwhitacre chadwhitacre self-requested a review May 31, 2023 20:56
Copy link
Collaborator

@aldy505 aldy505 left a comment

Choose a reason for hiding this comment

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

Just a little bit more..

Note about the exposed port: if you don't specify it as exposed port, that port will still be opened to other containers. Having a new exposed ports might cause a vulnerability for people who didn't set up a proper OS firewall.

docker-compose.yml Outdated Show resolved Hide resolved
docker-compose.yml Show resolved Hide resolved
docker-compose.yml Show resolved Hide resolved
Copy link
Collaborator

@aldy505 aldy505 left a comment

Choose a reason for hiding this comment

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

LGTM!

@phacops phacops enabled auto-merge (squash) June 2, 2023 13:44
@phacops phacops merged commit e07be38 into master Jun 2, 2023
@phacops phacops deleted the pierre/profiling-on-self-hosted branch June 2, 2023 13:58
@github-actions github-actions bot locked and limited conversation to collaborators Jul 1, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
Archived in project
Development

Successfully merging this pull request may close these issues.

Add Profiling
5 participants