From d1198f63b17d713042707d912b678aad10a6f918 Mon Sep 17 00:00:00 2001 From: Wan Liuyang Date: Wed, 21 Mar 2018 19:54:27 +0800 Subject: [PATCH] Drop Opbeat (#1578) --- README.rst | 3 --- cookiecutter.json | 1 - docs/project-generation-options.rst | 5 ---- docs/settings.rst | 3 --- .../.envs/.production/.django | 6 ----- .../config/settings/production.py | 15 ----------- .../requirements/production.txt | 3 --- .../taskapp/celery.py | 26 ------------------- 8 files changed, 62 deletions(-) diff --git a/README.rst b/README.rst index e2c24f5b..6cc1607e 100644 --- a/README.rst +++ b/README.rst @@ -68,7 +68,6 @@ Optional Integrations * Configuration for Celery_ * Integration with MailHog_ for local email testing * Integration with Sentry_ for error logging -* Integration with Opbeat_ for performance monitoring .. _Bootstrap: https://github.com/twbs/bootstrap .. _django-environ: https://github.com/joke2k/django-environ @@ -83,7 +82,6 @@ Optional Integrations .. _MailHog: https://github.com/mailhog/MailHog .. _Sentry: https://sentry.io/welcome/ .. _docker-compose: https://github.com/docker/compose -.. _Opbeat: https://opbeat.com/ .. _PythonAnywhere: https://www.pythonanywhere.com/ .. _Caddy: https://caddyserver.com/ .. _LetsEncrypt: https://letsencrypt.org/ @@ -164,7 +162,6 @@ Answer the prompts with your own desired options_. For example:: use_celery [n]: y use_mailhog [n]: n use_sentry_for_error_reporting [y]: y - use_opbeat [n]: y use_pycharm [n]: y windows [n]: n use_docker [y]: n diff --git a/cookiecutter.json b/cookiecutter.json index aa341801..d1ed0c26 100644 --- a/cookiecutter.json +++ b/cookiecutter.json @@ -36,7 +36,6 @@ "use_celery": "n", "use_mailhog": "n", "use_sentry_for_error_reporting": "y", - "use_opbeat": "n", "use_whitenoise": "y", "use_heroku": "n", "use_travisci": "n", diff --git a/docs/project-generation-options.rst b/docs/project-generation-options.rst index 2ca2872c..062cab3b 100644 --- a/docs/project-generation-options.rst +++ b/docs/project-generation-options.rst @@ -81,9 +81,6 @@ use_mailhog [n] use_sentry_for_error_reporting [n] Indicates whether the project should be configured to use Sentry_. -use_opbeat [n] - Indicates whether the project should be configured to use Opbeat_. - use_whitenoise [y] Indicates whether the project should be configured to use WhiteNoise_. @@ -123,8 +120,6 @@ keep_local_envs_in_vcs [y] .. _Sentry: https://github.com/getsentry/sentry -.. _Opbeat: https://github.com/opbeat/opbeat_python - .. _WhiteNoise: https://github.com/evansd/whitenoise .. _Heroku: https://github.com/heroku/heroku-buildpack-python diff --git a/docs/settings.rst b/docs/settings.rst index 828b5de4..7962f715 100644 --- a/docs/settings.rst +++ b/docs/settings.rst @@ -51,9 +51,6 @@ MAILGUN_API_KEY MAILGUN_ACCESS_KEY n/a MAILGUN_DOMAIN MAILGUN_SENDER_DOMAIN n/a raises error NEW_RELIC_APP_NAME NEW_RELIC_APP_NAME n/a raises error NEW_RELIC_LICENSE_KEY NEW_RELIC_LICENSE_KEY n/a raises error -DJANGO_OPBEAT_APP_ID OPBEAT['APP_ID'] n/a raises error -DJANGO_OPBEAT_SECRET_TOKEN OPBEAT['SECRET_TOKEN'] n/a raises error -DJANGO_OPBEAT_ORGANIZATION_ID OPBEAT['ORGANIZATION_ID'] n/a raises error ======================================= =========================== ============================================== ====================================================================== -------------------------- diff --git a/{{cookiecutter.project_slug}}/.envs/.production/.django b/{{cookiecutter.project_slug}}/.envs/.production/.django index 39bbaae4..3f5610d6 100644 --- a/{{cookiecutter.project_slug}}/.envs/.production/.django +++ b/{{cookiecutter.project_slug}}/.envs/.production/.django @@ -38,10 +38,4 @@ WEB_CONCURRENCY=4 # Sentry # ------------------------------------------------------------------------------ DJANGO_SENTRY_DSN= -{% endif %}{% if cookiecutter.use_opbeat == 'y' %} -# opbeat -# ------------------------------------------------------------------------------ -DJANGO_OPBEAT_ORGANIZATION_ID= -DJANGO_OPBEAT_APP_ID= -DJANGO_OPBEAT_SECRET_TOKEN= {% endif %} diff --git a/{{cookiecutter.project_slug}}/config/settings/production.py b/{{cookiecutter.project_slug}}/config/settings/production.py index b29a22b0..dca7cb38 100644 --- a/{{cookiecutter.project_slug}}/config/settings/production.py +++ b/{{cookiecutter.project_slug}}/config/settings/production.py @@ -289,21 +289,6 @@ LOGGING = { } } -{%- endif %} -{% if cookiecutter.use_opbeat == 'y' -%} -# opbeat -# ------------------------------------------------------------------------------ -# https://opbeat.com/docs/articles/get-started-with-django/#setup -INSTALLED_APPS += ['opbeat.contrib.django'] # noqa F405 -# https://opbeat.com/docs/articles/get-started-with-django/#setup -OPBEAT = { - 'ORGANIZATION_ID': env('DJANGO_OPBEAT_ORGANIZATION_ID'), - 'APP_ID': env('DJANGO_OPBEAT_APP_ID'), - 'SECRET_TOKEN': env('DJANGO_OPBEAT_SECRET_TOKEN') -} -# https://opbeat.com/docs/articles/get-started-with-django/#performance-metrics -MIDDLEWARE = ['opbeat.contrib.django.middleware.OpbeatAPMMiddleware'] + MIDDLEWARE - {%- endif %} # Your stuff... # ------------------------------------------------------------------------------ diff --git a/{{cookiecutter.project_slug}}/requirements/production.txt b/{{cookiecutter.project_slug}}/requirements/production.txt index 44c1597b..aa3cb727 100644 --- a/{{cookiecutter.project_slug}}/requirements/production.txt +++ b/{{cookiecutter.project_slug}}/requirements/production.txt @@ -12,9 +12,6 @@ Collectfast==0.6.2 # https://github.com/antonagestam/collectfast {%- if cookiecutter.use_sentry_for_error_reporting == "y" %} raven==6.6.0 # https://github.com/getsentry/raven-python {%- endif %} -{%- if cookiecutter.use_opbeat == "y" %} -opbeat==3.6.1 # https://github.com/opbeat/opbeat_python -{%- endif %} # Django # ------------------------------------------------------------------------------ diff --git a/{{cookiecutter.project_slug}}/{{cookiecutter.project_slug}}/taskapp/celery.py b/{{cookiecutter.project_slug}}/{{cookiecutter.project_slug}}/taskapp/celery.py index 9827fa02..dc676769 100644 --- a/{{cookiecutter.project_slug}}/{{cookiecutter.project_slug}}/taskapp/celery.py +++ b/{{cookiecutter.project_slug}}/{{cookiecutter.project_slug}}/taskapp/celery.py @@ -46,32 +46,6 @@ class CeleryConfig(AppConfig): raven_register_signal(raven_client) {%- endif %} - {% if cookiecutter.use_opbeat == 'y' -%} - if hasattr(settings, 'OPBEAT'): -{% if cookiecutter.use_pycharm == 'y' -%} - # Since opbeat is required in production only, - # imports might (most surely will) be wiped out - # during PyCharm code clean up started - # in other environments. - # @formatter:off -{%- endif %} - from opbeat.contrib.django.models import client as opbeat_client - from opbeat.contrib.django.models import logger as opbeat_logger - from opbeat.contrib.django.models import register_handlers as opbeat_register_handlers - from opbeat.contrib.celery import register_signal as opbeat_register_signal -{% if cookiecutter.use_pycharm == 'y' -%} - # @formatter:on -{%- endif %} - - try: - opbeat_register_signal(opbeat_client) - except Exception as e: - opbeat_logger.exception(f'Failed installing celery hook: {e}') - - if 'opbeat.contrib.django' in settings.INSTALLED_APPS: - opbeat_register_handlers() - {%- endif %} - @app.task(bind=True) def debug_task(self):