Skip to content

Commit

Permalink
Reconnect telemetry
Browse files Browse the repository at this point in the history
Signed-off-by: Alexey Kalita <kalita.alexey@outlook.com>
  • Loading branch information
KalitaAlexey committed Nov 2, 2021
1 parent 53190df commit f855e25
Show file tree
Hide file tree
Showing 6 changed files with 400 additions and 91 deletions.
1 change: 1 addition & 0 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 2 additions & 1 deletion core/genesis.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,8 @@
"Domain": {
"name": "wonderland",
"accounts": {},
"asset_definitions": {}
"asset_definitions": {},
"metadata": {}
}
}
}
Expand Down
24 changes: 24 additions & 0 deletions docs/source/references/config.md
Original file line number Diff line number Diff line change
Expand Up @@ -83,6 +83,8 @@ Configuration of iroha is done via options in the following document. Here is de
"TELEMETRY": {
"NAME": null,
"URL": null,
"MIN_PERIOD": 0,
"MAX_POWER": 0,
"FILE": null
},
"NETWORK": {
Expand Down Expand Up @@ -530,6 +532,8 @@ Has type `iroha_telemetry::Configuration`. Can be configured via environment var
```json
{
"FILE": null,
"MAX_POWER": 0,
"MIN_PERIOD": 0,
"NAME": null,
"URL": null
}
Expand All @@ -545,6 +549,26 @@ Has type `Option<PathBuf>`. Can be configured via environment variable `TELEMETR
null
```

### `telemetry.max_power`

The maximum power of 2 that is used for increasing delay between reconnections

Has type `u8`. Can be configured via environment variable `TELEMETRY_MAX_POWER`

```json
0
```

### `telemetry.min_period`

The minimum period of time in seconds to wait before reconnecting

Has type `u64`. Can be configured via environment variable `TELEMETRY_MIN_PERIOD`

```json
0
```

### `telemetry.name`

The node's name to be seen on the telemetry
Expand Down
1 change: 1 addition & 0 deletions telemetry/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ build = "build.rs"
dev-telemetry = []

[dependencies]
async-trait = "0.1"
chrono = "0.4"
eyre = "0.6.5"
futures = { version = "0.3.17", default-features = false, features = ["std", "async-await"] }
Expand Down
14 changes: 14 additions & 0 deletions telemetry/src/config.rs
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,22 @@ pub struct Configuration {
/// The url of the telemetry, e.g., ws://127.0.0.1:8001/submit
#[config(serde_as_str)]
pub url: Option<Url>,
/// The minimum period of time in seconds to wait before reconnecting
#[serde(default = "default_min_period")]
pub min_period: u64,
/// The maximum power of 2 that is used for increasing delay between reconnections
#[serde(default = "default_max_power")]
pub max_power: u8,
/// The filepath that to write dev-telemetry to
#[cfg(feature = "dev-telemetry")]
#[config(serde_as_str)]
pub file: Option<PathBuf>,
}

fn default_min_period() -> u64 {
1
}

fn default_max_power() -> u8 {
4
}
Loading

0 comments on commit f855e25

Please sign in to comment.