Skip to content
This repository has been archived by the owner on Aug 25, 2021. It is now read-only.

Commit

Permalink
fix: fix object set in collector
Browse files Browse the repository at this point in the history
  • Loading branch information
czy88840616 committed Oct 25, 2018
1 parent b7ee0ed commit 1892456
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 10 deletions.
10 changes: 5 additions & 5 deletions packages/metrics/src/collect/CompactMetricsCollector.ts
Original file line number Diff line number Diff line change
Expand Up @@ -72,21 +72,21 @@ export class CompactMetricsCollector extends MetricsCollector {
let totalCount = new BigNumber();
let totalRt = new BigNumber();
let successCount = new BigNumber();
let hitCount = new BigNumber(-1);
let hitCount = new BigNumber(-1, -1);

let countPerCategory = fastCompass.getMethodCountPerCategory(start);
for (let [ key, value ] of countPerCategory.entries()) {
if (value.has(start)) {
this.addMetricWithSuffix(name, key + '_bucket_count', value.get(start).toString(), start,
MetricObject.MetricType.DELTA, bucketInterval);

totalCount.add(value.get(start));
totalCount = totalCount.add(value.get(start));
if ('success' === key) {
successCount.add(value.get(start));
successCount = successCount.add(value.get(start));
}
if ('hit' === key) {
hitCount = value.get(start);
successCount.add(value.get(start));
successCount = successCount.add(value.get(start));
}
} else {
this.addMetricWithSuffix(name, key + '_bucket_count', 0, start,
Expand All @@ -96,7 +96,7 @@ export class CompactMetricsCollector extends MetricsCollector {

for (let value of fastCompass.getMethodRtPerCategory(start).values()) {
if (value.has(start)) {
totalRt.add(value.get(start));
totalRt = totalRt.add(value.get(start));
}
}
this.addMetricWithSuffix(name, 'bucket_count', totalCount.toString(), start,
Expand Down
10 changes: 5 additions & 5 deletions packages/metrics/src/collect/NormalMetricsCollector.ts
Original file line number Diff line number Diff line change
Expand Up @@ -73,21 +73,21 @@ export class NormalMetricsCollector extends MetricsCollector {
let totalCount = new BigNumber();
let totalRt = new BigNumber();
let successCount = new BigNumber();
let hitCount = new BigNumber(-1);
let hitCount = new BigNumber(-1, -1);

let countPerCategory = fastCompass.getMethodCountPerCategory(start);
for (let [ key, value ] of countPerCategory.entries()) {
if (value.has(start)) {
this.addMetricWithSuffix(name, key + '_bucket_count', value.get(start).toString(), start,
MetricObject.MetricType.DELTA, bucketInterval);

totalCount.add(value.get(start));
totalCount = totalCount.add(value.get(start));
if ('success' === key) {
successCount.add(value.get(start));
successCount = successCount.add(value.get(start));
}
if ('hit' === key) {
hitCount = value.get(start);
successCount.add(value.get(start));
successCount = successCount.add(value.get(start));
}
} else {
this.addMetricWithSuffix(name, key + '_bucket_count', 0, start,
Expand All @@ -97,7 +97,7 @@ export class NormalMetricsCollector extends MetricsCollector {

for (let value of fastCompass.getMethodRtPerCategory(start).values()) {
if (value.has(start)) {
totalRt.add(value.get(start));
totalRt = totalRt.add(value.get(start));
}
}
this.addMetricWithSuffix(name, 'bucket_count', totalCount.toString(), start,
Expand Down

0 comments on commit 1892456

Please sign in to comment.