import { Counter, Registry, Summary } from "prom-client";

export enum NotifyMetrics {
  DISCORD_LATENCY = "DiscordLatency",
  DISCORD_FAILURE = "DiscordFailure",
  NOTIFY_TIMEOUT = "NotifyTimeout",
  UNAUTHENTICATED_CALL = "UnauthenticatedCall"
}

export const registerMetrics = (metricsRegistry: Registry) => {
  metricsRegistry.registerMetric(new Summary({
    name: NotifyMetrics.DISCORD_LATENCY,
    help: "Latency for the Discord API",
  }));

  metricsRegistry.registerMetric(new Counter({
    name: NotifyMetrics.DISCORD_FAILURE,
    help: "Failure calling discord API",
    labelNames: ['error'],
  }));

  metricsRegistry.registerMetric(new Counter({
    name: NotifyMetrics.NOTIFY_TIMEOUT,
    help: "Timeout before all notify calls completed",
  }));

  metricsRegistry.registerMetric(new Counter({
    name: NotifyMetrics.UNAUTHENTICATED_CALL,
    help: "Call was made to notify without the secret key specified",
  }));
}
