message: fix: fix net traffic metrics get empty value
diff: @@ -12,19 +12,13 @@ const fieldNames = ['net.in.bytes', 'net.in.packets', 'net.in.errs', 'net.in.dro
  const getEmptyFields = () => Array(16).map(() => 0);
  -
  export class NetTrafficGaugeSet extends CachedMetricSet {
  -
  static DEFAULT_FILE_PATH = '/proc/net/dev';
  -
  -
  filePath: string;
  -
  countStats = {};
  rateStats = {};
  -
  constructor(dataTTL = 5, filePath = NetTrafficGaugeSet.DEFAULT_FILE_PATH) {
  super(dataTTL);
  this.filePath = filePath;
  @@ -34,8 +28,6 @@ export class NetTrafficGaugeSet extends CachedMetricSet {
  let self = this;
  let gauges = [];
  - self.refreshIfNecessary();
  -
  for (const interfaceName in this.countStats) {
  let i = 0;
  for (const fieldName of fieldNames) {
  @@ -43,6 +35,7 @@ export class NetTrafficGaugeSet extends CachedMetricSet {
  name: MetricName.build(`nettraffic.${interfaceName}.${fieldName}`),
  metric: <Gauge<number>> {
  getValue() {
  + self.refreshIfNecessary();
  return self.countStats[interfaceName][i++];
  }
  }
  @@ -54,8 +47,6 @@ export class NetTrafficGaugeSet extends CachedMetricSet {
  }
  getValueInternal() {
  -
  -
  const self = this;
  let content;
  try {
  @@ -89,14 +80,12 @@ export class NetTrafficGaugeSet extends CachedMetricSet {
  }
  debug(`looping ${interfaceName}`);
  - for (let i = 0; i < stats.length;) {
  -
  + for (let i = 0; i < stats.length; i++) {
  const count = stats[i];
  const delta = count - this.countStats[interfaceName][i];
  this.countStats[interfaceName][i] = count;
  const duration = Date.now() - this.lastCollectTime;
  this.rateStats[interfaceName][i] = 1000.0 * delta / duration;
  - i++;
  }
  }
  }
  