JSPM

  • ESM via JSPM
  • ES Module Entrypoint
  • Export Map
  • Keywords
  • License
  • Repository URL
  • TypeScript Types
  • README
  • Created
  • Published
  • Downloads 9310
  • Score
    100M100P100Q134093F
  • License MIT

Send samples to prometheus via remote_write from NodeJS

Package Exports

  • prometheus-remote-write
  • prometheus-remote-write/index.js

This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (prometheus-remote-write) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.

Readme

Push timeseries to prometheus

Using remote_write facility (see https://prometheus.io/docs/prometheus/latest/configuration/configuration/#remote_write) to send metrics from NodeJS app.

Pretty much anything from https://prometheus.io/docs/operating/integrations/#remote-endpoints-and-storage should be supported, but tested only with grafana.com:

(list copied from https://github.com/prometheus/docs/blob/main/content/docs/operating/integrations.md)

Usage:

import pushTimeseries from "prometheus-remote-write";

const config = {
  url: "http://localhost:9201",
  auth: {
    username: "...",
    password: "...",
  },
  proto: undefined,
  console: undefined,
  verbose: false,
  timing: false,
};

pushTimeseries(
  {
    labels: {
      __name__: "queue_depth_total",
      instance: "dev.example.com",
      service: "SQS",
    },
    samples: [
      {
        value: 150,
        timestamp: Date.now(),
      },
    ],
  },
  config
)