const counters = new Map<string, number>();

export const incrementMetric = (name: string, value = 1): void => {
  counters.set(name, (counters.get(name) ?? 0) + value);
};

export const getAllMetrics = (): Record<string, number> => {
  const result: Record<string, number> = {};

  for (const [key, value] of counters.entries()) {
    result[key] = value;
  }

  return result;
};
