-
Notifications
You must be signed in to change notification settings - Fork 146
feat(dot/babe) implement block production time metric #1648
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
EclesioMeloJunior
merged 16 commits into
development
from
eclesio/enhance-prometheus-metrics
Jun 24, 2021
Merged
Changes from all commits
Commits
Show all changes
16 commits
Select commit
Hold shift + click to select a range
fb36d45
metric: gossamer_proposer_block_constructed
EclesioMeloJunior ab635fd
Merge branch 'development' into eclesio/enhance-prometheus-metrics
EclesioMeloJunior 142039f
chore: improve metrics instance and add tests
EclesioMeloJunior 933f962
Merge branch 'eclesio/enhance-prometheus-metrics' of github.com:Chain…
EclesioMeloJunior 0f553b4
chore: add peer check and peerstore metrics
EclesioMeloJunior 8949754
chore: fix pacakge name and interface to gauge struct
EclesioMeloJunior d3a8f74
chore: change to const
EclesioMeloJunior 88368bf
chore: adjust babe metrics
EclesioMeloJunior 4599013
chore: removing duplicated net metrics
EclesioMeloJunior 5f592e1
chore: improve babe time to build block test
EclesioMeloJunior 2e1eb35
chore: fix CI tests failures
EclesioMeloJunior 14ef2d3
Merge branch 'development' into eclesio/enhance-prometheus-metrics
EclesioMeloJunior 691a47e
exec go mod tidy
EclesioMeloJunior b1037f8
Merge branch 'development' into eclesio/enhance-prometheus-metrics
EclesioMeloJunior 8152e3a
chore: go mod
EclesioMeloJunior 244f211
change docker-compose instructions to docs/ folder
EclesioMeloJunior File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or 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,15 @@ | ||
| version: '3.7' | ||
|
|
||
| services: | ||
| prometheus: | ||
| image: prom/prometheus | ||
| volumes: | ||
| - ./prometheus.yml:/etc/prometheus/prometheus.yml | ||
| command: | ||
| - '--config.file=/etc/prometheus/prometheus.yml' | ||
| - '--storage.tsdb.path=/prometheus' | ||
| - '--web.console.libraries=/usr/share/prometheus/console_libraries' | ||
| - '--web.console.templates=/usr/share/prometheus/consoles' | ||
| ports: | ||
| - 9090:9090 | ||
| restart: always | ||
This file contains hidden or 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,29 @@ | ||
| --- | ||
| layout: default | ||
| title: Using Prometheus | ||
| permalink: /integrate/using-prometheus/ | ||
| --- | ||
|
|
||
| # Using Prometheus Locally | ||
|
|
||
| To get started with Prometheus locally make sure you have installed [Docker](https://docs.docker.com/engine/install/) and [Docker Compose](https://docs.docker.com/compose/install/). | ||
|
|
||
| The docker-compose.yml file has, currently, the Prometheus to collect metrics, so to start that service you can execute (in the project root folder): | ||
|
|
||
| ``` | ||
| docker-compose up (-d to disatach the terminal) | ||
|
|
||
| or | ||
|
|
||
| docker-compose up prometheus (-d to disatach the terminal) | ||
| ``` | ||
|
|
||
| the above command will starts the Prometheus service on `0.0.0.0:9090`. | ||
|
|
||
| ### Prometheus | ||
|
|
||
| Actually the Prometheus service reads a file `prometheus.yml` placed in the root level project folder, this file contains the definitions that Prometheus needs to collect the metrics. | ||
|
|
||
| Linux: In the **job_name == gossamer** the **targets** property should be `[localhost:9876]` | ||
|
|
||
| To publish metrics from the node use the flag **--publish-metrics**; i.e, `./bin/gossamer --chain {chain} --key {key} --publish-metrics` |
This file contains hidden or 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 hidden or 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 |
|---|---|---|
|
|
@@ -21,6 +21,7 @@ import ( | |
| "fmt" | ||
| "time" | ||
|
|
||
| ethmetrics "github.com/ethereum/go-ethereum/metrics" | ||
| badger "github.com/ipfs/go-ds-badger2" | ||
| libp2phost "github.com/libp2p/go-libp2p-core/host" | ||
| "github.com/libp2p/go-libp2p-core/peer" | ||
|
|
@@ -31,6 +32,11 @@ import ( | |
| "github.com/libp2p/go-libp2p-kad-dht/dual" | ||
| ) | ||
|
|
||
| const ( | ||
| checkPeerCountMetrics = "gossamer/network/peer_count" | ||
| peersStoreMetrics = "gossamer/network/peerstore_count" | ||
| ) | ||
|
|
||
| var ( | ||
| startDHTTimeout = time.Second * 10 | ||
| initialAdvertisementTimeout = time.Millisecond | ||
|
|
@@ -115,6 +121,9 @@ func (d *discovery) stop() error { | |
| return nil | ||
| } | ||
|
|
||
| ethmetrics.Unregister(checkPeerCountMetrics) | ||
| ethmetrics.Unregister(peersStoreMetrics) | ||
|
Comment on lines
+124
to
+125
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. what does this do?
Member
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. this allows the unused metrics to be collected by the gc |
||
|
|
||
| return d.dht.Close() | ||
| } | ||
|
|
||
|
|
||
This file contains hidden or 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 hidden or 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 hidden or 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 hidden or 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
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.