export class MetricCollector {
  constructor() {
    this.reset();
  }

  reset() {
    this.metrics = {
      kafka_pulled: 0,
      parse_error: 0,
      db_inserted: 0,
      db_failed: 0
    };
  }

  increment(metric, count = 1) {
    if (this.metrics.hasOwnProperty(metric)) {
      this.metrics[metric] += count;
    }
  }

  getAndReset() {
    const current = { ...this.metrics };
    this.reset();
    return current;
  }
}
