Sam Saffron
62141b6316
FEATURE: enable_performance_http_headers for performance diagnostics
...
This adds support for DISCOURSE_ENABLE_PERFORMANCE_HTTP_HEADERS
when set to `true` this will turn on performance related headers
```text
X-Redis-Calls: 10 # number of redis calls
X-Redis-Time: 1.02 # redis time in seconds
X-Sql-Commands: 102 # number of SQL commands
X-Sql-Time: 1.02 # duration in SQL in seconds
X-Queue-Time: 1.01 # time the request sat in queue (depends on NGINX)
```
To get queue time NGINX must provide: HTTP_X_REQUEST_START
We do not recommend you enable this without thinking, it exposes information
about what your page is doing, usually you would only enable this if you
intend to strip off the headers further down the stream in a proxy
2019-06-05 16:08:11 +10:00
David Taylor
8963f1af30
FEATURE: Optional detailed performance logging for Sidekiq jobs ( #7091 )
...
By default, this does nothing. Two environment variables are available:
- `DISCOURSE_LOG_SIDEKIQ`
Set to `"1"` to enable logging. This will log all completed jobs to `log/rails/sidekiq.log`, along with various db/redis/network statistics. This is useful to track down poorly performing jobs.
- `DISCOURSE_LOG_SIDEKIQ_INTERVAL`
(seconds) Check running jobs periodically, and log their current duration. They will appear in the logs with `status:pending`. This is useful to track down jobs which take a long time, then crash sidekiq before completing.
2019-03-05 11:19:11 +00:00
Guo Xiang Tan
c732ae9ca9
FIX: Don't update User#last_seen_at
when PG is in readonly.
2019-01-21 13:29:29 +08:00
Guo Xiang Tan
e2a20d90fe
FIX: Don't log request when Discourse is in readonly due to PG.
2019-01-21 11:04:32 +08:00
Sam
a19170a4c2
DEV: avoid require_dependency for some libs
...
This avoids require dependency on method_profiler and anon cache.
It means that if there is any change to these files the reloader will not pick it up.
Previously the reloader was picking up the anon cache twice causing it to double load on boot.
This caused warnings.
Long term my plan is to give up on require dependency and instead use:
https://github.com/Shopify/autoload_reloader
2018-12-31 10:53:30 +11:00
Sam
955cdad649
FIX: exec_params needs instrumentation
...
the method no longer routes to "exec" or "async_exec" in latest PG so we
need to explicitly intercept
2018-12-10 14:28:10 +11:00
Sam
168ffd8384
FEATURE: group warnings about IP level rate limiting
2018-08-13 14:38:20 +10:00
Sam
7f98ed69cd
FIX: move crawler blocking to app controller
...
We need access to site settings in multisite, we do not have access
yet if we attempt to get them in request tracker middleware
2018-07-04 10:30:50 +10:00
Neil Lalonde
e8a6323bea
remove crawler blocking until multisite support
2018-07-03 17:54:45 -04:00
Sam
4810ce3607
correct regression
2018-04-18 21:04:08 +10:00
Neil Lalonde
b87fa6d749
FIX: blacklisted crawlers could get through by omitting the accept header
2018-04-17 12:39:30 -04:00
Sam
9980f18d86
FEATURE: track request queueing as early as possible
2018-04-17 18:06:17 +10:00
Neil Lalonde
4d12ff2e8a
when writing cache, remove elements from the user agents list. also return a message and content type when blocking a crawler.
2018-03-27 13:44:14 -04:00
Neil Lalonde
a84bb81ab5
only applies to get html requests
2018-03-22 17:57:44 -04:00
Neil Lalonde
ced7e9a691
FEATURE: control which web crawlers can access using a whitelist or blacklist
2018-03-22 15:41:02 -04:00
Sam
0134e41286
FEATURE: detect when client thinks user is logged on but is not
...
This cleans up an error condition where UI thinks a user is logged on
but the user is not. If this happens user will be prompted to refresh.
2018-03-06 16:49:31 +11:00
Sam
f0d5f83424
FEATURE: limit assets less that non asset paths
...
By default assets can be requested up to 200 times per 10 seconds
from the app, this includes CSS and avatars
2018-03-06 15:20:39 +11:00
Sam
f295a18e94
FIX: stop double counting net calls in logs
2018-02-28 10:45:11 +11:00
Sam
ca1a3f37e3
FEATURE: add instrumentation for all external net calls
2018-02-21 15:20:29 +11:00
Guo Xiang Tan
3e835047da
Remove "already initialized" constant warning.
2018-02-13 08:55:15 +08:00
Sam Saffron
df8e43abdd
use lazy & instead of try
...
unregister ip skipper in test
raise if called when a skipper is in play
2018-02-06 10:38:15 +11:00
Robin Ward
eefd226611
Add extensibility point to request_tracker
to skip IP addresses
...
This is useful if you want to run a per IP rate limiter but want to be
able to skip some IPs with custom logic.
2018-02-05 17:49:40 -05:00
Sam
f26ff290c3
FEATURE: Shorten setting name to max_reqs
...
So it is consistent with other settings
2018-01-22 13:18:30 +11:00
Sam
8bf91b8dca
correct tracking of x runtime
2018-01-19 17:51:19 +11:00
Sam
8ad43f01c2
FIX: correctly log topic timings as background
2018-01-19 10:37:43 +11:00
Sam
12872d03be
PERF: run post timings in background
...
This means that if a very large amount of registered users hit
a single topic we will handle it gracefully, even if db gets slow.
2018-01-19 08:27:29 +11:00
Sam
cecd7d0d07
FEATURE: global rate limiter can bypass local IPs
2018-01-08 08:39:17 +11:00
Sam
715cb98e95
add better diagnostics for rate limits
2018-01-05 12:14:28 +11:00
Sam
bbc606988f
improve message
2017-12-20 10:12:33 +11:00
Sam
4986ebcf24
FEATURE: optional default off global per ip rate limiter
2017-12-11 17:52:57 +11:00
Sam
df84e1c358
Correctly track hijacked requests
2017-11-28 16:47:20 +11:00
Sam
a4c539bade
FEATURE: Allow registration of detailed request logger
...
Detailed request loggers can be used to gather rich timing info
from all requests (which in turn can be forwarded to monitoring solution)
Middleware::RequestTracker.detailed_request_logger(->|env, data| do
# do stuff with env and data
end
2017-10-18 12:10:30 +11:00
Guo Xiang Tan
5012d46cbd
Add rubocop to our build. ( #5004 )
2017-07-28 10:20:09 +09:00
Sam
497ff76a67
make sure 1 is a string
2016-10-27 18:08:01 +11:00
Sam
3e7190866a
make code a bit safer
2016-10-27 16:50:56 +11:00
Sam
8a477f1857
FEATURE: added X-Discourse-TrackView header
...
This header is set to 1 if the particular request is a tracked page view
2016-10-27 16:48:27 +11:00
Sam
ec4a1bb2c4
FIX: page tracking was not properly tracking transitions
...
PERF: move closure to self contained method so env is released earlier.
2015-09-17 11:06:33 +10:00
Régis Hanol
d7aa4e81d6
revert 8f435fcbf6
2015-07-31 15:22:30 +02:00
Neil Lalonde
86cd1a19cc
FEATURE: page view stats for mobile view
2015-07-03 17:19:33 -04:00
Sam
cbe18eb0df
FEATURE: allow view exclusion using custom header
...
Set Discourse-Track-View to either "0" or "false" to exclude request
2015-02-26 11:41:11 +11:00
Sam
fce9e296e7
background reqs failed or not are always counted seperately
2015-02-12 09:47:46 +11:00
Sam
3cf87b94c9
whitespace
2015-02-11 09:39:04 +11:00
Sam
0ce6524153
correct brokeness
2015-02-10 17:05:24 +11:00
Sam
acda6ebd60
FIX: view tracking needs to release data earlier
...
retaining data during queuing was causing huge memory spikes
2015-02-10 17:03:33 +11:00
Sam
820ce8765e
refactor traffic report
...
split traffic report in 2, page view vs raw traffic
hide raw traffic report by default
improve flushing logic for application reqs
2015-02-06 14:39:16 +11:00
Sam
08b790b3c2
improve metrics gathered using in our traffic section
...
this also pulls out the middleware into its own home and inserts in front
2015-02-05 16:08:52 +11:00