Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
60 commits
Select commit Hold shift + click to select a range
c3d755b
Merge pull request #256 from hubblo-org/dev
bpetit Jan 30, 2023
832ec60
adding funding file
bpetit Jan 30, 2023
5c8d63c
doc: fix typo in readme
bpetit Feb 1, 2023
b9cbcbe
Add Scaphandre Python binding with the first version of the PowercapR…
fvaleye Jul 3, 2022
f0ddeb4
chore: made sysinfo not optional and bumped version
bpetit Mar 13, 2023
0b094c6
fix: MetricGenerator was broken when containers feat is off
bpetit Mar 13, 2023
9adf9aa
ci: enabling unit tests for windows
bpetit Mar 13, 2023
4227a69
chore: checking sysinfo returns process cmdline as procfs did
bpetit Mar 13, 2023
e57f6ba
style: fmt
bpetit Mar 13, 2023
9d9c090
ci: enforce unit tests
bpetit Mar 13, 2023
6dd0b9a
chore: replaced procfs with sysinfo as a default
bpetit Mar 13, 2023
cc759bc
fix: doctest
bpetit Mar 13, 2023
4012484
docs: edited reference for memory metrics
bpetit Mar 13, 2023
7ab0180
style: fmt
bpetit Mar 13, 2023
6481946
fixed imports fr windows
bpetit Mar 13, 2023
b66ad8d
style: fmt
bpetit Mar 13, 2023
280b2cc
ci: disabled bloat test
bpetit Mar 13, 2023
c16cc2f
fix: updated sysinfo last version changes
bpetit Mar 13, 2023
c1376fb
fix: fixing imports for generate_cpu_cores windows
bpetit Mar 13, 2023
aaf39ae
style: fmt
bpetit Mar 13, 2023
ffcc337
fix: integration test not working on windows
bpetit Mar 13, 2023
bbe1ac9
fix: unit tests for cpu cores on windows
bpetit Mar 13, 2023
5d53be9
fix: test condition
bpetit Mar 13, 2023
fefd81d
fix: troubleshooting prometheus exporter
bpetit Mar 14, 2023
1480cdf
fix: troubleshooting prometheus exporter
bpetit Mar 14, 2023
fb37312
ci: removed useless steps in codesee workflow
bpetit Mar 14, 2023
ea72811
fix: changed doctest to it works for both windows and linux
bpetit Mar 14, 2023
46ca84d
fix: troubleshooting prometheus exporter
bpetit Mar 14, 2023
31ea5cc
feat: adding process_cpu_usage_percentage
bpetit Mar 14, 2023
2fe265d
fix: synchronized cpu usage percentage calculation
bpetit Mar 14, 2023
cae4d16
fix: troubleshooting prometheus exporter
bpetit Mar 14, 2023
ea9ce97
style: fmt
bpetit Mar 14, 2023
ba4afb7
chore: better dashboard for sample stack
bpetit Mar 14, 2023
c59ff50
fix: per process cpu usage percentage calculation
bpetit Mar 14, 2023
e0ec790
style: fmt
bpetit Mar 14, 2023
8df84c5
feat: added memory metrics
bpetit Mar 15, 2023
87e778e
fix: fn name
bpetit Mar 15, 2023
18df52d
chore: added load average to sample dashboard
bpetit Mar 15, 2023
2e9f538
chore: added neutral unit
bpetit Mar 15, 2023
2ff521a
feat: added load average to metrics
bpetit Mar 15, 2023
186f706
feat: added load average to metrics
bpetit Mar 15, 2023
bdda36c
style: fmt
bpetit Mar 15, 2023
e4f9834
fix: updated clean records for sysinfo and cargo fmt
bpetit Mar 15, 2023
fa308fb
feat: added cpu frequency and load avg
bpetit Mar 16, 2023
b8bb032
style: clippy and fmt
bpetit Mar 16, 2023
5e6416e
feat: added per-process disk usage metrics
bpetit Mar 16, 2023
6fb20ab
chore: factorized per process metrics gathering
bpetit Mar 17, 2023
9eff4cb
style: fmt + clippy
bpetit Mar 17, 2023
712cb59
fix: troubleshooting prometheus exporter
bpetit Mar 20, 2023
541e737
style: fmt
bpetit Mar 20, 2023
2b04bdf
style: fmt
bpetit Mar 20, 2023
cbe65ee
style: fmt
bpetit Mar 20, 2023
9ff6df4
fix: troubleshooting prometheus exporter
bpetit Mar 20, 2023
247ddc7
fix: troubleshooting prometheus exporter
bpetit Mar 20, 2023
1ad76ea
fix: troubleshooting prometheus exporter
bpetit Mar 20, 2023
7cbb863
fix: troubleshooting prometheus exporter
bpetit Mar 20, 2023
0a3ff1c
fix: troubleshooting prometheus exporter
bpetit Mar 20, 2023
ffb0659
fix: troubleshooting prometheus exporter
bpetit Mar 20, 2023
df51add
style: cleaning comments and debug messages
bpetit Mar 20, 2023
f4b6b0d
chore: update sample dahsboard
bpetit Mar 20, 2023
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
Prev Previous commit
Next Next commit
style: clippy and fmt
  • Loading branch information
bpetit committed Mar 16, 2023
commit b8bb03288a0c70dea5f6b5baede9862d64a5201b
1 change: 0 additions & 1 deletion src/exporters/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -481,7 +481,6 @@ impl MetricGenerator {
//for c in self.topology.proc_tracker.components() {
// println!("component: {}", c)
//}

}

/// Generate socket metrics.
Expand Down
29 changes: 7 additions & 22 deletions src/sensors/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -178,11 +178,11 @@ impl Topology {

let sysinfo_system = System::new_all();
let sysinfo_cores = sysinfo_system.cpus();
#[cfg(target_os="linux")]
#[cfg(target_os = "linux")]
let cpuinfo = CpuInfo::new().unwrap();
for (id, c) in (0_u16..).zip(sysinfo_cores.iter()) {
let mut info = HashMap::<String, String>::new();
#[cfg(target_os="linux")]
#[cfg(target_os = "linux")]
{
for (k, v) in cpuinfo.get_info(id as usize).unwrap().iter() {
info.insert(String::from(*k), String::from(*v));
Expand Down Expand Up @@ -319,8 +319,6 @@ impl Topology {
//
//}
}
let pt = &mut self.proc_tracker;
info!("REFRESH CPU");
self.proc_tracker.refresh();
self.refresh_procs();
self.refresh_record();
Expand Down Expand Up @@ -552,30 +550,17 @@ impl Topology {
Record::new(
current_system_time_since_epoch(),
self.proc_tracker.get_cpu_frequency().to_string(),
units::Unit::MegaHertz
units::Unit::MegaHertz,
)
}

pub fn get_load_avg(&self) -> Option<Vec<Record>> {
let load = self.get_proc_tracker().sysinfo.load_average();
let timestamp = current_system_time_since_epoch();
Some(
vec![
Record::new(
timestamp,
load.one.to_string(),
units::Unit::Numeric
),
Record::new(
timestamp,
load.five.to_string(),
units::Unit::Numeric
),
Record::new(
timestamp,
load.five.to_string(),
units::Unit::Numeric
)
Some(vec![
Record::new(timestamp, load.one.to_string(), units::Unit::Numeric),
Record::new(timestamp, load.five.to_string(), units::Unit::Numeric),
Record::new(timestamp, load.five.to_string(), units::Unit::Numeric),
])
}

Expand Down
2 changes: 1 addition & 1 deletion src/sensors/units.rs
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ pub enum Unit {
KiloBytes,
MegaBytes,
GigaBytes,
MegaHertz
MegaHertz,
}

impl Unit {
Expand Down
14 changes: 7 additions & 7 deletions src/sensors/utils.rs
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,8 @@ use std::io::{Error, ErrorKind};
use std::path::PathBuf;
use std::time::{Duration, SystemTime};
use sysinfo::{
get_current_pid, CpuExt, Pid, Process, ProcessExt, ProcessStatus, System, SystemExt, CpuRefreshKind
get_current_pid, CpuExt, CpuRefreshKind, Pid, Process, ProcessExt, ProcessStatus, System,
SystemExt,
};
#[cfg(all(target_os = "linux", feature = "containers"))]
use {docker_sync::container::Container, k8s_sync::Pod};
Expand Down Expand Up @@ -94,7 +95,6 @@ impl IProcess {
if let Ok(stat) = procfs_process.stat() {
stime += stat.stime;
utime += stat.utime;

}
}
IProcess {
Expand All @@ -109,7 +109,7 @@ impl IProcess {
utime,
}
}
#[cfg(not(target_os="linux"))]
#[cfg(not(target_os = "linux"))]
{
IProcess {
pid: process.pid(),
Expand All @@ -121,7 +121,6 @@ impl IProcess {
virtual_memory: process.virtual_memory(),
}
}

}

/// Returns the command line of related to the process, as found by sysinfo.
Expand Down Expand Up @@ -255,13 +254,14 @@ impl ProcessTracker {
pub fn refresh(&mut self) {
self.sysinfo.refresh_components();
self.sysinfo.refresh_memory();
self.sysinfo.refresh_cpu_specifics(CpuRefreshKind::everything());
self.sysinfo
.refresh_cpu_specifics(CpuRefreshKind::everything());
}

pub fn components(&mut self) -> Vec<String> {
let mut res = vec![];
for c in self.sysinfo.components() {
res.push(format!("{:?}", c));
res.push(format!("{c:?}"));
}
res
}
Expand Down Expand Up @@ -389,7 +389,7 @@ impl ProcessTracker {
//}

pub fn get_cpu_frequency(&self) -> u64 {
self.sysinfo.global_cpu_info().frequency()
self.sysinfo.global_cpu_info().frequency()
}

/// Returns all vectors of process records linked to a running, sleeping, waiting or zombie process.
Expand Down