Skip to content

Commit

Permalink
Add install and basic usage example
Browse files Browse the repository at this point in the history
  • Loading branch information
HDegroote committed Sep 2, 2024
1 parent 5dbfa84 commit 4d5eb2f
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 0 deletions.
22 changes: 22 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,3 +2,25 @@

Stats for Hypercores, with Prometheus support.

## Install

```
npm i hypercore-stats
```

## Usage

```
const Corestore = require('corestore')
const HypercoreStats = require('hypercore-stats')
const promClient = require('prom-client')
const store = new Corestore('dummy-corestore')
const hypercoreStats = HypercoreStats.fromCorestore(store)
hypercoreStats.registerPrometheusMetrics(promClient)
// The Prometheus metrics are typically exposed to a metrics scraper
const metrics = await promClient.register.metrics()
console.log(metrics)
```
3 changes: 3 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,9 @@
"url": "https://github.com/holepunchto/hypercore-stats/issues"
},
"homepage": "https://github.com/holepunchto/hypercore-stats#readme",
"files": [
"index.js"
],
"devDependencies": {
"brittle": "^3.6.1",
"corestore": "^6.18.4",
Expand Down

0 comments on commit 4d5eb2f

Please sign in to comment.