Skip to content

Commit f72883a

Browse files
committed
chore(Azure): remove Azure error monitoring
Wasn't working anyway.
1 parent f2503e5 commit f72883a

File tree

3 files changed

+2
-22
lines changed

3 files changed

+2
-22
lines changed

benefits/core/middleware.py

-15
Original file line numberDiff line numberDiff line change
@@ -161,21 +161,6 @@ def process_view(self, request, view_func, view_args, view_kwargs):
161161
return redirect("oauth:login")
162162

163163

164-
# https://github.com/census-instrumentation/opencensus-python/issues/766
165-
class LogErrorToAzure(MiddlewareMixin):
166-
def __init__(self, get_response):
167-
super().__init__(get_response)
168-
# wait to do this here to be sure the handler is initialized
169-
self.azure_logger = logging.getLogger("azure")
170-
171-
def process_exception(self, request, exception):
172-
# https://stackoverflow.com/a/45532289
173-
msg = getattr(exception, "message", repr(exception))
174-
self.azure_logger.exception(msg, exc_info=exception)
175-
176-
return None
177-
178-
179164
class RecaptchaEnabled(MiddlewareMixin):
180165
"""Middleware configures the request with required reCAPTCHA settings."""
181166

benefits/settings.py

+1-6
Original file line numberDiff line numberDiff line change
@@ -75,12 +75,7 @@ def _filter_empty(ls):
7575
ENABLE_AZURE_INSIGHTS = "APPLICATIONINSIGHTS_CONNECTION_STRING" in os.environ
7676
print("ENABLE_AZURE_INSIGHTS: ", ENABLE_AZURE_INSIGHTS)
7777
if ENABLE_AZURE_INSIGHTS:
78-
MIDDLEWARE.extend(
79-
[
80-
"opencensus.ext.django.middleware.OpencensusMiddleware",
81-
"benefits.core.middleware.LogErrorToAzure",
82-
]
83-
)
78+
MIDDLEWARE.append("opencensus.ext.django.middleware.OpencensusMiddleware")
8479

8580
# only used if enabled above
8681
OPENCENSUS = {

docs/deployment/troubleshooting.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ The following [tables](https://docs.microsoft.com/en-us/azure/azure-monitor/app/
3131

3232
In the latter two, you should see recent log output. Note [there is some latency](https://docs.microsoft.com/en-us/azure/azure-monitor/logs/data-ingestion-time).
3333

34-
See [`Failures`](https://docs.microsoft.com/en-us/azure/azure-monitor/app/asp-net-exceptions#diagnose-failures-using-the-azure-portal) in the sidebar (or `exceptions` under `Logs`) for application errors/exceptions.
34+
Note that we aren't [sending exceptions to Azure Monitor](https://learn.microsoft.com/en-us/azure/azure-monitor/app/opencensus-python#send-exceptions) (aside from the logs), so you won't see anything show up under `Failures` or `Logs`->`exceptions`.
3535

3636
#### Live tail
3737

0 commit comments

Comments
 (0)