UNPKG

@libp2p/prometheus-metrics

Version:

Collect libp2p metrics for scraping by Prometheus or Graphana

13 lines (11 loc) 322 B
export const ONE_SECOND = 1000 export const ONE_MINUTE = 60 * ONE_SECOND /** * See https://prometheus.io/docs/concepts/data_model/#metric-names-and-labels * for rules on valid naming */ export function normalizeString (str: string): string { return str .replace(/[^a-zA-Z0-9_]/g, '_') .replace(/_+/g, '_') }