Skip to content

Commit b69f51c

Browse files
author
David Himmelstrup
committed
rename metrics env to FOREST_LIBP2P_METRICS_ENABLED
1 parent 8ac1ef4 commit b69f51c

File tree

2 files changed

+4
-5
lines changed

2 files changed

+4
-5
lines changed

docs/docs/users/reference/env_variables.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +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` | 1 or true | empty | 1 | Include `libp2p` metrics in Forest's Prometheus output. |
34+
| `FOREST_LIBP2P_METRICS_ENABLED` | 1 or true | empty | 1 | Include `libp2p` metrics in Forest's Prometheus output. |
3535
| `FOREST_F3_SIDECAR_RPC_ENDPOINT` | string | 127.0.0.1:23456 | `127.0.0.1:23456` | An RPC endpoint of F3 sidecar. |
3636
| `FOREST_F3_SIDECAR_FFI_ENABLED` | 1 or true | hard-coded per chain | 1 | Whether or not to start the F3 sidecar via FFI |
3737
| `FOREST_F3_CONSENSUS_ENABLED` | 1 or true | hard-coded per chain | 1 | Whether or not to apply the F3 consensus to the node |

src/libp2p/service.rs

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -76,9 +76,8 @@ pub(in crate::libp2p) mod metrics {
7676
}
7777
}
7878

79-
const LIBP2P_METRICS: &str = "FOREST_LIBP2P_METRICS";
80-
fn enable_libp2p_metrics() -> bool {
81-
crate::utils::misc::env::is_env_truthy(LIBP2P_METRICS)
79+
fn libp2p_metrics_enabled() -> bool {
80+
crate::utils::misc::env::is_env_truthy(FOREST_LIBP2P_METRICS_ENABLED)
8281
}
8382

8483
/// `Gossipsub` Filecoin blocks topic identifier.
@@ -300,7 +299,7 @@ where
300299
let mut bitswap_outbound_request_stream =
301300
bitswap_request_manager.outbound_request_stream().fuse();
302301
let mut peer_ops_rx_stream = self.peer_manager.peer_ops_rx().stream().fuse();
303-
let metrics = if enable_libp2p_metrics() {
302+
let metrics = if libp2p_metrics_enabled() {
304303
Some(Metrics::new(&mut crate::metrics::default_registry()))
305304
} else {
306305
None

0 commit comments

Comments
 (0)