Skip to content
Merged
Show file tree
Hide file tree
Changes from 10 commits
Commits
Show all changes
25 commits
Select commit Hold shift + click to select a range
a22b0da
feat: warp10 exporter with first base metrics sent
bpetit Feb 27, 2021
b76a98e
style: cargo fmt
bpetit Feb 27, 2021
49ee747
feat: adding metrics to warp10 exporter
bpetit Feb 27, 2021
243fd72
feat: adding process metrics in warp10 exporter
bpetit Mar 1, 2021
1dc2b56
style: cargo fmt
bpetit Mar 1, 2021
cc72f83
feat: adding qemu option in warp10 exporter
bpetit Mar 1, 2021
85ec3d5
style: cargo fmt
bpetit Mar 1, 2021
1253836
fix: update warp10 and time crates
bpetit Mar 1, 2021
ad1b6cc
style: cargo fmt
bpetit Mar 1, 2021
2be0ec0
fix: cargo clippy
bpetit Mar 1, 2021
8e0677b
fix: putting cmdline items in the right order
bpetit Mar 3, 2021
5f2adf5
fix: removing unused split data feature
bpetit Mar 3, 2021
aa3ea15
fix: commenting unused import
bpetit Mar 3, 2021
4072cd0
docs: cleaning useless comments and adding some description
bpetit Mar 4, 2021
72b7a55
docs: added doc for warp10 exporter
bpetit Mar 4, 2021
53696f9
chore: disabling read-token for now
bpetit Mar 10, 2021
0abcb2f
docs: fixing conflict
bpetit Mar 10, 2021
5571d0a
feat: warp10 write-token as an env var
bpetit Mar 11, 2021
c97c206
Merge branch 'main' into feature/fr-#22-warp10-exporter
bpetit Mar 11, 2021
4849854
fix: enabling default value for step
bpetit Mar 11, 2021
9bf4001
docs: adding write-token to doc
bpetit Mar 11, 2021
26f8703
Merge branch 'feature/fr-#22-warp10-exporter' of github.com:hubblo-or…
bpetit Mar 11, 2021
a1ddfac
docs: fixing weird sentence
bpetit Mar 11, 2021
2cd4d30
fix: metrics with wrong data in riemann exporter
bpetit Mar 11, 2021
e59fac3
docs: updating docs
bpetit Mar 11, 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
2 changes: 2 additions & 0 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,8 @@ hostname = "0.3.1"
protobuf = "^1.0.0"
serde = { version = "1.0", features = ["derive"] }
serde_json = "1.0"
warp10 = "1.0.0"
time = "0.2.25"

[profile.release]
lto = true
Expand Down
1 change: 1 addition & 0 deletions src/exporters/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ pub mod qemu;
pub mod riemann;
pub mod stdout;
pub mod utils;
pub mod warpten;
use clap::ArgMatches;
use std::collections::HashMap;

Expand Down
46 changes: 27 additions & 19 deletions src/exporters/riemann.rs
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
use crate::exporters::*;
use crate::sensors::{RecordGenerator, Sensor};
use clap::crate_version;
use riemann_client::proto::Attribute;
use riemann_client::proto::Event;
use riemann_client::Client;
use std::collections::HashMap;
use std::thread;
use std::time::{Duration, SystemTime, UNIX_EPOCH};
use utils::get_scaphandre_version;

/// Riemann server default ipv4/ipv6 address
const DEFAULT_IP_ADDRESS: &str = "localhost";
Expand Down Expand Up @@ -238,6 +238,7 @@ impl Exporter for RiemannExporter {
value,
);

//TODO: fix this, call resident and not size
let value = metric_value.size * procfs::page_size().unwrap() as u64;
rclient.send_metric(
60.0,
Expand Down Expand Up @@ -286,7 +287,7 @@ impl Exporter for RiemannExporter {
"Number of processes monitored for the host",
topo_procs_len,
);

//TODO: metric sent twice ?
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yep looks like it is the case :)

rclient.send_metric(
60.0,
&hostname,
Expand All @@ -312,7 +313,7 @@ impl Exporter for RiemannExporter {
"Number of CPUStat traces stored for each socket",
socket.stat_buffer.len(),
);

//TODO: fix metric
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe provide a bit more details here.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Here the value is socket.stat_buffer.len() for both scaph_self_socket_stats_nb and scaph_self_socket_records_nb.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yep pitfall here. :(

rclient.send_metric(
60.0,
&hostname,
Expand Down Expand Up @@ -348,15 +349,15 @@ impl Exporter for RiemannExporter {
let host_energy_timestamp_seconds = record.timestamp.as_secs().to_string();

rclient.send_metric(
60.0,
&hostname,
"scaph_host_energy_microjoules",
"ok",
vec!["scaphandre".to_string()],
vec![],
"Energy measurement for the whole host, as extracted from the sensor, in microjoules.",
host_energy_microjoules
);
60.0,
&hostname,
"scaph_host_energy_microjoules",
"ok",
vec!["scaphandre".to_string()],
vec![],
"Energy measurement for the whole host, as extracted from the sensor, in microjoules.",
host_energy_microjoules
);

rclient.send_metric(
60.0,
Expand Down Expand Up @@ -403,6 +404,7 @@ impl Exporter for RiemannExporter {
socket_energy_microjoules.as_ref(),
);

//TODO: fix metric
if let Some(power) = topology.get_records_diff_power_microwatts() {
let socket_power_microwatts = &power.value;

Expand Down Expand Up @@ -582,10 +584,16 @@ impl Exporter for RiemannExporter {
}
}

fn get_scaphandre_version() -> String {
let mut version_parts = crate_version!().split('.');
let major_version = version_parts.next().unwrap();
let patch_version = version_parts.next().unwrap();
let minor_version = version_parts.next().unwrap();
format!("{}.{}{}", major_version, patch_version, minor_version)
}
// Copyright 2020 The scaphandre authors.
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oh great to add the licence !

//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
10 changes: 10 additions & 0 deletions src/exporters/utils.rs
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
use clap::crate_version;

pub fn filter_qemu_cmdline(cmdline: &str) -> Option<String> {
if cmdline.contains("qemu-system") && cmdline.contains("guest=") {
let vmname: Vec<Vec<&str>> = cmdline
Expand All @@ -14,6 +16,14 @@ pub fn filter_qemu_cmdline(cmdline: &str) -> Option<String> {
None
}

pub fn get_scaphandre_version() -> String {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍

let mut version_parts = crate_version!().split('.');
let major_version = version_parts.next().unwrap();
let patch_version = version_parts.next().unwrap();
let minor_version = version_parts.next().unwrap();
format!("{}.{}{}", major_version, patch_version, minor_version)
}

#[cfg(test)]
mod tests {
use super::*;
Expand Down
Loading