prom-client#register TypeScript Examples

The following examples show how to use prom-client#register. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: target.ts    From fuse-prom-target with GNU Affero General Public License v3.0 5 votes vote down vote up
app.get("/metrics", async (_, res) => {
  res.set("Content-Type", register.contentType);
  res.end(await register.metrics());
});
Example #2
Source File: metrics.ts    From backstage with Apache License 2.0 5 votes vote down vote up
export function createCounterMetric<T extends string>(
  config: CounterConfiguration<T>,
): Counter<T> {
  const existing = register.getSingleMetric(config.name) as Counter<T>;
  return existing || new Counter<T>(config);
}
Example #3
Source File: metrics.ts    From backstage with Apache License 2.0 5 votes vote down vote up
export function createGaugeMetric<T extends string>(
  config: GaugeConfiguration<T>,
): Gauge<T> {
  const existing = register.getSingleMetric(config.name) as Gauge<T>;
  return existing || new Gauge<T>(config);
}
Example #4
Source File: metrics.ts    From backstage with Apache License 2.0 5 votes vote down vote up
export function createSummaryMetric<T extends string>(
  config: SummaryConfiguration<T>,
): Summary<T> {
  const existing = register.getSingleMetric(config.name) as Summary<T>;
  return existing || new Summary<T>(config);
}
Example #5
Source File: metrics.ts    From backstage with Apache License 2.0 5 votes vote down vote up
export function createHistogramMetric<T extends string>(
  config: HistogramConfiguration<T>,
): Histogram<T> {
  const existing = register.getSingleMetric(config.name) as Histogram<T>;
  return existing || new Histogram<T>(config);
}
Example #6
Source File: prometheus.ts    From polkadot-registrar-watcher with Apache License 2.0 5 votes vote down vote up
injectMetricsRoute(app: express.Application): void {
        app.get('/metrics', (req: express.Request, res: express.Response) => {
            res.set('Content-Type', register.contentType)
            res.end(register.metrics())
        })
    }