Skip to content

Commit 89582cd

Browse files
committed
print start and end times
1 parent c1c4de2 commit 89582cd

File tree

3 files changed

+41
-2
lines changed

3 files changed

+41
-2
lines changed

woo-checkout.js

+14
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,20 @@ const responseCacheRate = new Rate('response_cached')
4343
// These metrics are provided by Object Cache Pro when `analytics.footnote` is enabled
4444
const metrics = new Metrics();
4545

46+
export function setup () {
47+
return {
48+
startedAt: Date.now(),
49+
}
50+
}
51+
52+
export function teardown (data) {
53+
const startedAt = new Date(data.startedAt)
54+
const endedAt = new Date()
55+
56+
console.info(`Run started at ${startedAt.toJSON()}`)
57+
console.info(`Run ended at ${endedAt.toJSON()}`)
58+
}
59+
4660
export default function () {
4761
const jar = new http.CookieJar()
4862
const siteUrl = __ENV.SITE_URL

woo-customer.js

+14
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,20 @@ const responseCacheRate = new Rate('response_cached')
4141
// These metrics are provided by Object Cache Pro when `analytics.footnote` is enabled
4242
const metrics = new Metrics();
4343

44+
export function setup () {
45+
return {
46+
startedAt: Date.now(),
47+
}
48+
}
49+
50+
export function teardown (data) {
51+
const startedAt = new Date(data.startedAt)
52+
const endedAt = new Date()
53+
54+
console.info(`Run started at ${startedAt.toJSON()}`)
55+
console.info(`Run ended at ${endedAt.toJSON()}`)
56+
}
57+
4458
export default function () {
4559
const jar = new http.CookieJar()
4660
const siteUrl = __ENV.SITE_URL

wp.js

+13-2
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import http from 'k6/http'
2-
import { Rate, Trend } from 'k6/metrics'
2+
import { Rate } from 'k6/metrics'
33

44
import Metrics from './lib/metrics.js'
55
import { sample, validateSiteUrl, validateSitemapUrl, wpSitemap, responseWasCached, bypassPageCacheCookies } from './lib/helpers.js'
@@ -30,7 +30,18 @@ export function setup () {
3030
const sitemapUrl = __ENV.SITEMAP_URL || `${siteUrl}/wp-sitemap.xml`
3131
validateSitemapUrl(sitemapUrl)
3232

33-
return { urls: wpSitemap(sitemapUrl).urls }
33+
return {
34+
startedAt: Date.now(),
35+
urls: wpSitemap(sitemapUrl).urls,
36+
}
37+
}
38+
39+
export function teardown (data) {
40+
const startedAt = new Date(data.startedAt)
41+
const endedAt = new Date()
42+
43+
console.info(`Run started at ${startedAt.toJSON()}`)
44+
console.info(`Run ended at ${endedAt.toJSON()}`)
3445
}
3546

3647
export default function (data) {

0 commit comments

Comments
 (0)