Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
21 commits
Select commit Hold shift + click to select a range
d3be377
feat: adding timestamp to Metric struct
bpetit May 14, 2021
a3fc1e3
style(timestamps): cargo fmt
bpetit May 14, 2021
7547a49
Merge branch 'main' into fix/harmonizing-timestamps
bpetit Sep 21, 2021
65a5595
fix: test configuration
bpetit Sep 21, 2021
22f4ccb
refactor: using metric generator for stdout exporter's host metrics
bpetit Sep 21, 2021
40d456a
fix: power value for individual socket was topology power value
bpetit Sep 21, 2021
7dfc719
fix: sockets/domains now working with metric generator in stdout expo…
bpetit Sep 22, 2021
eeb074e
refactor: process metrics now come from metricgenerator in stdout
bpetit Sep 22, 2021
6767393
fix: missing tab
bpetit Sep 22, 2021
cbaaa3e
feat: add timestamp to process metrics in json exporter
bpetit Sep 22, 2021
c69bccd
feat: adding timestamp to socket metric in json exp
bpetit Sep 22, 2021
593a64e
feat: add timestamp to domains metrics in json exp
bpetit Sep 22, 2021
0528082
style: cargo fmt
bpetit Sep 23, 2021
afeccfd
style: cargo fmt
bpetit Sep 23, 2021
54c70d7
Merge branch 'main' into fix/harmonizing-timestamps
bpetit Sep 27, 2021
dbcd26a
refactor: extracted metric generator from the loop in stdout and json…
bpetit Sep 28, 2021
f0db7a0
fix: using pop_metrics everywhere to avoid duplicates, removing get_m…
bpetit Sep 28, 2021
a707559
fix: removed qemu option for json as it is not useful yet
bpetit Sep 29, 2021
ffa3e8e
docs: removed timestamp metric from docs
bpetit Sep 30, 2021
dfda1dd
chore: lowering trace msg log level
bpetit Sep 30, 2021
cd478bb
fix: topology record timestamp is now the same as the last record of …
bpetit Oct 5, 2021
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
Merge branch 'main' into fix/harmonizing-timestamps
  • Loading branch information
bpetit authored Sep 27, 2021
commit 54c70d7c3fcdf0afd950712449dec4964cff9a8b
38 changes: 20 additions & 18 deletions src/exporters/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ use k8s_sync::Pod;
use std::collections::HashMap;
use std::fmt;
use std::time::Duration;
use utils::get_scaphandre_version;
use utils::{get_docker_client, get_kubernetes_client, get_scaphandre_version};

