-
Notifications
You must be signed in to change notification settings - Fork 115
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #2884 from oasislabs/matevz/feature/new-metrics
- Loading branch information
Showing
12 changed files
with
174 additions
and
12 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,8 @@ | ||
Document all Prometheus metrics produced by `oasis-node` | ||
|
||
List of metrics with description and file location is available in | ||
List of metrics including the description, metric type, and location in the | ||
source is now available in | ||
[docs/oasis-node/metrics.md](../docs/oasis-node/metrics.md) Markdown file. To | ||
automate generation of this list, new `go/extra/extract-metric` tool was | ||
automate generation of this list, a new `go/extra/extract-metric` tool was | ||
introduced. To update the list of metrics, execute `make update-docs` in the | ||
project root. | ||
project root. Documentation needs to be up to date for `lint` rule to succeed. |
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,12 @@ | ||
Add new consensus-related Prometheus metrics | ||
|
||
Four new metrics have been added: | ||
|
||
- `oasis_worker_epoch_number` is the current epoch number as seen by the | ||
worker. | ||
- `oasis_worker_node_registered` is a binary metric which denotes, if the | ||
node is registered. | ||
- `oasis_consensus_proposed_blocks` is the number of proposed Tendermint | ||
blocks by the node. | ||
- `oasis_consensus_signed_blocks` is the number of Tendermint blocks the node | ||
voted for. |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,9 +1,14 @@ | ||
all: | ||
|
||
check: | ||
@# Check whether update-docs are up to date. | ||
@../go/extra/extract-metrics/extract-metrics --codebase.path ../go/ --markdown --markdown.template.file oasis-node/metrics.md.tpl | diff oasis-node/metrics.md - | ||
|
||
update: | ||
# Generate oasis-node/metrics.md. | ||
../go/extra/extract-metrics/extract-metrics --codebase.path ../go/ --markdown --markdown.template.file oasis-node/metrics.md.tpl > oasis-node/metrics.md | ||
@# Generate oasis-node/metrics.md. | ||
@../go/extra/extract-metrics/extract-metrics --codebase.path ../go/ --markdown --markdown.template.file oasis-node/metrics.md.tpl > oasis-node/metrics.md | ||
|
||
.PHONY: | ||
all | ||
check | ||
update |
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,37 @@ | ||
package metrics | ||
|
||
import ( | ||
"sync" | ||
|
||
"github.com/prometheus/client_golang/prometheus" | ||
) | ||
|
||
var ( | ||
SignedBlocks = prometheus.NewCounterVec( | ||
prometheus.CounterOpts{ | ||
Name: "oasis_consensus_signed_blocks", | ||
Help: "Number of blocks signed by the node.", | ||
}, | ||
[]string{"backend"}, | ||
) | ||
ProposedBlocks = prometheus.NewCounterVec( | ||
prometheus.CounterOpts{ | ||
Name: "oasis_consensus_proposed_blocks", | ||
Help: "Number of blocks proposed by the node.", | ||
}, | ||
[]string{"backend"}, | ||
) | ||
|
||
consensusCollectors = []prometheus.Collector{ | ||
SignedBlocks, | ||
ProposedBlocks, | ||
} | ||
|
||
metricsOnce sync.Once | ||
) | ||
|
||
func init() { | ||
metricsOnce.Do(func() { | ||
prometheus.MustRegister(consensusCollectors...) | ||
}) | ||
} |
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
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