Skip to content

Commit 9b333db

Browse files
authored
feat: telemetry intialization in full node and added env variables (#1291)
1 parent 6d4889a commit 9b333db

File tree

3 files changed

+27
-0
lines changed

3 files changed

+27
-0
lines changed

docker/compose/movement-full-node/docker-compose.fullnode.yml

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,20 @@ services:
77
- DOT_MOVEMENT_PATH=/.movement
88
- MOVEMENT_TIMING=info
99
- RUST_BACKTRACE=1
10+
- MOVEMENT_METRICS_ADDR=0.0.0.0:9464
11+
- APTOS_FORCE_ENABLE_TELEMETRY=1
12+
- APTOS_METRICS_PORT=9464
13+
- APTOS_METRICS_HOST=0.0.0.0
14+
- APTOS_DISABLE_TELEMETRY_PUSH_METRICS=1
15+
- PROMETHEUS_METRICS_ENABLED=1
16+
- APTOS_ENABLE_CONSENSUS_METRICS=1
17+
- APTOS_ENABLE_DB_METRICS=1
18+
- APTOS_ENABLE_MEMPOOL_METRICS=1
19+
- APTOS_ENABLE_NETWORK_METRICS=1
20+
- APTOS_ENABLE_STORAGE_METRICS=1
21+
- APTOS_ENABLE_VM_METRICS=1
22+
# OTEL Configuration (optional - uncomment and set your endpoint)
23+
# - MOVEMENT_OTEL_ENDPOINT=http://otel-collector:4317
1024
volumes:
1125
- ${DOT_MOVEMENT_PATH}:/.movement
1226
ports:

networks/movement/movement-full-node/src/main.rs

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
use clap::*;
33
use movement_full_node::MovementFullNode;
44
use tracing_subscriber::EnvFilter;
5+
56
#[tokio::main]
67
async fn main() -> Result<(), anyhow::Error> {
78
// Initialize default tracing
@@ -10,6 +11,12 @@ async fn main() -> Result<(), anyhow::Error> {
1011
EnvFilter::try_from_default_env().unwrap_or_else(|_| EnvFilter::new("info")),
1112
)
1213
.init();
14+
15+
// Initialize telemetry if MOVEMENT_METRICS_ADDR is set
16+
if std::env::var("MOVEMENT_METRICS_ADDR").is_ok() {
17+
movement_tracing::ensure_telemetry_initialized();
18+
}
19+
1320
let suzuka_util = MovementFullNode::parse();
1421
let result = suzuka_util.execute().await;
1522
result

util/tracing/src/lib.rs

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -343,6 +343,12 @@ pub fn start_telemetry_service() {
343343
std::env::set_var("APTOS_ENABLE_STORAGE_METRICS", "1");
344344
std::env::set_var("APTOS_ENABLE_VM_METRICS", "1");
345345

346+
// Configure OTEL if endpoint is provided
347+
if let Ok(otel_endpoint) = std::env::var("MOVEMENT_OTEL_ENDPOINT") {
348+
std::env::set_var("APTOS_OTEL_ENDPOINT", &otel_endpoint);
349+
info!("Configured OTEL endpoint: {}", otel_endpoint);
350+
}
351+
346352
// Register custom metrics
347353
register_custom_metrics();
348354

0 commit comments

Comments
 (0)