Skip to content

Commit

Permalink
feat!: remove loki (#1009)
Browse files Browse the repository at this point in the history
Co-authored-by: /alex/ <alexander.schmidt@iota.org>
  • Loading branch information
grtlr and Alex6323 committed Jan 10, 2023
1 parent 77e3537 commit d9ec6ec
Show file tree
Hide file tree
Showing 10 changed files with 18 additions and 618 deletions.
315 changes: 16 additions & 299 deletions Cargo.lock

Large diffs are not rendered by default.

7 changes: 0 additions & 7 deletions Cargo.toml
Expand Up @@ -75,9 +75,6 @@ zeroize = { version = "1.5", default-features = false, features = [ "std" ], opt
inx = { version = "1.0.0-beta", default-features = false, optional = true }
tonic = { version = "0.8", default-features = false, optional = true }

# Loki
tracing-loki = { version = "0.2", default-features = false, features = [ "compat-0-2-1", "native-tls" ], optional = true }

# PoI
iota-crypto = { version = "0.15", default-features = false, features = [ "blake2b" ], optional = true }

Expand All @@ -90,7 +87,6 @@ default = [
"analytics",
"api",
"inx",
"loki",
"metrics",
"poi",
]
Expand All @@ -117,9 +113,6 @@ inx = [
"dep:inx",
"dep:tonic",
]
loki = [
"dep:tracing-loki",
]
metrics = [
"dep:influxdb",
"dep:chrono",
Expand Down
156 changes: 0 additions & 156 deletions docker/assets/grafana/dashboards/log_dashboard.json

This file was deleted.

11 changes: 0 additions & 11 deletions docker/assets/grafana/datasources/loki_ds.yml

This file was deleted.

42 changes: 0 additions & 42 deletions docker/assets/loki/config.yml

This file was deleted.

18 changes: 0 additions & 18 deletions docker/assets/promtail/config.yml

This file was deleted.

23 changes: 0 additions & 23 deletions docker/docker-compose.yml
Expand Up @@ -40,7 +40,6 @@ services:
- "--inx-url=http://hornet:9029"
- "--jwt-password=${JWT_PASSWORD}"
- "--jwt-salt=${JWT_SALT}"
- "--loki-url=http://loki:3100"

influx:
image: influxdb:1.8
Expand Down Expand Up @@ -164,25 +163,3 @@ services:
- ./assets/grafana/:/etc/grafana/provisioning/
environment:
- GF_INSTALL_PLUGINS=yesoreyeram-infinity-datasource

loki:
image: grafana/loki:latest
profiles:
- metrics
container_name: loki
restart: unless-stopped
ports:
- 3100:3100
volumes:
- ./assets/loki/:/etc/loki/
command: -config.file=/etc/loki/config.yml

promtail:
image: grafana/promtail:latest
profiles:
- metrics
container_name: promtail
volumes:
- ./assets/promtail/:/etc/promtail/
- ./data/promtail/log:/var/log
command: -config.file=/etc/promtail/config.yml
27 changes: 0 additions & 27 deletions src/bin/inx-chronicle/cli.rs
Expand Up @@ -26,10 +26,6 @@ pub struct ClArgs {
#[cfg(feature = "api")]
#[command(flatten, next_help_heading = "API")]
pub api: ApiArgs,
/// Loki arguments.
#[cfg(feature = "loki")]
#[command(flatten, next_help_heading = "Loki")]
pub loki: LokiArgs,
/// Subcommands.
#[command(subcommand)]
pub subcommand: Option<Subcommands>,
Expand Down Expand Up @@ -220,27 +216,6 @@ pub struct JwtArgs {
pub jwt_expiration: std::time::Duration,
}

#[cfg(feature = "loki")]
#[derive(Args, Debug)]
pub struct LokiArgs {
/// The url pointing to a Grafana Loki instance.
#[arg(long, value_name = "URL", default_value = crate::config::loki::DEFAULT_LOKI_URL)]
pub loki_url: String,
/// Disable Grafana Loki log writes.
#[arg(long, default_value_t = !crate::config::loki::DEFAULT_LOKI_ENABLED)]
pub disable_loki: bool,
}

#[cfg(feature = "loki")]
impl From<&LokiArgs> for crate::config::loki::LokiConfig {
fn from(value: &LokiArgs) -> Self {
Self {
enabled: !value.disable_loki,
url: value.loki_url.clone(),
}
}
}

#[cfg(any(feature = "inx", feature = "api"))]
fn parse_duration(arg: &str) -> Result<std::time::Duration, humantime::DurationError> {
arg.parse::<humantime::Duration>().map(Into::into)
Expand All @@ -257,8 +232,6 @@ impl ClArgs {
inx: (&self.inx).into(),
#[cfg(feature = "api")]
api: (&self.api).into(),
#[cfg(feature = "loki")]
loki: (&self.loki).into(),
}
}

Expand Down
26 changes: 0 additions & 26 deletions src/bin/inx-chronicle/config.rs
Expand Up @@ -15,30 +15,4 @@ pub struct ChronicleConfig {
pub api: crate::api::ApiConfig,
#[cfg(feature = "inx")]
pub inx: super::stardust_inx::InxConfig,
#[cfg(feature = "loki")]
pub loki: loki::LokiConfig,
}

#[cfg(feature = "loki")]
pub mod loki {
use super::*;

pub const DEFAULT_LOKI_ENABLED: bool = true;
pub const DEFAULT_LOKI_URL: &str = "http://localhost:3100";

#[derive(Clone, Debug, PartialEq, Eq, Serialize, Deserialize)]
#[serde(default)]
pub struct LokiConfig {
pub enabled: bool,
pub url: String,
}

impl Default for LokiConfig {
fn default() -> Self {
Self {
enabled: DEFAULT_LOKI_ENABLED,
url: DEFAULT_LOKI_URL.to_string(),
}
}
}
}

0 comments on commit d9ec6ec

Please sign in to comment.