@newskit-render/core 1.9.0 → 1.9.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/.eslintignore CHANGED
@@ -13,3 +13,4 @@ next-env.d.ts
13
13
  helpers/setupTests.ts
14
14
  newrelic.js
15
15
  infrastructure/helm/*
16
+ infrastructure/terraform-newrelic/*.js
package/CHANGELOG.md CHANGED
@@ -3,6 +3,30 @@
3
3
  All notable changes to this project will be documented in this file.
4
4
  See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
5
5
 
6
+ ## [1.9.3](https://github.com/newscorp-ghfb/ncu-newskit-render/compare/@newskit-render/core@1.9.2...@newskit-render/core@1.9.3) (2022-01-05)
7
+
8
+ **Note:** Version bump only for package @newskit-render/core
9
+
10
+
11
+
12
+
13
+
14
+ ## [1.9.2](https://github.com/newscorp-ghfb/ncu-newskit-render/compare/@newskit-render/core@1.9.1...@newskit-render/core@1.9.2) (2022-01-04)
15
+
16
+ **Note:** Version bump only for package @newskit-render/core
17
+
18
+
19
+
20
+
21
+
22
+ ## [1.9.1](https://github.com/newscorp-ghfb/ncu-newskit-render/compare/@newskit-render/core@1.9.0...@newskit-render/core@1.9.1) (2022-01-04)
23
+
24
+ **Note:** Version bump only for package @newskit-render/core
25
+
26
+
27
+
28
+
29
+
6
30
  # [1.9.0](https://github.com/newscorp-ghfb/ncu-newskit-render/compare/@newskit-render/core@1.8.0...@newskit-render/core@1.9.0) (2022-01-04)
7
31
 
8
32
 
@@ -169,3 +169,179 @@ resource "newrelic_one_dashboard" "frontend_dashboard" {
169
169
  }
170
170
  }
171
171
  }
172
+
173
+ resource "newrelic_one_dashboard" "lighthouse_dashboard" {
174
+ name = "${data.newrelic_entity.render_app.name} Lighthouse Dashboard"
175
+
176
+ page {
177
+ name = "${data.newrelic_entity.render_app.name} Lighthouse Metrics Dashboard"
178
+
179
+ widget_billboard {
180
+ title = "Lighthouse Metrics"
181
+ row = 1
182
+ column = 1
183
+ height = 3
184
+ width = 4
185
+
186
+ nrql_query {
187
+ query = "FROM SyntheticCheck SELECT average(custom.firstContentfulPaint) as 'FCP', average(custom.largestContentfulPaint) as 'LCP', average(custom.interactive) as 'TTI', average(custom.totalBlockingTime) as 'TBT', average(custom.cumulativeLayoutShift) as 'CLS', average(custom.speedIndex) as 'Speed Index'"
188
+ }
189
+ }
190
+
191
+ widget_line {
192
+ title = "Lighthouse Metrics-trending"
193
+ row = 1
194
+ column = 5
195
+ height = 3
196
+ width = 8
197
+
198
+ nrql_query {
199
+ query = "FROM SyntheticCheck SELECT average(custom.firstContentfulPaint) as 'FCP', average(custom.largestContentfulPaint) as 'LCP', average(custom.interactive) as 'TTI', average(custom.totalBlockingTime) as 'TBT', average(custom.cumulativeLayoutShift) as 'CLS', average(custom.speedIndex) as 'Speed Index' TIMESERIES AUTO"
200
+ }
201
+ }
202
+
203
+ widget_bar {
204
+ title = "First Contentful Paint"
205
+ row = 4
206
+ column = 1
207
+ height = 3
208
+ width = 4
209
+
210
+ nrql_query {
211
+ query = "FROM SyntheticCheck SELECT average(custom.firstContentfulPaint) FACET custom.url"
212
+ }
213
+ }
214
+
215
+ widget_line {
216
+ title = "First Contentful Paint"
217
+ row = 4
218
+ column = 5
219
+ height = 3
220
+ width = 8
221
+
222
+ nrql_query {
223
+ query = "FROM SyntheticCheck SELECT average(custom.firstContentfulPaint) FACET custom.url TIMESERIES AUTO"
224
+ }
225
+ }
226
+
227
+ widget_bar {
228
+ title = "Largest Contentful Paint"
229
+ row = 7
230
+ column = 1
231
+ height = 3
232
+ width = 4
233
+
234
+ nrql_query {
235
+ query = "FROM SyntheticCheck SELECT average(custom.largestContentfulPaint) FACET custom.url"
236
+ }
237
+ }
238
+
239
+ widget_line {
240
+ title = "Largest Contentful Paint"
241
+ row = 7
242
+ column = 5
243
+ height = 3
244
+ width = 8
245
+
246
+ nrql_query {
247
+ query = "FROM SyntheticCheck SELECT average(custom.largestContentfulPaint) FACET custom.url TIMESERIES AUTO"
248
+ }
249
+ }
250
+
251
+ widget_bar {
252
+ title = "TTI"
253
+ row = 10
254
+ column = 1
255
+ height = 3
256
+ width = 4
257
+
258
+ nrql_query {
259
+ query = "FROM SyntheticCheck SELECT average(custom.interactive) as 'TTI' FACET custom.url"
260
+ }
261
+ }
262
+
263
+ widget_line {
264
+ title = "TTI - trending"
265
+ row = 10
266
+ column = 5
267
+ height = 3
268
+ width = 8
269
+
270
+ nrql_query {
271
+ query = "FROM SyntheticCheck SELECT average(custom.interactive) FACET custom.url TIMESERIES AUTO"
272
+ }
273
+ }
274
+
275
+ widget_bar {
276
+ title = "Total Blocking Time (TBT)"
277
+ row = 13
278
+ column = 1
279
+ height = 3
280
+ width = 4
281
+
282
+ nrql_query {
283
+ query = "FROM SyntheticCheck SELECT average(custom.totalBlockingTime) FACET custom.url"
284
+ }
285
+ }
286
+
287
+ widget_line {
288
+ title = "Total Blocking Time (TBT) - trending"
289
+ row = 13
290
+ column = 5
291
+ height = 3
292
+ width = 8
293
+
294
+ nrql_query {
295
+ query = "FROM SyntheticCheck SELECT average(custom.totalBlockingTime) FACET custom.url TIMESERIES AUTO"
296
+ }
297
+ }
298
+
299
+ widget_bar {
300
+ title = "Cumulative Layout Shift (CLS)"
301
+ row = 16
302
+ column = 1
303
+ height = 3
304
+ width = 4
305
+
306
+ nrql_query {
307
+ query = "FROM SyntheticCheck SELECT average(custom.cumulativeLayoutShift) FACET custom.url"
308
+ }
309
+ }
310
+
311
+ widget_line {
312
+ title = "Cumulative Layout Shift (CLS)"
313
+ row = 16
314
+ column = 5
315
+ height = 3
316
+ width = 8
317
+
318
+ nrql_query {
319
+ query = "FROM SyntheticCheck SELECT average(custom.cumulativeLayoutShift) FACET custom.url TIMESERIES AUTO"
320
+ }
321
+ }
322
+
323
+ widget_bar {
324
+ title = "Speed Index"
325
+ row = 19
326
+ column = 1
327
+ height = 3
328
+ width = 4
329
+
330
+ nrql_query {
331
+ query = "FROM SyntheticCheck SELECT average(custom.speedIndex) FACET custom.url"
332
+ }
333
+ }
334
+
335
+ widget_line {
336
+ title = "Speed Index - trading"
337
+ row = 19
338
+ column = 5
339
+ height = 3
340
+ width = 8
341
+
342
+ nrql_query {
343
+ query = "FROM SyntheticCheck SELECT average(custom.speedIndex) FACET custom.url TIMESERIES AUTO"
344
+ }
345
+ }
346
+ }
347
+ }
@@ -0,0 +1,46 @@
1
+ /** API SETUP - remove this section to run in New Relic Synthetics **/
2
+ // if ($http == null) { var $http = require('request'); }
3
+ /** API SETUP - remove this section to run in New Relic Synthetics **/
4
+
5
+ var settings = {
6
+ url: 'https://newskit-render.prod.ceng.newsuk.tech/',
7
+ category: 'performance',
8
+ strategy: 'desktop',
9
+ }
10
+
11
+ var options = {
12
+ method: 'GET',
13
+ url: 'https://www.googleapis.com/pagespeedonline/v5/runPagespeed',
14
+ headers: null,
15
+ qs: settings,
16
+ json: true,
17
+ }
18
+
19
+ $http(options, function (error, response, body) {
20
+ if (!error && response.statusCode == 200) {
21
+ if (response.statusCode == 200) {
22
+ var lighthouseMetrics =
23
+ body.lighthouseResult.audits.metrics.details.items[0]
24
+ $util.insights.set('url', settings.url)
25
+ $util.insights.set('deviceType', settings.strategy)
26
+ $util.insights.set(
27
+ 'performanceScore',
28
+ body.lighthouseResult.categories.performance.score
29
+ )
30
+
31
+ for (var attributeName in lighthouseMetrics) {
32
+ if (lighthouseMetrics.hasOwnProperty(attributeName)) {
33
+ if (!attributeName.includes('Ts')) {
34
+ console.log(attributeName + ': ' + lighthouseMetrics[attributeName])
35
+ $util.insights.set(attributeName, lighthouseMetrics[attributeName])
36
+ }
37
+ }
38
+ }
39
+ } else {
40
+ console.log('Non-200 HTTP response: ' + response.statusCode)
41
+ }
42
+ } else {
43
+ console.log('rsp code: ' + response.statusCode)
44
+ console.log(error)
45
+ }
46
+ })
@@ -0,0 +1,46 @@
1
+ /** API SETUP - remove this section to run in New Relic Synthetics **/
2
+ // if ($http == null) { var $http = require('request'); }
3
+ /** API SETUP - remove this section to run in New Relic Synthetics **/
4
+
5
+ var settings = {
6
+ url: 'https://newskit-render.ceng-dev.newsuk.tech/',
7
+ category: 'performance',
8
+ strategy: 'desktop',
9
+ }
10
+
11
+ var options = {
12
+ method: 'GET',
13
+ url: 'https://www.googleapis.com/pagespeedonline/v5/runPagespeed',
14
+ headers: null,
15
+ qs: settings,
16
+ json: true,
17
+ }
18
+
19
+ $http(options, function (error, response, body) {
20
+ if (!error && response.statusCode == 200) {
21
+ if (response.statusCode == 200) {
22
+ var lighthouseMetrics =
23
+ body.lighthouseResult.audits.metrics.details.items[0]
24
+ $util.insights.set('url', settings.url)
25
+ $util.insights.set('deviceType', settings.strategy)
26
+ $util.insights.set(
27
+ 'performanceScore',
28
+ body.lighthouseResult.categories.performance.score
29
+ )
30
+
31
+ for (var attributeName in lighthouseMetrics) {
32
+ if (lighthouseMetrics.hasOwnProperty(attributeName)) {
33
+ if (!attributeName.includes('Ts')) {
34
+ console.log(attributeName + ': ' + lighthouseMetrics[attributeName])
35
+ $util.insights.set(attributeName, lighthouseMetrics[attributeName])
36
+ }
37
+ }
38
+ }
39
+ } else {
40
+ console.log('Non-200 HTTP response: ' + response.statusCode)
41
+ }
42
+ } else {
43
+ console.log('rsp code: ' + response.statusCode)
44
+ console.log(error)
45
+ }
46
+ })
@@ -0,0 +1,12 @@
1
+ resource "newrelic_synthetics_monitor" "lighthouse-monitor" {
2
+ name = "${data.newrelic_entity.render_app.name} Lighthouse Monitor"
3
+ type = "SCRIPT_API"
4
+ frequency = 30
5
+ status = "ENABLED"
6
+ locations = ["AWS_EU_WEST_2"]
7
+ }
8
+
9
+ resource "newrelic_synthetics_monitor_script" "lighthouse-script" {
10
+ monitor_id = newrelic_synthetics_monitor.lighthouse-monitor.id
11
+ text = "${var.environment}" == "prod" ? file("${path.module}/lighthouse-script-prod.js") : file("${path.module}/lighthouse-script.js")
12
+ }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@newskit-render/core",
3
- "version": "1.9.0",
3
+ "version": "1.9.3",
4
4
  "description": "Newskit Render - Core package",
5
5
  "author": "",
6
6
  "license": "UNLICENSED",
@@ -31,9 +31,9 @@
31
31
  "@newskit-render/api": "^0.5.0",
32
32
  "@newskit-render/auth": "^0.22.2",
33
33
  "@newskit-render/checkout": "^0.9.0",
34
- "@newskit-render/my-account": "^0.116.1",
34
+ "@newskit-render/my-account": "^0.116.2",
35
35
  "@newskit-render/shared-components": "^0.20.0",
36
- "@newskit-render/sitemap": "^0.25.2",
36
+ "@newskit-render/sitemap": "^0.25.3",
37
37
  "@newskit-render/validation": "^0.27.0",
38
38
  "cross-fetch": "^3.1.4",
39
39
  "graphql": "^15.6.0",
package/tsconfig.json CHANGED
@@ -41,6 +41,6 @@
41
41
  "node_modules",
42
42
  "build",
43
43
  ".circleci",
44
- "temp"
44
+ "temp",
45
45
  ]
46
46
  }