status-go/metrics
frank 38308d48f2
feat_: log on panic (#5849)
* feat_: log error and stacktrace when panic in goroutine

* test_: add test TestSafeGo

* chore_: rename logAndCall to call

* chore_: rename SafeGo to Go

* chore_: make lint-fix

* chore_: use t.Cleanup

* chore_: Revert "chore_: use t.Cleanup"

This reverts commit 4eb420d179.

* chore_: Revert "chore_: make lint-fix"

This reverts commit fcc995f157.

* chore_: Revert "chore_: rename SafeGo to Go"

This reverts commit a6d73d6df5.

* chore_: Revert "chore_: rename logAndCall to call"

This reverts commit 8fbe993bed.

* chore_: Revert "test_: add test TestSafeGo"

This reverts commit a1fa91839f.

* chore_: Revert "feat_: log error and stacktrace when panic in goroutine"

This reverts commit f612dd828f.

* feat_: log error and stacktrace when panic in goroutine

* chore_: make lint-fix

* chore_: rename logAndCall to call

* chore_: renaming LogOnPanic

* chore_: update rest goroutine function calls

* chore_: make lint-fix
2024-09-27 06:37:32 +08:00
..
node feat_: log on panic (#5849) 2024-09-27 06:37:32 +08:00
README.md add README for metrics (#1906) 2020-03-17 22:09:21 +01:00
metrics.go Upgrade linter to 1.50.0 2023-01-13 17:52:03 +00:00

README.md

Description

This package configures Prometheus metrics for the node.

Technical Details

We use a trick to combine our metrics with Geth ones.

The NewMetricsServer() function in metrics.go calls our own Handler() function which in turn calls two handlers:

  • promhttp.HandlerFor() - Our own custom metrics from this package.
  • gethprom.Handler(reg) - Geth metrics defined in metrics

By calling both we can extend existing metrics.

Metrics

We add a few extra metrics on top of the normal Geth ones in node/metrics.go:

  • p2p_peers_count - Current numbers of peers split by name.
  • p2p_peers_absolute - Absolute number of connected peers.
  • p2p_peers_max - Maximum number of peers that can connect.

The p2p_peers_count metrics includes 3 labels:

  • type - Set to StatusIM for mobile and Statusd for daemon.
  • version - Version of status-go, always with the v prefix.
  • platform - Host platform, like android-arm64 or darwin-arm64

The way this data is acquired is using node names, which look like this:

StatusIM/vrelease-0.30.1-beta.2/android-arm/go1.11.5
Statusd/v0.34.0-beta.3/linux-amd64/go1.13.1
Geth/v1.9.9-stable-5aa131ca/linux-amd64/go1.13.3

This 4 segment format is standard for Ethereum as you can see on https://ethstats.net/.

We parse the names using labelsFromNodeName() from node/metrics.go.

Links