Skip to content
This repository has been archived by the owner on Aug 30, 2022. It is now read-only.

metrics settings #493

Merged
merged 7 commits into from
Aug 7, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions configs/config.toml
Original file line number Diff line number Diff line change
Expand Up @@ -23,3 +23,7 @@ model_type = "M3"

[model]
size = 4

[metrics.influxdb]
url = "http://influxdb:8086"
db = "metrics"
4 changes: 4 additions & 0 deletions configs/docker-dev.toml
Original file line number Diff line number Diff line change
Expand Up @@ -23,3 +23,7 @@ model_type = "M3"

[model]
size = 4

[metrics.influxdb]
url = "http://influxdb:8086"
db = "metrics"
4 changes: 4 additions & 0 deletions configs/docker-release.toml
Original file line number Diff line number Diff line change
Expand Up @@ -23,3 +23,7 @@ model_type = "M3"

[model]
size = 4

[metrics.influxdb]
url = "http://influxdb:8086"
db = "metrics"
4 changes: 4 additions & 0 deletions k8s/coordinator/development/config.toml
Original file line number Diff line number Diff line change
Expand Up @@ -23,3 +23,7 @@ model_type = "M3"

[model]
size = 4

[metrics.influxdb]
url = "http://influxdb:8086"
db = "metrics"
1 change: 1 addition & 0 deletions rust/src/bin/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ async fn main() {
api: api_settings,
log: log_settings,
model: model_settings,
metrics: _metrics_settings,
} = Settings::new(opt.config_path).unwrap_or_else(|err| {
eprintln!("{}", err);
process::exit(1);
Expand Down
47 changes: 47 additions & 0 deletions rust/src/settings.rs
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,8 @@ pub struct Settings {
pub mask: MaskSettings,
pub log: LoggingSettings,
pub model: ModelSettings,
#[validate]
pub metrics: MetricsSettings,
}

impl Settings {
Expand Down Expand Up @@ -436,6 +438,51 @@ pub struct ModelSettings {
pub size: usize,
}

#[derive(Debug, Deserialize, Validate)]
/// Metrics settings.
pub struct MetricsSettings {
#[validate]
/// Settings for the InfluxDB backend.
pub influxdb: InfluxSettings,
}

#[derive(Debug, Deserialize, Validate)]
/// InfluxDB settings.
pub struct InfluxSettings {
#[validate(url)]
/// The URL where InfluxDB is running.
///
/// # Examples
///
/// **TOML**
/// ```text
/// [metrics.influxdb]
/// url = "http://localhost:8086"
/// ```
///
/// **Environment variable**
/// ```text
/// XAYNET_METRICS__INFLUXDB__URL=http://localhost:8086
/// ```
pub url: String,

/// The InfluxDB database name.
///
/// # Examples
///
/// **TOML**
/// ```text
/// [metrics.influxdb]
/// db = "test"
/// ```
///
/// **Environment variable**
/// ```text
/// XAYNET_METRICS__INFLUXDB__DB=test
/// ```
pub db: String,
}

#[derive(Debug, Deserialize)]
/// Logging settings.
pub struct LoggingSettings {
Expand Down