Skip to content

Commit 236c2be

Browse files
0xIcarusapenzkmzabaluevl-monningerandygolay
authored
feat: setup otlp prometheus exporter with correct invocation in node (#1087)
Co-authored-by: Andreas Penzkofer <[email protected]> Co-authored-by: Mikhail Zabaluev <[email protected]> Co-authored-by: Liam Monninger <[email protected]> Co-authored-by: Andy Golay <[email protected]> Co-authored-by: musitdev <[email protected]> Co-authored-by: Richard Melkonian <[email protected]> Co-authored-by: primata <[email protected]> Co-authored-by: Richard Melkonian <[email protected]> Co-authored-by: Radu Popa <[email protected]> Co-authored-by: Liam Monninger <[email protected]>
1 parent 7c4d7ee commit 236c2be

File tree

14 files changed

+704
-260
lines changed

14 files changed

+704
-260
lines changed

.github/workflows/checks-all.yml

Lines changed: 143 additions & 147 deletions
Large diffs are not rendered by default.

Cargo.lock

Lines changed: 84 additions & 14 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.
Lines changed: 78 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,78 @@
1+
services:
2+
prometheus:
3+
image: prom/prometheus:v2.49.1
4+
container_name: movement-prometheus
5+
command:
6+
- "--config.file=/etc/prometheus/prometheus.yml"
7+
- "--storage.tsdb.path=/prometheus"
8+
- "--web.console.libraries=/usr/share/prometheus/console_libraries"
9+
- "--web.console.templates=/usr/share/prometheus/consoles"
10+
ports:
11+
- "9090:9090"
12+
volumes:
13+
- ./prometheus.yml:/etc/prometheus/prometheus.yml
14+
- prometheus_data:/prometheus
15+
healthcheck:
16+
test: wget --no-verbose --tries=1 --spider http://localhost:9090/-/healthy || exit 1
17+
interval: 5s
18+
timeout: 3s
19+
retries: 3
20+
21+
grafana:
22+
image: grafana/grafana:10.2.3
23+
container_name: movement-grafana
24+
ports:
25+
- "3000:3000"
26+
volumes:
27+
- ./grafana/provisioning:/etc/grafana/provisioning
28+
- ./grafana/dashboards:/var/lib/grafana/dashboards
29+
environment:
30+
- GF_SECURITY_ADMIN_PASSWORD=admin
31+
- GF_USERS_ALLOW_SIGN_UP=false
32+
depends_on:
33+
- prometheus
34+
35+
movement-full-node:
36+
environment:
37+
- MOVEMENT_METRICS_ADDR=127.0.0.1:9464
38+
- MOVEMENT_OTLP=http://otel-collector:4317
39+
ports:
40+
- "9464:9464"
41+
depends_on:
42+
- prometheus:
43+
condition: service_healthy
44+
- otel-collector:
45+
condition: service_healthy
46+
47+
movement-celestia-da-light-node:
48+
environment:
49+
- MOVEMENT_METRICS_ADDR=127.0.0.1:9464
50+
- MOVEMENT_OTLP=http://otel-collector:4317
51+
ports:
52+
- "9465:9464"
53+
depends_on:
54+
- prometheus:
55+
condition: service_healthy
56+
- otel-collector:
57+
condition: service_healthy
58+
59+
otel-collector:
60+
image: otel/opentelemetry-collector:0.96.0
61+
container_name: movement-otel-collector
62+
command: ["--config=/etc/otel-collector-config.yaml"]
63+
volumes:
64+
- ./otel-collector-config.yaml:/etc/otel-collector-config.yaml
65+
ports:
66+
- "4317:4317" # OTLP gRPC
67+
- "4318:4318" # OTLP HTTP
68+
- "8888:8888" # Prometheus metrics exposed by the collector
69+
- "8889:8889" # Prometheus exporter metrics
70+
- "13133:13133" # Health check extension
71+
healthcheck:
72+
test: wget --no-verbose --tries=1 --spider http://localhost:13133 || exit 1
73+
interval: 5s
74+
timeout: 3s
75+
retries: 3
76+
77+
volumes:
78+
prometheus_data:
Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
receivers:
2+
otlp:
3+
protocols:
4+
grpc:
5+
endpoint: 127.0.0.1:4317
6+
http:
7+
endpoint: 127.0.0.1:4318
8+
9+
processors:
10+
batch:
11+
timeout: 1s
12+
send_batch_size: 1024
13+
14+
exporters:
15+
prometheus:
16+
endpoint: "127.0.0.1:8889"
17+
namespace: "movement"
18+
const_labels:
19+
label1: value1
20+
logging:
21+
loglevel: debug
22+
23+
extensions:
24+
health_check:
25+
endpoint: 127.0.0.1:13133
26+
27+
service:
28+
extensions: [health_check]
29+
pipelines:
30+
traces:
31+
receivers: [otlp]
32+
processors: [batch]
33+
exporters: [logging]
34+
metrics:
35+
receivers: [otlp]
36+
processors: [batch]
37+
exporters: [prometheus, logging]
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
global:
2+
scrape_interval: 15s
3+
evaluation_interval: 15s
4+
5+
scrape_configs:
6+
- job_name: "movement-full-node"
7+
static_configs:
8+
- targets: ["127.0.0.1:9464"]
9+
metrics_path: /metrics
10+
scheme: http

networks/movement/movement-client/src/bin/e2e/followers_consistent.rs

Lines changed: 3 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -12,8 +12,6 @@ use tokio::sync::RwLock;
1212
use tracing::info;
1313
use url::Url;
1414

15-
const TIMING_LOG_ENV: &str = "SUZUKA_TIMING_LOG";
16-
1715
pub fn get_movement_config(
1816
dot_movement: &DotMovement,
1917
) -> Result<movement_config::Config, anyhow::Error> {
@@ -394,14 +392,11 @@ pub async fn basic_coin_transfers(
394392

395393
#[tokio::main]
396394
async fn main() -> Result<(), anyhow::Error> {
397-
let tracing_config = movement_tracing::Config {
398-
timing_log_path: std::env::var_os(TIMING_LOG_ENV).map(Into::into),
399-
};
395+
let dot_movement = DotMovement::try_from_env().context("Failed to get .movement path")?;
396+
let config = get_movement_config(&dot_movement)?;
397+
let tracing_config = movement_tracing::Config::default();
400398
let _guard = movement_tracing::init_tracing_subscriber(tracing_config);
401399

402-
// Get the lead dot movement from the environment.
403-
let dot_movement = DotMovement::try_from_env()?;
404-
405400
// Get the follower count from the first argument.
406401
let follower_count = std::env::args()
407402
.nth(1)

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

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -2,18 +2,18 @@
22

33
use clap::*;
44
use movement_full_node::MovementFullNode;
5-
const TIMING_LOG_ENV: &str = "SUZUKA_TIMING_LOG";
6-
use std::env;
5+
use std::time::Duration;
76

87
#[tokio::main]
98
async fn main() -> Result<(), anyhow::Error> {
10-
let tracing_config =
11-
movement_tracing::Config { timing_log_path: env::var_os(TIMING_LOG_ENV).map(Into::into) };
12-
let _guard = movement_tracing::init_tracing_subscriber(tracing_config);
9+
let tracing_config = movement_tracing::Config::default();
10+
let _guard = movement_tracing::init_telemetry(tracing_config).await;
11+
12+
tokio::time::sleep(Duration::from_secs(1)).await;
1313

14-
let suzuka_util = MovementFullNode::parse();
14+
let suzuka_util = MovementFullNode::parse();
15+
let result = suzuka_util.execute().await;
1516

16-
suzuka_util.execute().await?;
17-
18-
Ok(())
17+
result
1918
}
19+
Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
version: "3"
2+
3+
environment:
4+
5+
processes:
6+
prometheus:
7+
is_daemon: true
8+
command: |
9+
mkdir -p ${PWD}/tmp/prometheus
10+
cp ${PWD}/docker/compose/movement-full-node/prometheus.yml ${PWD}/tmp/prometheus/prometheus.yml
11+
sed -i.bak 's/movement-full-node:9464/127.0.0.1:9464/g' ${PWD}/tmp/prometheus/prometheus.yml
12+
prometheus --config.file=${PWD}/tmp/prometheus/prometheus.yml --storage.tsdb.path=${PWD}/tmp/prometheus/data --web.listen-address=0.0.0.0:9091 --web.enable-lifecycle
13+
shutdown:
14+
command: |
15+
pkill -f "prometheus --config.file"
16+
readiness_probe:
17+
initial_delay_seconds: 3
18+
exec:
19+
command: curl -s http://127.0.0.1:9091/-/healthy || exit 1
20+
21+
movement-full-node:
22+
depends_on:
23+
prometheus:
24+
condition: process_started
25+
environment:
26+
- MOVEMENT_METRICS_ADDR=127.0.0.1:9464
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
build
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
[package]
2+
name = "Minter"
3+
version = "0.0.0"
4+
5+
[dependencies.AptosFramework]
6+
git = "https://github.com/movementlabsxyz/aptos-core.git"
7+
rev = "movement"
8+
subdir = "aptos-move/framework/aptos-framework"

0 commit comments

Comments
 (0)