Rishi Gupta
4a74301a62
models.py: Replace resolve_subdomain_to_realm with get_realm_by_string_id.
...
No change in functionality.
2016-11-03 13:59:11 -07:00
hackerkid
ea39fb2556
Add option for hosting each realm on its own subdomain.
...
This adds support for running a Zulip production server with each
realm on its own unique subdomain, e.g. https://realm_name.example.com .
This patch includes a ton of important features:
* Configuring the Zulip sesion middleware to issue cookier correctly
for the subdomains case.
* Throwing an error if the user tries to visit an invalid subdomain.
* Runs a portion of the Casper tests with REALMS_HAVE_SUBDOMAINS
enabled to test the subdomain signup process.
* Updating our integrations documentation to refer to the current subdomain.
* Enforces that users can only login to the subdomain of their realm
(but does not restrict the API; that will be tightened in a future commit).
Note that toggling settings.REALMS_HAVE_SUBDOMAINS on a live server is
not supported without manual intervention (the main problem will be
adding "subdomain" values for all the existing realms).
[substantially modified by tabbott as part of merging]
2016-09-27 23:24:14 -07:00
Tim Abbott
647cead0d1
slow queries: Include full log line in slow query log.
...
The extra data is useful, and I think this won't make the lines annoying long.
2016-07-12 19:12:49 -07:00
Eklavya Sharma
9161ddaee0
zerver/middleware.py: Handle binary data in errors.
...
In write_log_line, error_content can be binary_type and
error_content_iter can be a Sequence of binary_type. Handle
this this in a python 3 compatible way. Also change annotations
to reflect this fact.
2016-07-10 11:30:13 -07:00
Taranjeet
a8a4caf2c0
zerver: Fix lines with length greater than 120.
2016-07-08 11:41:43 -07:00
Eklavya Sharma
4761cc27dd
zerver/middleware.py: Fix annotations.
...
* Use abstract types where relevant.
* Fix string types.
* Fix annotation of args and kwargs.
2016-07-04 02:14:42 +05:30
medullaskyline
c5f0d5b40a
Annotate zerver.middleware.
2016-06-04 18:32:06 -07:00
Umair Khan
08fbd57245
[i18n] Make error messages translatable.
...
Make all strings passing through `json_error` and `JsonableError`
translatable.
Fixes #727
2016-05-31 07:40:42 -07:00
Tim Abbott
92bec8cfea
Merge Zulip 1.3.12 security release.
2016-05-10 11:32:26 -07:00
Tim Abbott
3cde06ea33
Add support for setting HTTP status codes in JsonableError.
2016-05-10 09:50:48 -07:00
Tim Abbott
54022ac204
Fix unnecessary whitespace between , and ).
2016-05-04 14:16:53 -07:00
Ryan Moore
beac606ce6
switch output stats memcached -> remote_cache
2016-03-31 12:54:29 -07:00
Ryan Moore
85b05d4e2b
s/memcached_output/remote_cache_output/g
2016-03-31 12:54:29 -07:00
Ryan Moore
5346e2ac23
s/memcached_count_delta/remote_cache_count_delta/g
2016-03-31 12:54:29 -07:00
Ryan Moore
1a2117292f
s/memcached_requests/remote_cache_requests/g
2016-03-31 12:54:28 -07:00
Ryan Moore
16c936f638
s/memcached_time/remote_cache_time/g
2016-03-31 12:54:28 -07:00
Tim Abbott
df0d2a726d
python3: Add missing utf-8 encoding/decoding in various places.
2016-03-08 09:14:15 -08:00
Tim Abbott
10f15a2d00
middleware: Fix str/unicode type mismatch in statsd_path.
2016-02-03 19:29:07 -08:00
Tim Abbott
b879b7ff42
Use logger.debug when logging 200/304 output on static assets.
2015-12-25 16:23:57 -08:00
Tim Abbott
06f6ee6566
Apply Python 3 futurize transform lib2to3.fixes.fix_idioms.
2015-11-01 09:25:47 -08:00
Tim Abbott
1f2aa2fcab
Fix write_log_line for real.
...
(imported from commit cbb5c38b8e6c31822b28c478463978aa6cab33d4)
2015-08-22 14:40:47 -07:00
Tim Abbott
f1bf5ba24f
Fix write_log_line breakage for websockets.
...
(imported from commit 43bf24822329cf9729654ba58e9ffb0bff3403da)
2015-08-22 14:19:35 -07:00
Reid Barton
ab9539cffe
Remove OpenID authentication
...
(imported from commit 70a859041a851ed10dc40cfc068330e472d2ed09)
2015-08-20 23:52:48 -07:00
Reid Barton
dfdc34603e
Django 1.7 compatibility: handle both response.content and response.streaming_content
...
(imported from commit faaaff96819731a334d52b7d715c8ddb7c0d4293)
2015-08-20 23:01:26 -07:00
Tim Abbott
eb1631f78d
Set session cookie domain for *.e.zulip.com hostnames.
...
(imported from commit 42b15de3b4576341304041588ffaceac6f40baaf)
2015-01-15 21:09:52 -08:00
Tim Abbott
7e786d5426
Import default session middleware as start for custom session middleware.
...
(imported from commit 76aae367ab6ea5c2a7b0d98368482a3cb312b217)
2015-01-15 21:09:52 -08:00
Luke Faraone
2d3a7e5418
Use a different status code and include seconds remaining header in ratelimits
...
This will make it slightly easier to consume the data from our clients.
Ref:
RFC 6585 §4
(imported from commit 6d323dc25db78a6d84a163add950f039e03e73d3)
2014-03-11 13:06:19 -04:00
Leo Franchi
c504435bc3
Blacklist more paths, and fix paths with / to use . instead
...
(imported from commit 7e1840b7efb5d4f6e27307c3f7c95a9c822c8086)
2014-02-03 14:06:58 -05:00
Leo Franchi
30ae1c3463
Blacklist a few more statsd paths
...
(imported from commit 893b3d6c25e3a626b2948e69566fe5bd0db59813)
2014-01-22 10:49:49 -05:00
Zev Benjamin
db23674749
Do query time tracking at the psycopg2 level instead of the Django level
...
This allows us to track the query time of SQLAlchemy and raw queries.
(imported from commit 818a4ee41786ffc57b80d7ed1cfba075f29b6ee5)
2014-01-14 11:47:12 -05:00
Steve Howell
5dc3d9abce
Log internal queries if they are >= 5s.
...
(imported from commit ee88fcd6292a177e02bfe5e5bca5480b0e474030)
2013-12-26 09:23:18 -05:00
Steve Howell
eb6868704f
Give higher threshold for webathena kerberos queries.
...
These are mostly out of our control, so they are not very actionable.
(imported from commit ef342ec1edbff0fa1a934413a7f19ed14817a502)
2013-12-26 09:20:59 -05:00
Steve Howell
f61740551c
Bump slow query threshold to 1.2s
...
(imported from commit 8d97fc22d208274bc57b884828957dacf396348a)
2013-12-26 09:16:49 -05:00
Steve Howell
89f3a7c72f
Break up conditional in is_slow_query().
...
(imported from commit c7ca42965e917a0386069c915c0225cefc218c3e)
2013-12-26 09:13:00 -05:00
Steve Howell
e0a1841b1c
Extract middleware.is_slow_query() and add tests.
...
(imported from commit 60902244a420800f558fdf2f1c38b4ed736c1286)
2013-12-26 09:09:15 -05:00
Tim Abbott
b5754758a7
Don't alert on slow queries for /user_activity and /realm_activity.
...
(imported from commit 8b08ad47138477068f432ff15c56b2ba93ac2db6)
2013-12-19 17:41:36 -05:00
Tim Abbott
66e72d4705
Ignore slow queries on certain non-customer-facing URLs.
...
(imported from commit c3f53883d93a75d805b15f617f391ccd1a492ce8)
2013-12-19 17:20:43 -05:00
Tim Abbott
2ca5f43f05
Report json format 500 errors from all json format views.
...
Previously, we only did this via rest_dispatch.
(imported from commit b0edfdccea294378292b64677a64d5b01f936b08)
2013-12-19 16:48:51 -05:00
Tim Abbott
b30afe432e
Return a nice JSON error when CSRF errors happen in JSON views.
...
(imported from commit 916166c115f9b3ba0fdc93f8d917ff37ae22c2ae)
2013-12-19 16:48:51 -05:00
Tim Abbott
c91415f318
Improve names for per-request display recipient cache.
...
It incorrectly advertises itself as per-process.
(imported from commit faf7ca7374d020058e80249bb16a4c6afbcb3e44)
2013-12-19 14:04:55 -05:00
Tim Abbott
cc0ce6b437
Finish event handlers when disconnecting from an event queue.
...
This should help prevent timeouts from clients whose requests have
been supplanted.
(imported from commit fdb3a89c4ec02bb23d0fba50ea558d48cb786916)
2013-12-12 16:52:25 -05:00
Tim Abbott
878e07a5d8
Fix doubled query count logging when DEBUG=True.
...
(imported from commit 32dfc4c4e366ca80e659ca3d6ab4959b0235e861)
2013-12-03 12:21:06 -05:00
Tim Abbott
26f7b783a2
logging: Fix request processing time to not count initialization.
...
Previously, we counted not just the time required to process a
particular request, but also the time required to import+find the view
function via urls.py. The latter is usually fast, but when a new
Django thread starts up, it can take significant time, resulting in us
flagging slow requests on each server restart and also when a new
Django thread starts up on prod to handle requests.
This change means that we no longer include that startup time as part
of request processing time -- but we still log it in the case that it
was more than 5ms, so that we can identify why a particular request
was slower than expected if high startup times become a problem. We
annotate the time in log lines as "+start" rather than just "start" to
make clear that it's not counted in the total.
(imported from commit c677682e23b26005060390d85d386234f4f463ad)
2013-11-18 18:05:19 -05:00
Tim Abbott
d44c6636c6
Add setting to enable profiling of all requests.
...
This is useful for the occasional case where we cannot figure out what
is causing a particular problem, but it can be easily reproduced on
staging.
(imported from commit 8b51184a8b686814f2c6ff103ba355538463ceb0)
2013-11-18 18:05:19 -05:00
Zev Benjamin
eec195f421
socket: Use our full logging infrastructure
...
We also now separate out the times for the socket overhead, the
request service time, and the queuing delays.
(imported from commit e1683f7f28b968b86ebb701b0ac29b00ac6d67c3)
2013-11-12 15:24:30 -05:00
Zev Benjamin
6ff8ff0f3f
Make all the work of the logging middleware not depend on Request or Response objects
...
(imported from commit ce13909d338230a931cb09405d54bb872b2ff0a6)
2013-11-12 15:24:30 -05:00
Zev Benjamin
32ed5f9f42
Move flushing the display recipient cache to its own middleware
...
(imported from commit 27a6935a5830ef986b18de169d66dd86d273d064)
2013-11-12 15:24:30 -05:00
Zev Benjamin
53ec292022
Store logging data in a dict instead of individual attributes
...
(imported from commit f7d76670428d5d8298c572a23cbfffc1d9695f23)
2013-11-12 15:24:30 -05:00
Tim Abbott
2e833613c3
[Django 1.6] update monkeypatching for CursorDebugWrapper.
...
(imported from commit cb4b44a2bb6ba6efbd1fb5710da2df7c1dec7f81)
2013-11-08 08:22:04 -05:00
Leo Franchi
980dc8345a
Strip unicode chars from statsd path
...
(imported from commit 1c5829be7f89ad1e26be52b416a51da63e2a94cf)
2013-11-05 17:47:15 -05:00