Skip to content

Commit f324e3a

Browse files
authored
Fix metric names (#270)
Fix metrics
1 parent a9ec769 commit f324e3a

File tree

2 files changed

+4
-4
lines changed

2 files changed

+4
-4
lines changed

src/datastore/LMDB.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -148,7 +148,7 @@ export class LMDBStoreFactory implements DataStoreFactory {
148148
this.telemetry.registerGaugeProvider(`store.${name}.entries`, () => stat.entries);
149149
}
150150

151-
this.telemetry.registerGaugeProvider('total.usage', () => (100 * totalBytes) / TotalMaxDbSize, {
151+
this.telemetry.registerGaugeProvider('total.usage', () => 100 * (totalBytes / TotalMaxDbSize), {
152152
unit: '%',
153153
});
154154
this.telemetry.registerGaugeProvider('total.size', () => totalBytes, {

src/telemetry/TelemetryService.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -102,10 +102,10 @@ export class TelemetryService implements Closeable {
102102
);
103103

104104
telemetry.registerGaugeProvider(
105-
'process.memory.heap.usage_percent',
105+
'process.memory.heap.usage',
106106
() => {
107107
const usage = process.memoryUsage();
108-
return Math.round((usage.heapUsed / usage.heapTotal) * 100);
108+
return 100 * (usage.heapUsed / usage.heapTotal);
109109
},
110110
{ unit: '%' },
111111
);
@@ -127,7 +127,7 @@ export class TelemetryService implements Closeable {
127127

128128
if (timeDiffMicros > 0) {
129129
const utilization = ((userDiff + systemDiff) / timeDiffMicros) * 100;
130-
const clampedUtilization = Math.min(Math.max(Math.round(utilization * 100) / 100, 0), 100);
130+
const clampedUtilization = Math.min(Math.max(utilization, 0), 100);
131131

132132
lastCpuUsage = currentUsage;
133133
lastTime = currentTime;

0 commit comments

Comments
 (0)