ipfs / kubo

An IPFS implementation in Go
https://docs.ipfs.tech/how-to/command-line-quick-start/
Other
15.98k stars 3k forks source link

Collecting Process Metrics #1418

Open jbenet opened 9 years ago

jbenet commented 9 years ago

We're getting to the point where we want to collect a large swath of metrics. This is for use cases like:

So far, some metrics work includes #457 and #1163. Interested people include: @whyrusleeping @lgierth @rht @heems @jbenet

We should use this issue to track:

jbenet commented 9 years ago

As goals, i think we should try for something:

I have one proposal with two possible implementation approaches. The idea is to make one module that has metrics stored at particular paths, so things like /node/gateway/requests/total would be a growing int, but namespaced under /node/gateway/requests/, with other things like /node/gateway/requests/per-second or something.

From an interfaces standpoint, the idea i have would be to make one Metrics or MetricsCollector object that is either passed down or available globally like the go loggers (the 2 approaches). And allow different go packages to use the same (or derived) metrics object. Concretely, is should be able to instantiate multiple IPFS Nodes in the same process (or a bssim and many ipfs nodes) and have them all log all their metrics to the same object, under different namespaces.

(So, instead of having a package implement its own collection and expose functions to get the metrics, the package is given a metrics object (global or passed in), that they write their metrics to.)

IIRC, https://github.com/ipfs/go-ipfs/pull/1163/files does some namespacing of metrics.

jbenet commented 9 years ago

Some of the metrics bitswap-ml may need: https://github.com/ipfs/bitswap-ml/issues/1

whyrusleeping commented 9 years ago

I had some plans to write a 'bs-top' that would be a process monitor for bitswap. It would essentially register for notifications from bitswap, and be notified of what each worker is doing as soon as it starts doing it. That way, we could have a nice interface that shows live information about what bitswap is doing.

Although, that may be tangental to the metrics we're discussing here.

jbenet commented 9 years ago

@whyrusleeping sweet! i want it to. we should make these "dashboards" for different subsystems (dht, bitswap, repo, api, gateway, etc) (top is a dashboard)

whyrusleeping commented 9 years ago
var clones []Person
for i := 0; i < 50; i++ {
    clones = append(clones, whyrusleeping.Clone())
}
whyrusleeping commented 9 years ago

maybe we want to discuss a general strategy for dashboards somewhere? We could either do them through notifications, which might be obnoxious, or we could do it through our new eventlogs API. and just have bitswap emit eventlogs for the dashboard

jbenet commented 9 years ago

@heems @lgierth let's maybe list metrics here we want to add, and check them as they're added, like so: