Skip to content

Commit

Permalink
chore: fmtfix
Browse files Browse the repository at this point in the history
  • Loading branch information
apskhem committed Jan 13, 2025
1 parent 21d8df5 commit 732ca0b
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 8 deletions.
8 changes: 6 additions & 2 deletions catalyst-gateway/bin/src/cli.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,11 @@ use clap::Parser;
use tracing::{error, info};

use crate::{
cardano::start_followers, db::{self, index::session::CassandraSession}, metrics::memory::MemoryMetrics, service::{self, started}, settings::{DocsSettings, ServiceSettings, Settings}
cardano::start_followers,
db::{self, index::session::CassandraSession},
metrics::memory::MemoryMetrics,
service::{self, started},
settings::{DocsSettings, ServiceSettings, Settings},
};

#[derive(Parser)]
Expand Down Expand Up @@ -35,7 +39,7 @@ impl Cli {
match self {
Self::Run(settings) => {
MemoryMetrics::start_metrics_updater();

Settings::init(settings)?;

let mut tasks = Vec::new();
Expand Down
13 changes: 7 additions & 6 deletions catalyst-gateway/bin/src/metrics/memory.rs
Original file line number Diff line number Diff line change
@@ -1,16 +1,16 @@
//! Metrics related to memory analytics.
use memory_stats::memory_stats;
use stats_alloc::{Region, Stats, StatsAlloc, INSTRUMENTED_SYSTEM};
use tracing::log::error;

use std::alloc::System;
use std::{
alloc::System,
sync::{Arc, Mutex},
thread,
time::Duration,
};

use memory_stats::memory_stats;
use stats_alloc::{Region, Stats, StatsAlloc, INSTRUMENTED_SYSTEM};
use tracing::log::error;

lazy_static::lazy_static! {
/// A global, thread-safe container for memory metrics.
static ref GLOBAL_METRICS: Arc<Mutex<MemoryMetrics>> = Arc::new(Mutex::new(MemoryMetrics::default()));
Expand All @@ -27,7 +27,8 @@ static GLOBAL: &StatsAlloc<System> = &INSTRUMENTED_SYSTEM;
/// and physical/virtual memory usage.
#[derive(Debug, Default, Clone)]
pub(crate) struct MemoryMetrics {
/// Statistics from the global allocator, including allocations and deallocations from `stats_alloc::Stats`.
/// Statistics from the global allocator, including allocations and deallocations from
/// `stats_alloc::Stats`.
pub(crate) allocator_stats: Stats,
/// Physical memory usage of the application, if available.
pub(crate) physical_usage: Option<usize>,
Expand Down

0 comments on commit 732ca0b

Please sign in to comment.