Skip to content

Commit 0950060

Browse files
authored
Add support for the Light Client Tracking Service (#768)
1 parent d7752b7 commit 0950060

File tree

11 files changed

+350
-4
lines changed

11 files changed

+350
-4
lines changed

Cargo.lock

Lines changed: 181 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

client/CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22

33
## 1.12.7
44

5+
- Add support for the Light Client Tracking Service
56
- Update `avail-light-core` to 1.2.2
67

78
## [1.12.6](https://github.com/availproject/avail-light/releases/tag/avail-light-client-v1.12.6) - 2025-02-10

client/Cargo.toml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,13 +11,16 @@ avail-light-core = { workspace = true }
1111
avail-rust = { workspace = true }
1212

1313
better-panic = "0.3.0"
14+
chrono = "0.4"
1415
clap = { workspace = true }
1516
color-eyre = { workspace = true }
1617
confy = "0.4.0"
1718
futures = { workspace = true }
1819
hex = { workspace = true }
1920
libp2p = { workspace = true }
21+
reqwest = { version = "0.12", features = ["json"] }
2022
serde = { workspace = true }
23+
serde_json = "1.0"
2124
strip-ansi-escapes = "0.2.0"
2225
tokio = { workspace = true }
2326
tokio-stream = { workspace = true }

client/src/cli.rs

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
use avail_light_core::network::Network;
2-
use clap::{command, Parser};
2+
use clap::{command, ArgAction, Parser};
33
use tracing::Level;
44

55
#[derive(Parser)]
@@ -59,4 +59,13 @@ pub struct CliOpts {
5959
/// Set client alias for use in logs and metrics
6060
#[arg(long)]
6161
pub client_alias: Option<String>,
62+
/// Enable or disable light client tracking service
63+
#[arg(long, action = ArgAction::SetTrue)]
64+
pub tracking_service_enable: bool,
65+
/// Tracking service address
66+
#[arg(long)]
67+
pub tracking_service_address: Option<String>,
68+
/// Tracking service ping interval in seconds
69+
#[arg(long)]
70+
pub tracking_service_ping_interval: Option<u64>,
6271
}

client/src/config.rs

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -56,6 +56,12 @@ pub struct RuntimeConfig {
5656
pub threshold: usize,
5757
/// Client alias for use in logs and metrics
5858
pub client_alias: Option<String>,
59+
/// Enable or disable light client tracking service (default: off)
60+
pub tracking_service_enable: bool,
61+
/// Tracking service address (default: `http://127.0.0.1:8989`)
62+
pub tracking_service_address: String,
63+
/// Tracking service ping interval in seconds (default: 10)
64+
pub tracking_service_ping_interval: u64,
5965
}
6066

6167
impl From<&RuntimeConfig> for SyncClientConfig {
@@ -124,6 +130,9 @@ impl Default for RuntimeConfig {
124130
threshold: 5000,
125131
origin: Origin::External,
126132
client_alias: None,
133+
tracking_service_enable: false,
134+
tracking_service_address: "http://127.0.0.1:8989".to_string(),
135+
tracking_service_ping_interval: 10,
127136
}
128137
}
129138
}

0 commit comments

Comments
 (0)