Skip to content

Commit

Permalink
Merge pull request #19 from zencrepes/develop
Browse files Browse the repository at this point in the history
Updated zqueue with the perf dataset
  • Loading branch information
Fgerthoffert authored Oct 3, 2021
2 parents 121d932 + a677239 commit 94bfdc6
Show file tree
Hide file tree
Showing 3 changed files with 32 additions and 7 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@
"@bit/zencrepes.zindexer.github-repos": "^0.0.16",
"@bit/zencrepes.zindexer.github-stargazers": "^0.0.10",
"@bit/zencrepes.zindexer.github-watchers": "^0.0.10",
"@bit/zencrepes.zindexer.testing-perfs": "^0.0.28",
"@bit/zencrepes.zindexer.testing-perfs": "^0.0.30",
"@bit/zencrepes.zindexer.testing-runs": "^0.0.3",
"@bit/zencrepes.zindexer.testing-states": "^0.0.5",
"@elastic/elasticsearch": "^7.9.0",
Expand Down
29 changes: 27 additions & 2 deletions src/perfs/perfsStorePayload.processor.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import { Process, Processor } from '@nestjs/bull';
import { Logger } from '@nestjs/common';
import { Job } from 'bull';

import { esMapping, esSettings, PerfNode, getId } from '@bit/zencrepes.zindexer.testing-perfs';
import { esMapping, esSettings, getId } from '@bit/zencrepes.zindexer.testing-perfs';
import { checkEsIndex, pushEsNodes } from '@bit/zencrepes.zindexer.es-utils';

import { ConfigService } from '../config.service';
Expand All @@ -29,9 +29,21 @@ export class PerfsStorePayloadProcessor {
// Check if the index exists, create it if it does not
await checkEsIndex(esClient, userConfig.elasticsearch.dataIndices.testingPerfs, esMapping, esSettings, console.log);

// From the job data, get an array containing all available transaction name
const transactionNames = []
for (const run of job.data.runs) {
for (const [k, v] of Object.entries(run.statistics)) {
const transaction: any = v
if (!transactionNames.includes(transaction.transaction)) {
transactionNames.push(transaction.transaction)
}
}
}

// Transforming the object, objective is just to match to GitHub's to be consistent with the rest of the app
const state: PerfNode = {
const state = {
...job.data,
id: getId(job.data),
resources: {
edges: job.data.resources.map((r) => {
return {
Expand All @@ -43,11 +55,24 @@ export class PerfsStorePayloadProcessor {
}),
totalCount: job.data.resources.length
},
transactions: {
edges: transactionNames.map((t) => {
return {
node: {
name: t,
}
}
}),
totalCount: transactionNames.length
},
runs: {
edges: job.data.runs.map((r) => {
return {
node: {
...r,
statistics: Object.entries(r.statistics).map((e: any) => {
return e[1]
}),
id: getId(r)
}
}
Expand Down
8 changes: 4 additions & 4 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -412,10 +412,10 @@
dependencies:
graphql-tag "^2.10.1"

"@bit/zencrepes.zindexer.testing-perfs@^0.0.28":
version "0.0.28"
resolved "https://node.bit.dev/zencrepes.zindexer.testing-perfs/-/zencrepes.zindexer.testing-perfs-0.0.28.tgz#8290f016311bea0a4acb38a1139da116ac909295"
integrity sha1-gpDwFjEb6gpKyzihE52hFqyQkpU=
"@bit/zencrepes.zindexer.testing-perfs@^0.0.30":
version "0.0.30"
resolved "https://node.bit.dev/zencrepes.zindexer.testing-perfs/-/zencrepes.zindexer.testing-perfs-0.0.30.tgz#efa9ceb225d8a4e21c2b22fad3ff3ebca5fca996"
integrity sha1-76nOsiXYpOIcKyL60/8+vKX8qZY=
dependencies:
"@types/uuid" "^8.3.0"
uuid "^8.3.1"
Expand Down

0 comments on commit 94bfdc6

Please sign in to comment.