From 3ba0513be5c027df1d892d217f393770f31e003d Mon Sep 17 00:00:00 2001 From: 0xevolve Date: Fri, 15 Dec 2023 18:02:27 +0100 Subject: [PATCH] fix: linters --- .github/workflows/linters-cargo.yml | 2 +- .github/workflows/linters.yml | 2 +- .github/workflows/pull-request.yml | 2 +- .github/workflows/rust-build.yml | 2 +- .vscode/settings.json | 7 ++----- Cargo.toml | 30 ++++++++++++++--------------- README.md | 1 - prometheus/alertmanager.yml | 22 ++++++++++----------- prometheus/alerts.rules.yml | 20 +++++++++---------- prometheus/prometheus.yml | 10 +++++----- taplo/README.md | 2 +- 11 files changed, 48 insertions(+), 52 deletions(-) diff --git a/.github/workflows/linters-cargo.yml b/.github/workflows/linters-cargo.yml index 50ab539..9617223 100644 --- a/.github/workflows/linters-cargo.yml +++ b/.github/workflows/linters-cargo.yml @@ -20,4 +20,4 @@ jobs: run: | cargo fmt -- --check cargo clippy --no-deps -- -D warnings - cargo clippy --tests --no-deps -- -D warnings \ No newline at end of file + cargo clippy --tests --no-deps -- -D warnings diff --git a/.github/workflows/linters.yml b/.github/workflows/linters.yml index 1bbafa6..42f8c8d 100644 --- a/.github/workflows/linters.yml +++ b/.github/workflows/linters.yml @@ -30,4 +30,4 @@ jobs: - name: Checkout toml files uses: actions/checkout@v3 - name: Run toml check - run: npx @taplo/cli fmt --config ./taplo/taplo.toml --check \ No newline at end of file + run: npx @taplo/cli fmt --config ./taplo/taplo.toml --check diff --git a/.github/workflows/pull-request.yml b/.github/workflows/pull-request.yml index e1dfa90..93081bc 100644 --- a/.github/workflows/pull-request.yml +++ b/.github/workflows/pull-request.yml @@ -20,4 +20,4 @@ jobs: linters_cargo: name: Run Cargo linters uses: ./.github/workflows/linters-cargo.yml - needs: rust_build \ No newline at end of file + needs: rust_build diff --git a/.github/workflows/rust-build.yml b/.github/workflows/rust-build.yml index 6736f08..f7cb3e0 100644 --- a/.github/workflows/rust-build.yml +++ b/.github/workflows/rust-build.yml @@ -19,4 +19,4 @@ jobs: - name: Build the project run: | - cargo build --release --workspace \ No newline at end of file + cargo build --release --workspace diff --git a/.vscode/settings.json b/.vscode/settings.json index e057c1c..c062259 100644 --- a/.vscode/settings.json +++ b/.vscode/settings.json @@ -1,6 +1,3 @@ { - "rust-analyzer.linkedProjects": [ - "Cargo.toml", - "./Cargo.toml" - ] -} \ No newline at end of file + "rust-analyzer.linkedProjects": ["Cargo.toml", "./Cargo.toml"] +} diff --git a/Cargo.toml b/Cargo.toml index de29856..e4d0000 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -8,9 +8,10 @@ edition = "2021" [dependencies] axum = { version = "0.6", features = ["macros", "multipart"] } axum-macros = "0.3" -chrono = "0.4" bigdecimal = "0.4.1" -num-bigint = "0.4" +chrono = "0.4" +coingecko = "1.0.1" +deadpool = { version = "0.9.3", features = ["managed"] } diesel = { version = "2.1.0", features = [ "postgres", "numeric", @@ -24,21 +25,20 @@ diesel-async = { version = "0.4.1", features = [ "postgres", "tokio", ] } -dotenv = "0.15.0" diesel_derives = "1.4.0" diesel_migrations = "2" -uuid = { version = "1.4", features = ["fast-rng", "v4", "serde"] } -tokio = { version = "1", features = ["full"] } -starknet_api = "0.4.1" -starknet = "0.8.0" -deadpool = { version = "0.9.3", features = ["managed"] } +dotenv = "0.15.0" +env_logger = "0.10.1" futures = "0.3.28" -prometheus = "0.13.3" -lazy_static = "1.4.0" hyper = "0.14.27" -url = "2.5.0" -strum = { version = "0.25.0", features = ["derive"] } -coingecko = "1.0.1" -phf = { version = "0.11", features = ["macros"] } +lazy_static = "1.4.0" log = "0.4.20" -env_logger = "0.10.1" +num-bigint = "0.4" +phf = { version = "0.11", features = ["macros"] } +prometheus = "0.13.3" +starknet = "0.8.0" +starknet_api = "0.4.1" +strum = { version = "0.25.0", features = ["derive"] } +tokio = { version = "1", features = ["full"] } +url = "2.5.0" +uuid = { version = "1.4", features = ["fast-rng", "v4", "serde"] } diff --git a/README.md b/README.md index c63aa95..bb3ca1d 100644 --- a/README.md +++ b/README.md @@ -5,4 +5,3 @@ This service runs a prometheus server that returns metrics on the `/metrics` route. It powers our internal grafana dashboards and alerts. - \ No newline at end of file diff --git a/prometheus/alertmanager.yml b/prometheus/alertmanager.yml index ab6db7e..dd7c2b1 100644 --- a/prometheus/alertmanager.yml +++ b/prometheus/alertmanager.yml @@ -1,18 +1,18 @@ global: - smtp_smarthost: '${SMTP_HOST}' - smtp_from: '${SMTP_FROM}' - smtp_auth_username: '${SMTP_AUTH_USERNAME}' - smtp_auth_password: '${SMTP_AUTH_PASSWORD}' - smtp_require_tls: true + smtp_smarthost: "${SMTP_HOST}" + smtp_from: "${SMTP_FROM}" + smtp_auth_username: "${SMTP_AUTH_USERNAME}" + smtp_auth_password: "${SMTP_AUTH_PASSWORD}" + smtp_require_tls: true route: - group_by: ['instance', 'severity'] + group_by: ["instance", "severity"] group_wait: 30s group_interval: 5m repeat_interval: 4h - receiver: 'email_configs' + receiver: "email_configs" receivers: -- name: 'email_configs' - email_configs: - - to: '${EMAIL_TO}' - send_resolved: true \ No newline at end of file + - name: "email_configs" + email_configs: + - to: "${EMAIL_TO}" + send_resolved: true diff --git a/prometheus/alerts.rules.yml b/prometheus/alerts.rules.yml index 4c7a95f..89b5141 100644 --- a/prometheus/alerts.rules.yml +++ b/prometheus/alerts.rules.yml @@ -1,11 +1,11 @@ groups: -- name: example - rules: - - alert: TimeSinceLastUpdateTooHigh - expr: time_since_last_update_seconds > 1200 - for: 5m - labels: - severity: critical - annotations: - summary: "Time since the last update is too high" - description: "The time since the last update of {{ $labels.pair }} from {{ $labels.source }} has exceeded 1200 seconds." + - name: example + rules: + - alert: TimeSinceLastUpdateTooHigh + expr: time_since_last_update_seconds > 1200 + for: 5m + labels: + severity: critical + annotations: + summary: "Time since the last update is too high" + description: "The time since the last update of {{ $labels.pair }} from {{ $labels.source }} has exceeded 1200 seconds." diff --git a/prometheus/prometheus.yml b/prometheus/prometheus.yml index 8547640..b7606c0 100644 --- a/prometheus/prometheus.yml +++ b/prometheus/prometheus.yml @@ -3,13 +3,13 @@ global: evaluation_interval: 15s scrape_configs: - - job_name: 'prometheus_monitoring' + - job_name: "prometheus_monitoring" static_configs: - - targets: ['127.0.0.1:8080'] + - targets: ["127.0.0.1:8080"] rule_files: - "alerts.rules.yml" alerting: alertmanagers: - - static_configs: - - targets: - - localhost:9093 + - static_configs: + - targets: + - localhost:9093 diff --git a/taplo/README.md b/taplo/README.md index 0b131e6..0d097bf 100644 --- a/taplo/README.md +++ b/taplo/README.md @@ -46,4 +46,4 @@ readable formatting. Taplo allows you to customize the formatting rules by adding configuration options. You can find the available options and how to use them -[here](https://taplo.tamasfe.dev/configuration/formatter-options.html). \ No newline at end of file +[here](https://taplo.tamasfe.dev/configuration/formatter-options.html).