mirror of https://github.com/zulip/zulip.git
error_notify: Add IP address to browser error reports.
This should make debugging a bit more convenient when we want to know which of a user's clients was involved.
This commit is contained in:
parent
64795adef3
commit
ce7ab0474d
|
@ -43,6 +43,7 @@ def email_browser_error(report):
|
||||||
|
|
||||||
body = ("User: %(user_full_name)s <%(user_email)s> on %(deployment)s\n\n"
|
body = ("User: %(user_full_name)s <%(user_email)s> on %(deployment)s\n\n"
|
||||||
"Message:\n%(message)s\n\nStacktrace:\n%(stacktrace)s\n\n"
|
"Message:\n%(message)s\n\nStacktrace:\n%(stacktrace)s\n\n"
|
||||||
|
"IP address: %(ip_address)s\n"
|
||||||
"User agent: %(user_agent)s\n"
|
"User agent: %(user_agent)s\n"
|
||||||
"href: %(href)s\n"
|
"href: %(href)s\n"
|
||||||
"Server path: %(server_path)s\n"
|
"Server path: %(server_path)s\n"
|
||||||
|
|
|
@ -101,10 +101,16 @@ def json_report_error(request, user_profile, message=REQ(), stacktrace=REQ(),
|
||||||
except Exception:
|
except Exception:
|
||||||
version = None
|
version = None
|
||||||
|
|
||||||
|
# Get the IP address of the request
|
||||||
|
remote_ip = request.META.get('HTTP_X_REAL_IP')
|
||||||
|
if remote_ip is None:
|
||||||
|
remote_ip = request.META['REMOTE_ADDR']
|
||||||
|
|
||||||
queue_json_publish('error_reports', dict(
|
queue_json_publish('error_reports', dict(
|
||||||
type = "browser",
|
type = "browser",
|
||||||
report = dict(
|
report = dict(
|
||||||
host = request.get_host().split(":")[0],
|
host = request.get_host().split(":")[0],
|
||||||
|
ip_address = remote_ip,
|
||||||
user_email = user_profile.email,
|
user_email = user_profile.email,
|
||||||
user_full_name = user_profile.full_name,
|
user_full_name = user_profile.full_name,
|
||||||
user_visible = ui_message,
|
user_visible = ui_message,
|
||||||
|
|
Loading…
Reference in New Issue