-
Notifications
You must be signed in to change notification settings - Fork 205
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
Added new flag + readme for starting p2p prometheus dashboards #5707
Changes from 1 commit
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -83,6 +83,35 @@ sudo cp protoc-gen-gogoslick /usr/bin/ | |
|
||
Done | ||
|
||
## Running p2p Prometheus dashboards | ||
1. Start the node with `--p2p-prometheus-metrics` flag. This exposes a metrics collection at http://localhost:5001/debug/metrics/prometheus. | ||
2. Clone libp2p repository: `git clone https://github.com/libp2p/go-libp2p` | ||
3. `cd go-libp2p/dasboards/swarm` and under the | ||
```json | ||
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. might remove the |
||
"templating": { | ||
"list": [ | ||
``` | ||
section, add the following lines: | ||
```json | ||
{ | ||
"hide": 0, | ||
"label": "datasource", | ||
"name": "DS_PROMETHEUS", | ||
"options": [], | ||
"query": "prometheus", | ||
"refresh": 1, | ||
"regex": "", | ||
"type": "datasource" | ||
}, | ||
``` | ||
(this step will be removed once it will be fixed on libp2p) | ||
4. `cd ..` to dashboards directory and update the port of `host.docker.internal` from `prometheus.yml` to node's Rest API port(default `8080`) | ||
5. From this directory, run the following docker compose command: | ||
``` | ||
sudo docker compose -f docker-compose.base.yml -f docker-compose-linux.yml up --force-recreate | ||
``` | ||
6. The preconfigured dashboards should be now available on Grafana at http://localhost:3000/dashboards | ||
|
||
## Progress | ||
|
||
### Done | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -73,6 +73,7 @@ GLOBAL OPTIONS: | |
--logs-path directory This flag specifies the directory where the node will store logs. | ||
--operation-mode operation mode String flag for specifying the desired operation mode(s) of the node, resulting in altering some configuration values accordingly. Possible values are: snapshotless-observer, full-archive, db-lookup-extension, historical-balances or `""` (empty). Multiple values can be separated via , | ||
--repopulate-tokens-supplies Boolean flag for repopulating the tokens supplies database. It will delete the current data, iterate over the entire trie and add he new obtained supplies | ||
--p2p-prometheus-metrics Boolean option for enabling the /debug/metrics/prometheus route for p2p prometheus metrics | ||
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. 👍 |
||
--help, -h show help | ||
--version, -v print the version | ||
|
||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -17,14 +17,14 @@ func TestInitialNodeFacade(t *testing.T) { | |
t.Run("nil status metrics should error", func(t *testing.T) { | ||
t.Parallel() | ||
|
||
inf, err := NewInitialNodeFacade("127.0.0.1:8080", true, nil) | ||
inf, err := NewInitialNodeFacade("127.0.0.1:8080", true, false, nil) | ||
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. maybe move all arguments for the NewInitialNodeFacade into a single arg-struct 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. updated |
||
assert.Equal(t, facade.ErrNilStatusMetrics, err) | ||
assert.Nil(t, inf) | ||
}) | ||
t.Run("should work", func(t *testing.T) { | ||
t.Parallel() | ||
|
||
inf, err := NewInitialNodeFacade("127.0.0.1:8080", true, &testscommon.StatusMetricsStub{}) | ||
inf, err := NewInitialNodeFacade("127.0.0.1:8080", true, false, &testscommon.StatusMetricsStub{}) | ||
assert.Nil(t, err) | ||
assert.NotNil(t, inf) | ||
}) | ||
|
@@ -40,7 +40,7 @@ func TestInitialNodeFacade_AllMethodsShouldNotPanic(t *testing.T) { | |
}() | ||
|
||
apiInterface := "127.0.0.1:7799" | ||
inf, err := NewInitialNodeFacade(apiInterface, true, &testscommon.StatusMetricsStub{}) | ||
inf, err := NewInitialNodeFacade(apiInterface, true, false, &testscommon.StatusMetricsStub{}) | ||
assert.Nil(t, err) | ||
|
||
inf.SetSyncer(nil) | ||
|
@@ -325,6 +325,6 @@ func TestInitialNodeFacade_IsInterfaceNil(t *testing.T) { | |
var inf *initialNodeFacade | ||
assert.True(t, inf.IsInterfaceNil()) | ||
|
||
inf, _ = NewInitialNodeFacade("127.0.0.1:7799", true, &testscommon.StatusMetricsStub{}) | ||
inf, _ = NewInitialNodeFacade("127.0.0.1:7799", true, false, &testscommon.StatusMetricsStub{}) | ||
assert.False(t, inf.IsInterfaceNil()) | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -36,7 +36,8 @@ import ( | |
const DefaultRestInterface = "localhost:8080" | ||
|
||
// DefaultRestPortOff is the default value that should be passed if it is desired | ||
// to start the node without a REST endpoint available | ||
// | ||
// to start the node without a REST endpoint available | ||
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. wrong formatting |
||
const DefaultRestPortOff = "off" | ||
|
||
var log = logger.GetOrCreate("facade") | ||
|
@@ -163,7 +164,8 @@ func (nf *nodeFacade) RestAPIServerDebugMode() bool { | |
|
||
// RestApiInterface returns the interface on which the rest API should start on, based on the config file provided. | ||
// The API will start on the DefaultRestInterface value unless a correct value is passed or | ||
// the value is explicitly set to off, in which case it will not start at all | ||
// | ||
// the value is explicitly set to off, in which case it will not start at all | ||
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. wrong formatting |
||
func (nf *nodeFacade) RestApiInterface() string { | ||
if nf.config.RestApiInterface == "" { | ||
return DefaultRestInterface | ||
|
@@ -734,6 +736,11 @@ func (nf *nodeFacade) GetGasConfigs() (map[string]map[string]uint64, error) { | |
return gasConfigs, nil | ||
} | ||
|
||
// P2PPrometheusMetricsEnabled returns if p2p prometheus metrics should be enabled or not on the application | ||
func (nf *nodeFacade) P2PPrometheusMetricsEnabled() bool { | ||
return nf.config.P2PPrometheusMetricsEnabled | ||
} | ||
|
||
// IsInterfaceNil returns true if there is no value under the interface | ||
func (nf *nodeFacade) IsInterfaceNil() bool { | ||
return nf == nil | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
the port is not
5001
, is the one defined by the-rest-api-interface
flag which defaults tolocalhost:8080