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

Add additional percentile metrics to server queries and update templates #325

Merged
merged 4 commits into from
Jun 1, 2024
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
6 changes: 5 additions & 1 deletion src/server/data-stats/prepare-data.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -224,6 +224,8 @@ describe("prepare data", () => {
bytes_sent_total: 69848465,
total: 46596,
n90: 271,
n95: 272,
n99: 273,
number_of_failed: 3,
}
const labelsData = [
Expand Down Expand Up @@ -303,7 +305,9 @@ describe("prepare data", () => {
const { overview, labelStats } = prepareDataForSavingToDb(overviewData, labelsData, [],
statusCodes, responseFailures, apdex, groupedErrors, labelErrors)
expect(overview).toEqual({
percentil: 271,
percentile90: 271,
percentile95: 272,
percentile99: 273,
maxVu: undefined,
avgResponseTime: 106,
errorRate: 0.01,
Expand Down
8 changes: 6 additions & 2 deletions src/server/data-stats/prepare-data.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,9 @@ export const prepareDataForSavingToDb = (overviewData, labelData, sutStats, stat
const endDate = new Date(overviewData.end)
return {
overview: {
percentil: roundNumberTwoDecimals(overviewData.n90),
percentile90: roundNumberTwoDecimals(overviewData.n90),
percentile95: roundNumberTwoDecimals(overviewData.n95),
percentile99: roundNumberTwoDecimals(overviewData.n99),
maxVu: undefined,
avgResponseTime: Math.round(overviewData.avg_response),
errorRate: roundNumberTwoDecimals((overviewData.number_of_failed / overviewData.total) * 100),
Expand Down Expand Up @@ -441,7 +443,9 @@ interface ChartLabelData {
}

export interface Overview {
percentil: number
percentile90: number
percentile95: number
percentile99: number
errorRate: number
errorCount: number
throughput: number
Expand Down
2 changes: 2 additions & 0 deletions src/server/queries/items.ts
Original file line number Diff line number Diff line change
Expand Up @@ -241,6 +241,8 @@ export const aggOverviewQuery = (itemId) => {
text: `
SELECT
percentile_cont(0.90) within group (order by (samples.elapsed))::real as n90,
percentile_cont(0.95) within group (order by (samples.elapsed))::real as n95,
percentile_cont(0.99) within group (order by (samples.elapsed))::real as n99,
COUNT(DISTINCT samples.hostname)::int number_of_hostnames,
COUNT(DISTINCT samples.sut_hostname)::int number_of_sut_hostnames,
MAX(samples.timestamp) as end,
Expand Down
4 changes: 3 additions & 1 deletion src/server/schema-validator/project-schema.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,9 @@ export const updateProjectSchema = {
topMetricsSettings: Joi.object({
virtualUsers: Joi.boolean().required(),
errorRate: Joi.boolean().required(),
percentile: Joi.boolean().required(),
percentile90: Joi.boolean().required(),
percentile95: Joi.boolean().required(),
percentile99: Joi.boolean().required(),
throughput: Joi.boolean().required(),
network: Joi.boolean().required(),
avgLatency: Joi.boolean().required(),
Expand Down
4 changes: 3 additions & 1 deletion src/server/utils/notifications/send-notification.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,9 @@ jest.mock("./templates/report/ms-teams-template")
jest.mock("../../../db/db")

const OVERVIEW = {
percentil: 10,
percentile90: 10,
percentile95: 14,
percentile99: 18,
avgConnect: 1,
avgLatency: 1,
avgResponseTime: 1,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,9 @@ import { gchatTemplate } from "./gchat-template"

describe("GChat template", () => {
const OVERVIEW = {
percentil: 10,
percentile90: 10,
percentile95: 14,
percentile99: 18,
avgConnect: 1,
avgLatency: 1,
avgResponseTime: 1,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ export const gchatTemplate = (scenarioName: string, url, overview: Overview) =>
{
keyValue: {
topLabel: "90% percentile",
content: `${overview.percentil} ms`,
content: `${overview.percentile90} ms`,
},
},
{ keyValue: { topLabel: "Throughput", content: `${overview.throughput} reqs/s` } },
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,9 @@ import { msTeamsTemplate } from "./ms-teams-template"

describe("MS Teams template", () => {
const OVERVIEW = {
percentil: 10,
percentile90: 10,
percentile95: 14,
percentile99: 18,
avgConnect: 1,
avgLatency: 1,
avgResponseTime: 1,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ export const msTeamsTemplate = (scenarioName: string, url, overview: Overview) =
},
{
title: "90% percentile",
value: overview.percentil + " ms",
value: overview.percentile90 + " ms",
},
{
title: "Throughput",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,9 @@ import { slackTemplate } from "./slack-template"

describe("Slack template", () => {
const OVERVIEW = {
percentil: 10,
percentile90: 10,
percentile95: 14,
percentile99: 18,
avgConnect: 1,
avgLatency: 1,
avgResponseTime: 1,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ export const slackTemplate = (scenarioName: string, url, overview: Overview) =>
}, { type: "divider" }, {
type: "section",
fields: [{ type: "mrkdwn", text: `*Error Rate*\n${overview.errorRate}%` }],
}, { type: "section", fields: [{ type: "mrkdwn", text: `*90% percentile*\n${overview.percentil} ms` }] }, {
}, { type: "section", fields: [{ type: "mrkdwn", text: `*90% percentile*\n${overview.percentile90} ms` }] }, {
type: "section",
fields: [{ type: "mrkdwn", text: `*Throughput*\n${overview.throughput} reqs/s` }],
}, { type: "section", fields: [{ type: "mrkdwn", text: `*Duration*\n${overview.duration} min` }] }],
Expand Down
Loading