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 support for sentry tracing #517

Merged
merged 4 commits into from
Sep 19, 2023

Conversation

mrchrisadams
Copy link
Member

@mrchrisadams mrchrisadams commented Sep 19, 2023

This PR allows us to set Sentry's tracing on our apps on a per machine basis, so we can get an idea of where performance bottlenecks lie.

Previously we had api.TGWF and admin.TGWF running on the same server, but since expanding to more machines, this allows us to serve admin.TGWF (which receives like.. 1000x less traffic) with sentry tracing on the app3 server, where we could run the tracing without blowing through our quota, and api.TGWF on the other machines, where we do not.

This also supports sampling on the API servers, but because admin.TGWF still gets some API traffic, this is currently assumed to be less of a priority.

@gitpod-io
Copy link

gitpod-io bot commented Sep 19, 2023

[program:{{ supervisor_gunicorn_app }}]
directory=/var/www/{{ tgwf_domain_name }}.thegreenwebfoundation.org/current/
numprocs=1
command=bash ./run_gunicorn.sh
process_name=%(process_num)02d
environment=PORT=90%(process_num)02d
Copy link
Member Author

@mrchrisadams mrchrisadams Sep 19, 2023

Choose a reason for hiding this comment

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

We don't scale with supervisord - gunicorn has good support for forking subprocesses and threads, and using those to control concurrency, and resource usage, so we do it there instead.

@mrchrisadams mrchrisadams force-pushed the ca-add-support-for-sentry-tracing branch from ace4c64 to 8d472ac Compare September 19, 2023 11:11
@@ -1,4 +1,4 @@
# supervisor can only control processes it started itself.
# So we need to use exec to replace the parent shell script process
# that starts pipenv
exec python -m pipenv run gunicorn greenweb.wsgi -b {{ internal_ip }}:$PORT -t 300 -c gunicorn.conf.py --statsd-host=10.0.0.2:9125 --statsd-prefix=member.app
exec python -m pipenv run gunicorn greenweb.wsgi -b {{ internal_ip }}:{{ gunicorn_port }} -t 300 -c gunicorn.conf.py --statsd-host=10.0.0.2:9125 --statsd-prefix=member.app
Copy link
Member Author

Choose a reason for hiding this comment

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

We set the port explicitly because this allows us to run production and staging apps on the same machine, without port clashes

@@ -54,7 +54,7 @@
# set our identifying credentials
dsn=sentry_dsn,
# Set traces_sample_rate.
traces_sample_rate=sentry_sample_rate,
traces_sample_rate=float(sentry_sample_rate),
Copy link
Member Author

Choose a reason for hiding this comment

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

Sentry seems to expect a float, not a string, so we coerce accordingly.

@mrchrisadams mrchrisadams merged commit 2932396 into master Sep 19, 2023
1 check passed
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.

1 participant