Skip to content

Commit ab67f2e

Browse files
committed
improve loop performance
1 parent 12f5965 commit ab67f2e

2 files changed

Lines changed: 5 additions & 5 deletions

File tree

app.js

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,7 @@ const cpuUsageGauge = meter.createObservableGauge(`${metricPrefix}_cpu_usage`, {
6161
description: 'CPU usage percentage', valueType: ValueType.DOUBLE
6262
});
6363

64-
const runInTimeGauge = meter.createObservableGauge(`${metricPrefix}_run_time`, {
64+
const runTimeGauge = meter.createObservableGauge(`${metricPrefix}_run_time`, {
6565
description: 'Run time in seconds', valueType: ValueType.INT
6666
});
6767

@@ -96,13 +96,13 @@ cpuUsageGauge.addCallback((observableResult) => {
9696
});
9797

9898

99-
runInTimeGauge.addCallback((observableResult) => {
99+
runTimeGauge.addCallback((observableResult) => {
100100
for (let i = 0; i < workflowIDs.length; i++) {
101101
const workflow_id = workflowIDs[i];
102102
for (let j = 0; j < customerIDs.length; j++) {
103103
const customer_id = customerIDs[j];
104-
let run_time = Math.floor(Math.random() * 60);
105-
observableResult.observe(run_time, {
104+
let runTime = Math.floor(Math.random() * 60);
105+
observableResult.observe(runTime, {
106106
...attributes, 'workflow_id': workflow_id, 'customer_id': customer_id
107107
});
108108
}

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "nodejs-otel",
3-
"version": "1.2.2",
3+
"version": "1.2.3",
44
"description": "",
55
"main": "index.js",
66
"scripts": {

0 commit comments

Comments
 (0)