Skip to content

Commit

Permalink
update PR
Browse files Browse the repository at this point in the history
  • Loading branch information
chentong7 committed Oct 4, 2024
1 parent b1776ec commit 94292d8
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 18 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ module.exports = function handler(fileData, telemetryClient: TelemetryClient): v
},
});
} catch (error) {
console.error(`failed to emit metric ${customDataName}`, error);
console.error(`failed to emit metric '${customDataName}'`, error);
}
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,12 +15,12 @@ module.exports = function handler(fileData, telemetryClient: TelemetryClient): v
const arithmeticMeanMetricName = `${fileData.suiteName}_${testData.benchmarkName}_arithmeticMean`;
try {
const value = testData.customData["Period (ns/op)"];
if (isNaN(value)) {
console.error(`skipping metric ${arithmeticMeanMetricName} with value ${value} as it is not a number`);
if (Number.isNaN(Number.parseFloat(value))) {
console.error(`skipping metric '${arithmeticMeanMetricName}' with value '${value}' as it is not a number`);
continue;
}
console.log(
`emitting metric ${arithmeticMeanMetricName} with value ${value}`,
`emitting metric '${arithmeticMeanMetricName}' with value '${value}'`,
);
telemetryClient.trackMetric({
name: arithmeticMeanMetricName,
Expand All @@ -38,18 +38,21 @@ module.exports = function handler(fileData, telemetryClient: TelemetryClient): v
},
});
} catch (error) {
console.error(`failed to emit metric ${arithmeticMeanMetricName}`, error);
console.error(`failed to emit metric '${arithmeticMeanMetricName}'`, error);
}

const marginOfErrorMetricName = `${fileData.suiteName}_${testData.benchmarkName}_marginOfError`;
try {
const value = testData.customData["Margin of Error"];
if (isNaN(value)) {
console.error(`skipping metric ${marginOfErrorMetricName} with value ${value} as it is not a number`);
let value = testData.customData["Margin of Error"];
value = value.replace('±', '');
const parsedValue = Number.parseFloat(value);

if (Number.isNaN(Number.parseFloat(parsedValue))) {
console.error(`skipping metric '${marginOfErrorMetricName}' with value '${value}' as it is not a number`);
continue;
}
console.log(
`emitting metric ${arithmeticMeanMetricName} with value ${value}`,
`emitting metric '${arithmeticMeanMetricName}' with value '${value}'`,
);
telemetryClient.trackMetric({
name: marginOfErrorMetricName,
Expand All @@ -66,7 +69,7 @@ module.exports = function handler(fileData, telemetryClient: TelemetryClient): v
},
});
} catch (error) {
console.error(`failed to emit metric ${marginOfErrorMetricName}`, error);
console.error(`failed to emit metric '${marginOfErrorMetricName}'`, error);
}
}
};
Original file line number Diff line number Diff line change
Expand Up @@ -15,12 +15,12 @@ module.exports = function handler(fileData, telemetryClient: TelemetryClient): v
const heapUsedAvgMetricName = `${fileData.suiteName}_${testData.benchmarkName}_heapUsedAvg`;
try {
const value = testData.customData["Heap Used Avg"];
if (isNaN(value)) {
console.error(`skipping metric ${heapUsedAvgMetricName} with value ${value} as it is not a number`);
if (Number.isNaN(Number.parseFloat(value))) {
console.error(`skipping metric '${heapUsedAvgMetricName}' with value '${value}' as it is not a number`);
continue;
}
console.log(
`emitting metric ${heapUsedAvgMetricName} with value ${value}`,
`emitting metric '${heapUsedAvgMetricName}' with value '${value}'`,
);
telemetryClient.trackMetric({
name: heapUsedAvgMetricName,
Expand All @@ -37,18 +37,18 @@ module.exports = function handler(fileData, telemetryClient: TelemetryClient): v
},
});
} catch (error) {
console.error(`failed to emit metric ${heapUsedAvgMetricName}`, error);
console.error(`failed to emit metric '${heapUsedAvgMetricName}'`, error);
}

const heapUsedStdDevMetricName = `${fileData.suiteName}_${testData.benchmarkName}_heapUsedStdDev`;
try {
const value = testData.customData["Heap Used StdDev"];
if (isNaN(value)) {
console.error(`skipping metric ${heapUsedStdDevMetricName} with value ${value} as it is not a number`);
if (Number.isNaN(Number.parseFloat(value))) {
console.error(`skipping metric '${heapUsedStdDevMetricName}' with value '${value}' as it is not a number`);
continue;
}
console.log(
`emitting metric ${heapUsedStdDevMetricName} with value ${value}`,
`emitting metric '${heapUsedStdDevMetricName}' with value '${value}'`,
);
telemetryClient.trackMetric({
name: heapUsedStdDevMetricName,
Expand All @@ -65,7 +65,7 @@ module.exports = function handler(fileData, telemetryClient: TelemetryClient): v
},
});
} catch (error) {
console.error(`failed to emit metric ${heapUsedStdDevMetricName}`, error);
console.error(`failed to emit metric '${heapUsedStdDevMetricName}'`, error);
}
}
};

0 comments on commit 94292d8

Please sign in to comment.