Skip to content

Commit

Permalink
🐛(sentry) fix logging environment in Sentry
Browse files Browse the repository at this point in the history
The previous implementation was not working because the
ENVIRONMENT setting was redefined after the LOGGING
setting had already been set to with "production" as
the environment. I propose to directly override the
value of the environment in the LOGGING setting.
  • Loading branch information
sampaccoud committed Nov 29, 2018
1 parent d320d6a commit 92d86c7
Show file tree
Hide file tree
Showing 10 changed files with 12 additions and 12 deletions.
3 changes: 2 additions & 1 deletion config/cms/docker_run_development.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,8 @@
# Load custom configuration parameters from yaml files
config = Configuration(os.path.dirname(__file__))

ENVIRONMENT = "development"
LOGGING["handlers"]["sentry"]["environment"] = "development"

DEBUG = True
REQUIRE_DEBUG = True

Expand Down
2 changes: 1 addition & 1 deletion config/cms/docker_run_feature.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
# Load custom configuration parameters from yaml files
config = Configuration(os.path.dirname(__file__))

ENVIRONMENT = "feature"
LOGGING["handlers"]["sentry"]["environment"] = "feature"

EMAIL_BACKEND = config(
"EMAIL_BACKEND", default="django.core.mail.backends.console.EmailBackend"
Expand Down
2 changes: 1 addition & 1 deletion config/cms/docker_run_preprod.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
# Load custom configuration parameters from yaml files
config = Configuration(os.path.dirname(__file__))

ENVIRONMENT = "preprod"
LOGGING["handlers"]["sentry"]["environment"] = "preprod"

EMAIL_BACKEND = config(
"EMAIL_BACKEND", default="django.core.mail.backends.console.EmailBackend"
Expand Down
3 changes: 1 addition & 2 deletions config/cms/docker_run_production.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,6 @@

############### ALWAYS THE SAME ################################

ENVIRONMENT = "production"
RELEASE = config("RELEASE", default=None)
DEBUG = False

Expand Down Expand Up @@ -321,7 +320,7 @@
"class": "raven.handlers.logging.SentryHandler",
"dsn": SENTRY_DSN,
"level": "ERROR",
"environment": ENVIRONMENT,
"environment": "production",
"release": RELEASE,
}

Expand Down
2 changes: 1 addition & 1 deletion config/cms/docker_run_staging.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
# Load custom configuration parameters from yaml files
config = Configuration(os.path.dirname(__file__))

ENVIRONMENT = "staging"
LOGGING["handlers"]["sentry"]["environment"] = "staging"

EMAIL_BACKEND = config(
"EMAIL_BACKEND", default="django.core.mail.backends.console.EmailBackend"
Expand Down
3 changes: 2 additions & 1 deletion config/lms/docker_run_development.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,8 @@
# Load custom configuration parameters from yaml files
config = Configuration(os.path.dirname(__file__))

ENVIRONMENT = "development"
LOGGING["handlers"]["sentry"]["environment"] = "development"

DEBUG = True
REQUIRE_DEBUG = True

Expand Down
2 changes: 1 addition & 1 deletion config/lms/docker_run_feature.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
# Load custom configuration parameters from yaml files
config = Configuration(os.path.dirname(__file__))

ENVIRONMENT = "feature"
LOGGING["handlers"]["sentry"]["environment"] = "feature"

EMAIL_BACKEND = config(
"EMAIL_BACKEND", default="django.core.mail.backends.console.EmailBackend"
Expand Down
2 changes: 1 addition & 1 deletion config/lms/docker_run_preprod.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
# Load custom configuration parameters from yaml files
config = Configuration(os.path.dirname(__file__))

ENVIRONMENT = "preprod"
LOGGING["handlers"]["sentry"]["environment"] = "preprod"

EMAIL_BACKEND = config(
"EMAIL_BACKEND", default="django.core.mail.backends.console.EmailBackend"
Expand Down
3 changes: 1 addition & 2 deletions config/lms/docker_run_production.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,6 @@

################################ ALWAYS THE SAME ##############################

ENVIRONMENT = "production"
RELEASE = config("RELEASE", default=None)
DEBUG = False
DEFAULT_TEMPLATE_ENGINE["OPTIONS"]["debug"] = False
Expand Down Expand Up @@ -432,7 +431,7 @@
"class": "raven.handlers.logging.SentryHandler",
"dsn": SENTRY_DSN,
"level": "ERROR",
"environment": ENVIRONMENT,
"environment": "production",
"release": RELEASE,
}

Expand Down
2 changes: 1 addition & 1 deletion config/lms/docker_run_staging.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
# Load custom configuration parameters from yaml files
config = Configuration(os.path.dirname(__file__))

ENVIRONMENT = "staging"
LOGGING["handlers"]["sentry"]["environment"] = "staging"

EMAIL_BACKEND = config(
"EMAIL_BACKEND", default="django.core.mail.backends.console.EmailBackend"
Expand Down

0 comments on commit 92d86c7

Please sign in to comment.