/// General metric definition.
#[derive(Debug)]
Expand Down Expand Up @@ -216,8 +216,8 @@ impl MetricGenerator {
name: String::from("scaph_self_cpu_usage_percent"),
metric_type: String::from("gauge"),
ttl: 60.0,
hostname: String::from(self.hostname),
timestamp: metric_value.timestamp,
hostname: self.hostname.clone(),
state: String::from("ok"),
tags: vec!["scaphandre".to_string()],
attributes: HashMap::new(),
Expand All @@ -236,6 +236,7 @@ impl MetricGenerator {
ttl: 60.0,
hostname: String::from(self.hostname),
timestamp: default_timestamp,
hostname: self.hostname.clone(),
state: String::from("ok"),
tags: vec!["scaphandre".to_string()],
attributes: HashMap::new(),
Expand All @@ -262,8 +263,8 @@ impl MetricGenerator {
name: String::from("scaph_self_mem_shared_resident_size"),
metric_type: String::from("gauge"),
ttl: 60.0,
hostname: String::from(self.hostname),
timestamp: default_timestamp,
hostname: self.hostname.clone(),
state: String::from("ok"),
tags: vec!["scaphandre".to_string()],
attributes: HashMap::new(),
Expand All @@ -282,8 +283,8 @@ impl MetricGenerator {
name: String::from("scaph_self_topo_stats_nb"),
metric_type: String::from("gauge"),
ttl: 60.0,
hostname: String::from(self.hostname),
timestamp: default_timestamp,
hostname: self.hostname.clone(),
state: String::from("ok"),
tags: vec!["scaphandre".to_string()],
attributes: HashMap::new(),
Expand All @@ -295,8 +296,8 @@ impl MetricGenerator {
name: String::from("scaph_self_topo_records_nb"),
metric_type: String::from("gauge"),
ttl: 60.0,
hostname: String::from(self.hostname),
timestamp: default_timestamp,
hostname: self.hostname.clone(),
state: String::from("ok"),
tags: vec!["scaphandre".to_string()],
attributes: HashMap::new(),
Expand All @@ -308,8 +309,8 @@ impl MetricGenerator {
name: String::from("scaph_self_topo_procs_nb"),
metric_type: String::from("gauge"),
ttl: 60.0,
hostname: String::from(self.hostname),
timestamp: default_timestamp,
hostname: self.hostname.clone(),
state: String::from("ok"),
tags: vec!["scaphandre".to_string()],
attributes: HashMap::new(),
Expand All @@ -325,8 +326,8 @@ impl MetricGenerator {
name: String::from("scaph_self_socket_stats_nb"),
metric_type: String::from("gauge"),
ttl: 60.0,
hostname: String::from(self.hostname),
timestamp: default_timestamp,
hostname: self.hostname.clone(),
state: String::from("ok"),
tags: vec!["scaphandre".to_string()],
attributes: attributes.clone(),
Expand All @@ -338,8 +339,8 @@ impl MetricGenerator {
name: String::from("scaph_self_socket_records_nb"),
metric_type: String::from("gauge"),
ttl: 60.0,
hostname: String::from(self.hostname),
timestamp: default_timestamp,
hostname: self.hostname.clone(),
state: String::from("ok"),
tags: vec!["scaphandre".to_string()],
attributes: attributes.clone(),
Expand All @@ -356,8 +357,8 @@ impl MetricGenerator {
name: String::from("scaph_self_domain_records_nb"),
metric_type: String::from("gauge"),
ttl: 60.0,
hostname: String::from(self.hostname),
timestamp: default_timestamp,
hostname: self.hostname.clone(),
state: String::from("ok"),
tags: vec!["scaphandre".to_string()],
attributes: attributes.clone(),
Expand All @@ -383,8 +384,8 @@ impl MetricGenerator {
name: String::from("scaph_host_energy_microjoules"),
metric_type: String::from("counter"),
ttl: 60.0,
hostname: String::from(self.hostname),
timestamp: record.timestamp,
hostname: self.hostname.clone(),
state: String::from("ok"),
tags: vec!["scaphandre".to_string()],
attributes: HashMap::new(),
Expand All @@ -394,13 +395,14 @@ impl MetricGenerator {
metric_value: MetricValueType::Text(host_energy_microjoules),
});


if let Some(power) = self.topology.get_records_diff_power_microwatts() {
self.data.push(Metric {
name: String::from("scaph_host_power_microwatts"),
metric_type: String::from("gauge"),
ttl: 60.0,
hostname: String::from(self.hostname),
timestamp: power.timestamp,
hostname: self.hostname.clone(),
state: String::from("ok"),
tags: vec!["scaphandre".to_string()],
attributes: HashMap::new(),
Expand Down Expand Up @@ -428,8 +430,8 @@ impl MetricGenerator {
name: String::from("scaph_socket_energy_microjoules"),
metric_type: String::from("counter"),
ttl: 60.0,
hostname: String::from(self.hostname),
timestamp: metric_timestamp,
hostname: self.hostname.clone(),
state: String::from("ok"),
tags: vec!["scaphandre".to_string()],
attributes: attributes.clone(),
Expand All @@ -444,8 +446,8 @@ impl MetricGenerator {
name: String::from("scaph_socket_power_microwatts"),
metric_type: String::from("gauge"),
ttl: 60.0,
hostname: String::from(self.hostname),
timestamp: power.timestamp,
hostname: self.hostname.clone(),
state: String::from("ok"),
tags: vec!["scaphandre".to_string()],
attributes: attributes.clone(),
Expand Down Expand Up @@ -513,8 +515,8 @@ impl MetricGenerator {
name: String::from("scaph_forks_since_boot_total"),
metric_type: String::from("counter"),
ttl: 60.0,
hostname: String::from(self.hostname),
timestamp: default_timestamp,
hostname: self.hostname.clone(),
state: String::from("ok"),
tags: vec!["scaphandre".to_string()],
attributes: HashMap::new(),
Expand All @@ -528,8 +530,8 @@ impl MetricGenerator {
name: String::from("scaph_processes_running_current"),
metric_type: String::from("gauge"),
ttl: 60.0,
hostname: String::from(self.hostname),
timestamp: default_timestamp,
hostname: self.hostname.clone(),
state: String::from("ok"),
tags: vec!["scaphandre".to_string()],
attributes: HashMap::new(),
Expand All @@ -543,8 +545,8 @@ impl MetricGenerator {
name: String::from("scaph_processes_blocked_current"),
metric_type: String::from("gauge"),
ttl: 60.0,
hostname: String::from(self.hostname),
timestamp: default_timestamp,
hostname: self.hostname.clone(),
state: String::from("ok"),
tags: vec!["scaphandre".to_string()],
attributes: HashMap::new(),
Expand All @@ -558,8 +560,8 @@ impl MetricGenerator {
name: String::from("scaph_context_switches_total"),
metric_type: String::from("counter"),
ttl: 60.0,
hostname: String::from(self.hostname),
timestamp: default_timestamp,
hostname: self.hostname.clone(),
state: String::from("ok"),
tags: vec!["scaphandre".to_string()],
attributes: HashMap::new(),
Expand Down Expand Up @@ -707,8 +709,8 @@ impl MetricGenerator {
name: metric_name,
metric_type: String::from("gauge"),
ttl: 60.0,
hostname: String::from(self.hostname),
timestamp: power.timestamp,
hostname: self.hostname.clone(),
state: String::from("ok"),
tags: vec!["scaphandre".to_string()],
attributes,
Expand Down
5 changes: 3 additions & 2 deletions src/sensors/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -52,8 +52,9 @@ pub struct Topology {

impl RecordGenerator for Topology {
/// Computes a new Record, stores it in the record_buffer
/// and returns a clone of this record
fn refresh_record(&mut self) {
/// and returns a clone of this record.
///
fn refresh_record(&mut self) -> Record {
let mut value: u64 = 0;
for s in self.get_sockets() {
let records = s.get_records_passive();
Expand Down
You are viewing a condensed version of this merge commit. You can view the full changes here.