Skip to content

Commit 90a0415

Browse files
authored
Merge branch 'main' into elmattic/chain-get-events
2 parents ab99c9d + 4b80945 commit 90a0415

File tree

7 files changed

+370
-3
lines changed

7 files changed

+370
-3
lines changed

.github/RPC_PARITY_ISSUE_TEMPLATE.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
---
2-
title: "[automated] RPC parity test failure"
2+
title: "[automated] RPC parity test failure @ {{ date | date('D/M/YY:HH:mm') }}"
33
labels: ["Bug"]
44
---
55

CHANGELOG.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,8 @@
3636
### Removed
3737

3838
- [#5449](https://github.com/ChainSafe/forest/pull/5449) Remove unnecessary/duplicate metrics.
39+
- [#5457](https://github.com/ChainSafe/forest/pull/5457) Remove most prometheus
40+
metrics starting with `libp2p_`.
3941

4042
### Fixed
4143

docs/docs/users/reference/env_variables.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,7 @@ process.
3131
| `FOREST_TEST_RNG_FIXED_SEED` | non-negative integer | empty | 0 | Override RNG with a reproducible one seeded by the value. This should never be used out of test context for security. |
3232
| `RUST_LOG` | string | empty | `debug,forest_libp2p::service=info` | Allows for log level customization. |
3333
| `FOREST_IGNORE_DRAND` | 1 or true | empty | 1 | Ignore Drand validation. |
34+
| `FOREST_LIBP2P_METRICS_ENABLED` | 1 or true | empty | 1 | Include `libp2p` metrics in Forest's Prometheus output. |
3435
| `FOREST_F3_SIDECAR_RPC_ENDPOINT` | string | 127.0.0.1:23456 | `127.0.0.1:23456` | An RPC endpoint of F3 sidecar. |
3536
| `FOREST_F3_SIDECAR_FFI_ENABLED` | 1 or true | hard-coded per chain | 1 | Whether or not to start the F3 sidecar via FFI |
3637
| `FOREST_F3_CONSENSUS_ENABLED` | 1 or true | hard-coded per chain | 1 | Whether or not to apply the F3 consensus to the node |

docs/docs/users/reference/metrics.md

Lines changed: 352 additions & 0 deletions
Large diffs are not rendered by default.

scripts/tests/api_compare/filter-list

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,3 +2,4 @@
22
# They should be considered bugged, and not used until the root cause is resolved.
33
# Disable until next Lotus release with go-f3 0.8.0
44
!Filecoin.F3GetManifest
5+
!Filecoin.EthTraceFilter

scripts/tests/api_compare/filter-list-offline

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,3 +27,4 @@
2727
!Filecoin.EthGetBlockByNumber
2828
!eth_getBlockByNumber
2929
!Filecoin.ChainSetHead
30+
!Filecoin.EthTraceFilter

src/libp2p/service.rs

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -76,6 +76,10 @@ pub(in crate::libp2p) mod metrics {
7676
}
7777
}
7878

79+
fn libp2p_metrics_enabled() -> bool {
80+
crate::utils::misc::env::is_env_truthy("FOREST_LIBP2P_METRICS_ENABLED")
81+
}
82+
7983
/// `Gossipsub` Filecoin blocks topic identifier.
8084
pub const PUBSUB_BLOCK_STR: &str = "/fil/blocks";
8185
/// `Gossipsub` Filecoin messages topic identifier.
@@ -295,7 +299,11 @@ where
295299
let mut bitswap_outbound_request_stream =
296300
bitswap_request_manager.outbound_request_stream().fuse();
297301
let mut peer_ops_rx_stream = self.peer_manager.peer_ops_rx().stream().fuse();
298-
let metrics = Metrics::new(&mut crate::metrics::default_registry());
302+
let metrics = if libp2p_metrics_enabled() {
303+
Some(Metrics::new(&mut crate::metrics::default_registry()))
304+
} else {
305+
None
306+
};
299307

300308
const BOOTSTRAP_PEER_DIALER_INTERVAL: tokio::time::Duration =
301309
tokio::time::Duration::from_secs(60);
@@ -310,7 +318,9 @@ where
310318
swarm_event = swarm_stream.next() => match swarm_event {
311319
// outbound events
312320
Some(SwarmEvent::Behaviour(event)) => {
313-
metrics.record(&event);
321+
if let Some(m) = &metrics {
322+
m.record(&event);
323+
}
314324
handle_forest_behaviour_event(
315325
swarm_stream.get_mut(),
316326
&bitswap_request_manager,

0 commit comments

Comments
 (0)