Socket
Book a DemoInstallSign in
Socket

hypercore-stats

Package Overview
Dependencies
Maintainers
2
Versions
12
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

hypercore-stats

Stats for Hypercores, with Prometheus support

latest
Source
npmnpm
Version
2.4.0
Version published
Maintainers
2
Created
Source

Hypercore Stats

Stats for Hypercores, with Prometheus support.

Assumes the hypercores are replicated over UDX streams. This is the case for all normal use-cases of hypercores (like replicating across hyperdht/hyperswarm).

Install

npm i hypercore-stats

Versions

  • V1 works for Hypercore V10 and Corestore V6
  • V2 works for Hypercore V11 and Corestore V7

Usage

const Corestore = require('corestore')
const HypercoreStats = require('hypercore-stats')
const promClient = require('prom-client')

const store = new Corestore('dummy-corestore')

const hypercoreStats = await HypercoreStats.fromCorestore(store)
hypercoreStats.registerPrometheusMetrics(promClient)

// The Prometheus metrics are typically collected by a metrics scraper, but we just print them here to illustrate
const metrics = await promClient.register.metrics()
console.log(metrics)

Usage Without Prometheus

hypercoreStats.toString() returns a string representation of all stats.

hypercoreStats.toJson() returns a json representation of all stats.

Keywords

hypercore

FAQs

Package last updated on 07 Aug 2025

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts