-
Notifications
You must be signed in to change notification settings - Fork 445
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat!: configure metrics implementation as a module instead of shippi…
…ng a built-in version (#1471) Instead of a built-in metrics object, allow the user to pass the metrics collection method of their choice. Currenltly there's a `@libp2p/prometheus-metrics` implementation, there may be others in the future. Before: ```js import { createLibp2p } from 'libp2p' const node = createLibp2p({ metrics: { enabled: true } }) ``` After: ```js import { createLibp2p } from 'libp2p' import { prometheusMetrics } from '@libp2p/prometheus-metrics' const node = createLibp2p({ metrics: prometheusMetrics() }) ``` BREAKING CHANGE: the libp2p opts have changed to accept a metrics object factory function instead of a config object
- Loading branch information
1 parent
074118a
commit 5e9dcf3
Showing
21 changed files
with
131 additions
and
1,368 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
# Migrating to libp2p@41 <!-- omit in toc --> | ||
|
||
A migration guide for refactoring your application code from libp2p v0.40.x to v0.41.0. | ||
|
||
## Table of Contents <!-- omit in toc --> | ||
|
||
- [Modules](#modules) | ||
- [Autodial](#autodial) | ||
|
||
## Metrics | ||
|
||
libp2p no longer ships a built-in metrics object, allowing the user to configure an implemnetation of their choice or not at all. | ||
|
||
Currently an [implementation](https://www.npmjs.com/package/@libp2p/prometheus-metrics) exists for [Prometheus](https://prometheus.io/)/[Graphana](https://grafana.com/), others may follow. | ||
|
||
**Before** | ||
|
||
```js | ||
import { createLibp2p } from 'libp2p' | ||
|
||
const node = await createLibp2p({ | ||
metrics: { | ||
enabled: true, | ||
// ... other options | ||
} | ||
}) | ||
``` | ||
|
||
**After** | ||
|
||
```js | ||
import { createLibp2p } from 'libp2p' | ||
import { prometheusMetrics } from '@libp2p/prometheus-metrics' | ||
|
||
const node = await createLibp2p({ | ||
metrics: prometheusMetrics() | ||
}) | ||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.