Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use browsertime runTime for Graphite/Influx and Grafana annotations and data. #3900

Merged
merged 3 commits into from
Jul 7, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 9 additions & 1 deletion lib/plugins/grafana/index.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
import dayjs from 'dayjs';

import { SitespeedioPlugin } from '@sitespeed.io/plugin';

import { send } from './send-annotation.js';
Expand Down Expand Up @@ -90,13 +92,19 @@ export default class GrafanaPlugin extends SitespeedioPlugin {
this.alias[message.url]
);
this.receivedTypesThatFireAnnotations[message.url] = 0;

const timestamp =
message.type === 'browsertime.pageSummary'
? dayjs(message.runTime)
: this.timestamp;

return send(
message.url,
message.group,
absolutePagePath,
this.useScreenshots,
this.screenshotType,
this.timestamp,
timestamp,
this.tsdbType,
this.alias,
this.wptExtras[message.url],
Expand Down
19 changes: 15 additions & 4 deletions lib/plugins/graphite/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -149,11 +149,16 @@ export default class GraphitePlugin extends SitespeedioPlugin {
// TODO Here we could add logic to either create a new timestamp or
// use the one that we have for that run. Now just use the one for the
// run
let timestamp = this.timestamp;
if (
message.type === 'browsertime.run' ||
message.type === 'browsertime.pageSummary'
) {
timestamp = dayjs(message.runTime);
}
const dataPoints = this.dataGenerator.dataFromMessage(
message,
message.type === 'browsertime.run'
? dayjs(message.runTime)
: this.timestamp,
timestamp,
this.alias
);

Expand All @@ -176,13 +181,19 @@ export default class GraphitePlugin extends SitespeedioPlugin {
message.url,
this.alias[message.url]
);

const timestamp =
message.type === 'browsertime.pageSummary'
? dayjs(message.runTime)
: this.timestamp;

return send(
message.url,
message.group,
absolutePagePath,
this.useScreenshots,
this.screenshotType,
this.timestamp,
timestamp,
this.alias,
this.wptExtras[message.url],
this.usingBrowsertime,
Expand Down
6 changes: 5 additions & 1 deletion lib/plugins/influxdb/index.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
import isEmpty from 'lodash.isempty';
import intel from 'intel';
import dayjs from 'dayjs';

import { SitespeedioPlugin } from '@sitespeed.io/plugin';
import { InfluxDBSender as Sender } from './sender.js';
import { InfluxDB2Sender as SenderV2 } from './senderV2.js';
Expand Down Expand Up @@ -125,7 +127,9 @@ export default class InfluxDBPlugin extends SitespeedioPlugin {

let data = this.dataGenerator.dataFromMessage(
message,
this.timestamp,
message.type === 'browsertime.pageSummary'
? dayjs(message.runTime)
: this.timestamp,
this.alias
);

Expand Down