hyperdht-prometheus-bridge
v2.1.1
Published
Bridge to scrape Prometheus metrics fully peer to peer
Downloads
31
Maintainers
Readme
hyperdht-prometheus-bridge
A bridge to scrape Prometheus metrics from self-registering services, all using direct, end-to-end encrypted peer-to-peer connections (not http).
Service discovery is done with a decentralised hash table (HyperDHT). This means that both this service and the clients it scrapes can live behind a firewall and need no reverse proy nor DNS entries.
An advantage is the small amount of configuration required. Clients register themselves with the hyperdht-prometheus-bridge service, so no manual list of targets needs to be maintained. All a client needs to register itself, is the hyperdht-prometheus-bridge service's public key, and a shared secret.
Deployment
hyperdht-prometheus-bridge is meant to be deployed alongside Prometheus. It manages a single targets.json file referenced from the main prometheus configuration (See prometheus/prometheus.yml for an example).
The hyperdht-prometheus-bridge service fulfils two complementary roles:
- It maintains a
targets.jsonfile with aliases to all services which Prometheus should scrape. - It provides an HTTP server which receives Prometheus requests and forwards them to the instances of hyperdht-prometheus-client.
Run
Configuration is done through environment variables:
HYPERDHT_PROM_KEY_PAIR_SEED: 32-byte seed passed toHyperDHT.keyPair(), set as hex or z32. Set this to have a consistent public key (otherwise random, which is only useful for tests).HYPERDHT_PROM_SHARED_SECRET: 32-byte secret key, set as hex or z32.HYPERDHT_PROM_LOG_LEVEL: defaults to infoHYPERDHT_PROM_HTTP_PORT: port where the http server listens. Defaults to a random port.HYPERDHT_PROM_HTTP_HOST: host where the http server listens. Defaults to 127.0.0.1
CLI
Install:
npm i -g hyperdht-prometheus-bridgeRun:
HYPERDHT_PROM_PROMETHEUS_TARGETS_LOC=path/to/prometheus/targets.json HYPERDHT_PROM_HTTP_PORT=30000 HYPERDHT_PROM_SHARED_SECRET=<A 64 character hex string> hyperdht-prometheus-bridgeTest
npm testIntegration tests are also included:
npm run integrationNote: the integration tests run ./prep-integration-test.sh, which downloads Prometheus and copies the executable to the ./prometheus directory.
Fork
Forked on 2026-06-17 from https://gitlab.com/dcent-tech/dht-prometheus/, licensed under Apache-2.0. See NOTICE.
