-
Notifications
You must be signed in to change notification settings - Fork 12
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
Conversation
[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 |
There was a problem hiding this comment.
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.
ace4c64
to
8d472ac
Compare
@@ -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 |
There was a problem hiding this comment.
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), |
There was a problem hiding this comment.
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.
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.