-
-
Notifications
You must be signed in to change notification settings - Fork 120
feat: warp10 exporter #76
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from 10 commits
a22b0da
b76a98e
49ee747
243fd72
1dc2b56
cc72f83
85ec3d5
1253836
ad1b6cc
2be0ec0
8e0677b
5f2adf5
aa3ea15
4072cd0
72b7a55
53696f9
0abcb2f
5571d0a
c97c206
4849854
9bf4001
26f8703
a1ddfac
2cd4d30
e59fac3
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| 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"; | ||
|
|
@@ -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, | ||
|
|
@@ -286,7 +287,7 @@ impl Exporter for RiemannExporter { | |
| "Number of processes monitored for the host", | ||
| topo_procs_len, | ||
| ); | ||
|
|
||
| //TODO: metric sent twice ? | ||
| rclient.send_metric( | ||
| 60.0, | ||
| &hostname, | ||
|
|
@@ -312,7 +313,7 @@ impl Exporter for RiemannExporter { | |
| "Number of CPUStat traces stored for each socket", | ||
| socket.stat_buffer.len(), | ||
| ); | ||
|
|
||
| //TODO: fix metric | ||
|
||
| rclient.send_metric( | ||
| 60.0, | ||
| &hostname, | ||
|
|
@@ -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, | ||
|
|
@@ -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; | ||
|
|
||
|
|
@@ -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. | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe 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. | ||
| 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 | ||
|
|
@@ -14,6 +16,14 @@ pub fn filter_qemu_cmdline(cmdline: &str) -> Option<String> { | |
| None | ||
| } | ||
|
|
||
| pub fn get_scaphandre_version() -> String { | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe 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::*; | ||
|
|
||
There was a problem hiding this comment.
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 :)