Giter VIP home page Giter VIP logo

Comments (7)

wemeetagain avatar wemeetagain commented on July 20, 2024

Unfortunately there is no good documentation. And the MetricsRegister interface is very opinionated and overly dependent on https://github.com/ChainSafe/lodestar/blob/unstable/packages/beacon-node/src/metrics/utils/registryMetricCreator.ts#L12, requires implementing some specific methods (gauge, histogram, avgMinMax). This could/should be cleaned up cc @dapplion @tuyennhv

If you'd like an example, take a look here:
https://github.com/ChainSafe/lodestar/blob/unstable/packages/beacon-node/src/metrics/utils/registryMetricCreator.ts#L12
You can create a RegistryMetricCreator instance and pass that as the metricsRegister in the gossipsub constructor / init function.

Then, with a reference to the instance, you should be able to consume the metrics with methods described here: https://github.com/siimon/prom-client#register

from js-libp2p-gossipsub.

cristianmadularu avatar cristianmadularu commented on July 20, 2024

Thank you @wemeetagain

I'll have a look 👍

from js-libp2p-gossipsub.

cristianmadularu avatar cristianmadularu commented on July 20, 2024

Would you happen to know why the instrument types(Gauge, Histogram, AvgMinMax) and their config types are not exported? (Since they are being used in the exported MetricsRegister interface).

Since we are using this library in a browser application, we are not planning on adding a dependency to the promclient lib.

image

Thank you!

PS: For now, I have copied the types in my code just to get me going but I really wish I didn't have to do that :)

from js-libp2p-gossipsub.

wemeetagain avatar wemeetagain commented on July 20, 2024

@cristianmadularu the types you requested are now exported as of v10.1.0

from js-libp2p-gossipsub.

cristianmadularu avatar cristianmadularu commented on July 20, 2024

Thank you! :)

from js-libp2p-gossipsub.

dapplion avatar dapplion commented on July 20, 2024

We should drop avgMinMax and have a regular prometheus interface that's generic

from js-libp2p-gossipsub.

cristianmadularu avatar cristianmadularu commented on July 20, 2024

That would be very nice :) I would also suggest considering exposing an OTLP set of metrics in order to avoid being locked in any particular set of tools/vendors.

from js-libp2p-gossipsub.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.