{
"repo": "hyper-instrument",
"timestamp": "2026-01-16T23:56:24.154Z",
"entryPoint": "index.js",
"exports": {
"packageJson": {
"main": "index.js"
}
},
"api": {
"file": "index.js",
"exports": [
{
"type": "default",
"name": "HyperInstrumentation"
}
],
"classes": [
{
"name": "HyperInstrumentation"
}
],
"functions": [
{
"name": "registerPackageVersion"
},
{
"name": "registerModuleVersions"
},
{
"name": "registerProcessId"
}
]
},
"readme": {
"content": "# Hyper Instrument\n\nInstrument services in the Hypercore ecosystem.\n\nSupports both the Node.js and [bare](https://github.com/holepunchto/bare) runtimes.\n\nSupports the metrics of\n\n- [hypercore-stats](https://github.com/holepunchto/hypercore-stats)\n- [hyperswarm-stats](https://github.com/holepunchto/hyperswarm-stats)\n- [hyperdht-stats](https://github.com/holepunchto/hyperdht-stats)\n\nThe service registers itself with a [DHT Prometheus](https://gitlab.com/dcent-tech/dht-prometheus) instance, which scrapes the metrics at regular intervals.\n\nA [Grafana dashboard](https://grafana.com/grafana/dashboards/22313-hypercore-hyperswarm/) visualising all metrics is available ([source](https://github.com/holepunchto/Grafana-hypercore-stats)).\n\n## Install\n\n```\nnpm i hyper-instrument\n```\n\n## Versions\n\n- V1 works for Hypercore V10 and Corestore V6. It has a different API, so make sure to look at the V1 README.\n- V2 works for Hypercore v11 and Corestore v7\n\n## Usage\n\n```\nconst HyperInstrument = require('h",
"sections": [
"intro",
"install",
"versions",
"usage",
"api"
],
"hasApi": true,
"hasExamples": true,
"exampleCount": 2,
"examples": [
"npm i hyper-instrument",
"const HyperInstrument = require('hyper-instrument')\nconst Hyperdht = require('hyperdht')\nconst { version } = require('./package.json') // version of your own module\n\nconst scraperPublicKey = // Public key of the metrics scraper\nconst scraperSecret = // Secret of the metrics scraper\nconst prometheusAlias = // unique alias identifying this instance\nconst prometheusServiceName = // the name of the service\n\nconst dht = new Hyperdht()\n\nconst instrumentation = new HyperInstrument({\n dht,\n scraperPublicKey,\n scraperSecret,\n prometheusAlias,\n prometheusServiceName,\n version\n})\n\n// You can add additional metrics\nnew instrumentation.promClient.Gauge({\n name: 'my_custom_metric',\n help: 'my custom metric help',\n collect () {\n return 1 // dummy metric\n }\n})\n\n// If you want to see instrumentation-related logs:\ninstrumentation.registerLogger()\n\n// start the scraping\nawait instrumentation.ready()"
]
},
"patterns": [
"append-only-log",
"peer-discovery",
"dht-discovery"
]
}