| 1 | # @ipshipyard/libp2p-inspector-metrics |
| 2 | |
| 3 | [](https://codecov.io/gh/ipshipyard/js-libp2p-inspector) |
| 4 | [](https://github.com/ipshipyard/js-libp2p-inspector/actions/workflows/js-test-and-release.yml?query=branch%3Amain) |
| 5 | |
| 6 | > Collect libp2p metrics and send them to browser DevTools |
| 7 | |
| 8 | # About |
| 9 | |
| 10 | <!-- |
| 11 | |
| 12 | !IMPORTANT! |
| 13 | |
| 14 | Everything in this README between "# About" and "# Install" is automatically |
| 15 | generated and will be overwritten the next time the doc generator is run. |
| 16 | |
| 17 | To make changes to this section, please update the @packageDocumentation section |
| 18 | of src/index.js or src/index.ts |
| 19 | |
| 20 | To experiment with formatting, please run "npm run docs" from the root of this |
| 21 | repo and examine the changes made. |
| 22 | |
| 23 | --> |
| 24 | |
| 25 | Configure your browser-based libp2p node with DevTools metrics: |
| 26 | |
| 27 | ```typescript |
| 28 | import { createLibp2p } from 'libp2p' |
| 29 | import { inspectorMetrics } from '@ipshipyard/libp2p-inspector-metrics' |
| 30 | |
| 31 | const node = await createLibp2p({ |
| 32 | metrics: inspectorMetrics() |
| 33 | }) |
| 34 | ``` |
| 35 | |
| 36 | Then use the [DevTools plugin](https://github.com/ipfs-shipyard/js-libp2p-devtools) |
| 37 | for Chrome or Firefox to inspect the state of your running node. |
| 38 | |
| 39 | # Install |
| 40 | |
| 41 | ```console |
| 42 | $ npm i @ipshipyard/libp2p-inspector-metrics |
| 43 | ``` |
| 44 | |
| 45 | ## Browser `<script>` tag |
| 46 | |
| 47 | Loading this module through a script tag will make its exports available as `IpshipyardLibp2pInspectorMetrics` in the global namespace. |
| 48 | |
| 49 | ```html |
| 50 | <script src="https://unpkg.com/@ipshipyard/libp2p-inspector-metrics/dist/index.min.js"></script> |
| 51 | ``` |
| 52 | |
| 53 | > Collect libp2p metrics and send them to an inspector |
| 54 | |
| 55 | # License |
| 56 | |
| 57 | Licensed under either of |
| 58 | |
| 59 | - Apache 2.0, ([LICENSE-APACHE](https://github.com/ipshipyard/js-libp2p-inspector/blob/main/packages/libp2p-inspector-metrics/LICENSE-APACHE) / <http://www.apache.org/licenses/LICENSE-2.0>) |
| 60 | - MIT ([LICENSE-MIT](https://github.com/ipshipyard/js-libp2p-inspector/blob/main/packages/libp2p-inspector-metrics/LICENSE-MIT) / <http://opensource.org/licenses/MIT>) |
| 61 | |
| 62 | # Contribution |
| 63 | |
| 64 | Unless you explicitly state otherwise, any contribution intentionally submitted for inclusion in the work by you, as defined in the Apache-2.0 license, shall be dual licensed as above, without any additional terms or conditions. |