Last active
August 29, 2015 14:08
-
-
Save Ke-/13a4ac6efbd3c3bc1d61 to your computer and use it in GitHub Desktop.
Log slow requests
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| define sys_slow_value => 1000.0 | |
| define sys_slow_output(p=null) => { | |
| local(s) = micros | |
| define_atend({ | |
| local(t) = (micros - #s) / 1000.0 | |
| #t > sys_slow_value && web_request ? log_critical('SLOW: ' + client_url + ' — ' + #t + ' milliseconds') | |
| }) | |
| } | |
| (with i in atbegin->asstaticarray where #i->isa(::pair) select #i->second)->asstaticarray !>> 'sys_slow_output' | |
| ? define_atbegin(\sys_slow_output = 'sys_slow_output') |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment