0
Fork 0
mirror of https://github.com/TryGhost/Ghost.git synced 2025-02-03 23:00:14 -05:00
ghost/core/server/helpers
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
..
tpl 🎨 Added additional parameters to subscribe_form and input_email helpers (#9820) 2018-08-30 17:17:27 +01:00
asset.js Migrated asset and author helpers to es6 (#10611) 2019-03-26 10:06:41 +05:30
author.js Changed comments and deprecation notes 2018-08-16 12:13:24 +02:00
authors.js Migrated asset and author helpers to es6 (#10611) 2019-03-26 10:06:41 +05:30
body_class.js 🐛 Fixed 500 template error occurring in place of a 404 for missing pages/assets (#10660) 2019-04-04 14:41:56 +01:00
content.js Migrated body_class, content and date helpers to ES6 (#10644) 2019-04-02 08:36:13 +02:00
date.js Migrated body_class, content and date helpers to ES6 (#10644) 2019-04-02 08:36:13 +02:00
encode.js Migrated encode, facebook_url and foreach helpers to es6 (#10655) 2019-04-22 17:54:42 +02:00
excerpt.js 🐛 Fixed returning 'null' text for exerpt helper 2019-03-04 14:39:20 +08:00
facebook_url.js Migrated encode, facebook_url and foreach helpers to es6 (#10655) 2019-04-22 17:54:42 +02:00
foreach.js Migrated encode, facebook_url and foreach helpers to es6 (#10655) 2019-04-22 17:54:42 +02:00
get.js Added logging of slow {{#get}} helper uses (#10779) 2019-06-07 14:54:55 +01:00
ghost_foot.js Removed use of filters module 2019-04-16 11:05:33 +02:00
ghost_head.js Updated ghost_head to include the members scripts 2019-04-24 12:46:00 +02:00
has.js Switched to eslint-plugin-ghost (#9835) 2018-09-17 20:49:30 +02:00
img_url.js 🐛 Fixed img-url to output relative url by default (#10596) 2019-03-11 15:20:05 +01:00
index.js Removed use of filters module 2019-04-16 11:05:33 +02:00
is.js Helper Proxy & single express-hbs instance (#8225) 2017-04-04 18:07:35 +02:00
lang.js Theme translations and blog localisation (#8437) 2018-01-09 14:50:57 +01:00
meta_description.js Switch to Eslint (#9197) 2017-11-01 13:44:54 +00:00
meta_title.js 🐛Fixed i18n for the {{meta_title}} helper (#9468) 2018-03-19 09:48:07 +01:00
navigation.js Attr pass-thru & full context in partial helpers 2019-03-09 21:21:01 +00:00
page_url.js Switch to Eslint (#9197) 2017-11-01 13:44:54 +00:00
pagination.js Attr pass-thru & full context in partial helpers 2019-03-09 21:21:01 +00:00
plural.js Theme translations and blog localisation (#8437) 2018-01-09 14:50:57 +01:00
post_class.js Switch to Eslint (#9197) 2017-11-01 13:44:54 +00:00
prev_next.js Updated TODO's 2019-02-27 18:08:36 +01:00
proxy.js Migrated to use @tryghost/social-urls package 2019-06-06 17:10:13 +02:00
reading_time.js Updated reading time helper to use SDK 2019-05-07 15:33:07 +05:30
register.js Moved labs, auth, permissions, settings, mail, themes to services (#9339) 2017-12-14 03:01:23 +01:00
t.js Theme translations and blog localisation (#8437) 2018-01-09 14:50:57 +01:00
tags.js 🐛 Fixed preview url and Zapier on subdirectory (#9683) 2018-06-12 16:36:58 +01:00
template.js Attr pass-thru & full context in partial helpers 2019-03-09 21:21:01 +00:00
title.js Helper Proxy & single express-hbs instance (#8225) 2017-04-04 18:07:35 +02:00
twitter_url.js Moved social utility to lib/social 2017-12-14 22:34:05 +01:00
url.js 🐛 Supported "false" as absolute attribute value (#10556) 2019-03-04 11:23:42 +01:00
utils.js Updated to use count words/images helpers from SDK (#10686) 2019-04-16 08:00:01 +05:30