Skip to content
Merged
Show file tree
Hide file tree
Changes from 2 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
2 changes: 1 addition & 1 deletion packages/bson-bench/src/common.ts
Original file line number Diff line number Diff line change
Expand Up @@ -175,12 +175,12 @@ export type PerfSendMetricType =
export type PerfSendResult = {
info: {
test_name: string;
tags?: string[];
args: Record<string, number>;
};
metrics: {
name: string;
value: number;
metadata: { tags?: string[]; improvement_direction?: 'up' | 'down' };
type?: PerfSendMetricType;
version?: number;
}[];
Expand Down
17 changes: 11 additions & 6 deletions packages/bson-bench/src/task.ts
Original file line number Diff line number Diff line change
Expand Up @@ -108,10 +108,10 @@ export class Task {
};
const optionsWithNumericFields = convertOptions(this.benchmark.options);

const metadata = { tags: this.benchmark.tags };
const perfSendResults: PerfSendResult = {
info: {
test_name: this.testName,
tags: this.benchmark.tags,
args: {
warmup: this.benchmark.warmup,
iterations: this.benchmark.iterations,
Expand All @@ -122,27 +122,32 @@ export class Task {
{
name: 'mean_megabytes_per_second',
type: 'MEAN',
value: meanThroughputMBps
value: meanThroughputMBps,
metadata
},
{
name: 'median_megabytes_per_second',
type: 'MEDIAN',
value: medianThroughputMBps
value: medianThroughputMBps,
metadata
},
{
name: 'min_megabytes_per_second',
type: 'MIN',
value: minThroughputMBps
value: minThroughputMBps,
metadata
},
{
name: 'max_megabytes_per_second',
type: 'MAX',
value: maxThroughputMBps
value: maxThroughputMBps,
metadata
},
{
name: 'stddev_megabytes_per_second',
type: 'STANDARD_DEVIATION',
value: throughputMBpsStddev
value: throughputMBpsStddev,
metadata
}
]
};
Expand Down
6 changes: 4 additions & 2 deletions packages/bson-bench/test/unit/task.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -151,8 +151,10 @@ describe('Task', function () {
expect(results.info).to.haveOwnProperty('args');
});

it('returns the tags in the info.tags field', function () {
expect(results.info.tags).to.deep.equal(['test', 'test2']);
it('returns the tags in the info.metrics.metadata field', function () {
for (const m of results.metrics) {
expect(m.metadata.tags).to.deep.equal(['test', 'test2']);
}
});

it('returns options provided in constructor in the info.args field', function () {
Expand Down
Loading