0
Fork 0
mirror of https://github.com/TryGhost/Ghost.git synced 2025-01-20 22:42:53 -05:00
ghost/core/server
Kevin Ansfield ea37b78456
Added logging of slow {{#get}} helper uses (#10779)
no issue

- `{{#get}}` can slow down requests a lot if not used carefully, typically by using `limit="all"` or similar which can force a lot of data to be fetched and processed
- adds a warning log if we detect any `{{#get}}` helper call which takes longer than a certain threshold (default 200ms)
- allow log level and threshold to be configured via config to allow for different environments behaviours and requirements

New config options:
```
{
    "logging": {
        "slowHelper": {
            "level": "warn",
            "threshold": 200
        }
    }
}
```

Example output for `{{#get "tags" limit="all" order="name asc"}}` with a lot of tags:

```
[2019-06-07 10:35:52] WARN {{#get}} helper took 453ms to complete

{{#get}} helper took 453ms to complete

Error ID:
    062daed0-8910-11e9-8185-3b615ad8677d

Error Code:
    SLOW_GET_HELPER

Details:
    api:          v2.tagsPublic.browse
    apiOptions:
      order: name asc
      limit: all
    returnedRows: 1698
```
2019-06-07 14:54:55 +01:00
..
adapters 🐛 Fixed post scheduling on restart (#10726) 2019-05-06 11:11:43 +02:00
api Refactored json-schema to use one instance of ajv (#10746) 2019-05-15 13:28:10 +02:00
apps 🐛 Changed subscribed page title from hardcoded to site title (#10589) 2019-03-11 14:07:37 +08:00
config Added logging of slow {{#get}} helper uses (#10779) 2019-06-07 14:54:55 +01:00
data Migrated to use @tryghost/social-urls package 2019-06-06 17:10:13 +02:00
helpers Added logging of slow {{#get}} helper uses (#10779) 2019-06-07 14:54:55 +01:00
lib Added logging of slow {{#get}} helper uses (#10779) 2019-06-07 14:54:55 +01:00
models Updated to use slugify method from SDK for safe string 2019-05-07 15:33:07 +05:30
public Added members-theme-bindings library to public 2019-04-24 12:46:00 +02:00
services Removed lib/members in favour of packages (#10739) 2019-05-08 14:08:25 +02:00
translations 🐛 Disallowed locked/suspended users from being made owner via the API (#10647) 2019-04-16 10:30:29 +01:00
views Aliased {{@blog}} as {{@site}} in the theme API 2019-01-04 12:17:32 +00:00
web Added x-frame-options header to /ghost/ route (#10760) 2019-05-28 09:04:48 +01:00
analytics-events.js Added event to integrations when created (#10588) 2019-03-11 15:28:17 +01:00
ghost-server.js Switched to eslint-plugin-ghost (#9835) 2018-09-17 20:49:30 +02:00
index.js Added comment about future scheduler migration 2019-05-06 12:26:08 +02:00
overrides.js Disabled bluebird debug logs 2018-08-13 14:01:31 +02:00
update-check.js Removed lts update check flag 2019-05-01 16:00:53 +02:00