Skip to content

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

Merged
phacops merged 29 commits into
masterfrom
pierre/profiling-on-self-hosted
Jun 2, 2023
Merged

phacops merged 29 commits into
masterfrom
pierre/profiling-on-self-hosted

Conversation

@phacops

@phacops phacops commented May 17, 2023 •

Copy link
Copy Markdown
Contributor

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

Fixes #1838.

@phacops phacops mentioned this pull request May 17, 2023
5 tasks done
@phacops
phacops requested a review from hubertdeng123 May 17, 2023 13:46

@aldy505 aldy505 left a comment

Copy link
Copy Markdown
Collaborator

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 😄

Comment thread docker-compose.yml Resolved
@phacops

phacops commented May 17, 2023

Copy link
Copy Markdown
Contributor Author

@aldy505 Good point, I added those.

@phacops

phacops commented May 17, 2023

Copy link
Copy Markdown
Contributor Author

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

Comment thread docker-compose.yml Resolved
@phacops
phacops requested review from a team and aldy505 and removed request for aldy505 May 18, 2023 15:15

@aldy505 aldy505 left a comment

Copy link
Copy Markdown
Collaborator

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 thread docker-compose.yml Outdated
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
Copy Markdown
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
Copy Markdown
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.

Comment thread docker-compose.yml Resolved
Comment thread docker-compose.yml Resolved

@hubertdeng123 hubertdeng123 left a comment

Copy link
Copy Markdown
Contributor

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

Comment thread docker-compose.yml Resolved
Comment thread docker-compose.yml Resolved
@phacops

phacops commented May 23, 2023

Copy link
Copy Markdown
Contributor Author

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

aldy505 commented May 23, 2023

Copy link
Copy Markdown
Collaborator

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
Copy Markdown
Contributor

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

aldy505 commented May 23, 2023 •

Copy link
Copy Markdown
Collaborator

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
Copy Markdown
Contributor

I guess we can skip that one for now?

Yep

Comment thread fixtures/envelope-with-profile.json Resolved

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

source install/create-docker-volumes.sh

Copy link
Copy Markdown
Contributor

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

Comment thread fixtures/envelope-with-profile.json Resolved

@BYK BYK left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

🚀

Comment thread _integration-test/run.sh Resolved
Comment thread docker-compose.yml Resolved

@chadwhitacre chadwhitacre left a comment

Copy link
Copy Markdown
Contributor

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
Copy Markdown
Contributor

23.5.2 is out now, this can be merged now

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

@aldy505 aldy505 left a comment

Copy link
Copy Markdown
Collaborator

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.

Comment thread docker-compose.yml Resolved
Comment thread docker-compose.yml Resolved
Comment thread docker-compose.yml Resolved

@aldy505 aldy505 left a comment

Copy link
Copy Markdown
Collaborator

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