Skip to content

Commit

Permalink
Merge tag 'v3.12.0' into merge_v3.11.0
Browse files Browse the repository at this point in the history
  • Loading branch information
krispraws committed Mar 28, 2024
2 parents 07e8e5f + fa5a6e4 commit 480025d
Show file tree
Hide file tree
Showing 26 changed files with 1,089 additions and 443 deletions.
17 changes: 15 additions & 2 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,17 @@
## [Unreleased]

## [3.12.0] - 2024-03-28

## Added
- MacOS cpu usage sampling. (#203)
- Metric unit annotations are added and exposed as metadata.
- Logs version number on startup. (#213)

## Fixed

- Incorrect summary stats (percentiles) were reported in version 3.10.2, 3.10.3,
and 3.11.0. (#216)

## [3.11.0] - 2024-03-25

## Changed
Expand Down Expand Up @@ -185,8 +197,9 @@
- Rewritten implementation of Rezolus using libbpf-rs and perf-event2 to provide
a more modern approach to BPF and Perf Event instrumentation.

[unreleased]: https://github.com/iopsystems/rezolus/compare/v3.11.0...HEAD
[3.10.3]: https://github.com/iopsystems/rezolus/compare/v3.10.3...v3.11.0
[unreleased]: https://github.com/iopsystems/rezolus/compare/v3.12.0...HEAD
[3.12.0]: https://github.com/iopsystems/rezolus/compare/v3.11.0...v3.12.0
[3.11.0]: https://github.com/iopsystems/rezolus/compare/v3.10.3...v3.11.0
[3.10.3]: https://github.com/iopsystems/rezolus/compare/v3.10.2...v3.10.3
[3.10.2]: https://github.com/iopsystems/rezolus/compare/v3.10.1...v3.10.2
[3.10.1]: https://github.com/iopsystems/rezolus/compare/v3.10.0...v3.10.1
Expand Down
5 changes: 3 additions & 2 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 2 additions & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ edition = "2021"
description = "High resolution systems performance telemetry agent"

[workspace.package]
version = "3.11.0"
version = "3.12.0"
license = "MIT OR Apache-2.0"

[dependencies]
Expand All @@ -22,6 +22,7 @@ linkme = "0.3.15"
metriken = "0.5.1"
metriken-exposition = { version = "0.2.0", features = ["serde", "msgpack"] }
memmap2 = "0.5.10"
num_cpus = "1.16.0"
once_cell = "1.18.0"
ouroboros = "0.17.2"
ringlog = "0.6.0"
Expand Down
9 changes: 6 additions & 3 deletions src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,8 @@ use std::time::SystemTime;
use std::time::{Duration, Instant};
use tokio::sync::RwLock;

const VERSION: &str = env!("CARGO_PKG_VERSION");

type HistogramSnapshots = HashMap<String, HistogramSnapshot>;

static SNAPSHOTS: Lazy<Arc<RwLock<Snapshots>>> =
Expand Down Expand Up @@ -50,8 +52,9 @@ impl Snapshots {

for (name, previous) in &self.previous {
if let Some(histogram) = current.get(name).cloned() {
let _ = histogram.wrapping_sub(previous);
delta.insert(name.to_string(), histogram);
if let Ok(d) = histogram.wrapping_sub(previous) {
delta.insert(name.to_string(), d);
}
}
}

Expand Down Expand Up @@ -165,7 +168,7 @@ fn main() {
}
});

info!("rezolus");
info!("rezolus {VERSION}");

// spawn http exposition thread
rt.spawn(exposition::http(config.clone()));
Expand Down
104 changes: 78 additions & 26 deletions src/samplers/block_io/stats.rs
Original file line number Diff line number Diff line change
@@ -1,96 +1,148 @@
use crate::common::HISTOGRAM_GROUPING_POWER;
use crate::*;
use metriken::*;

bpfhistogram!(
BLOCKIO_LATENCY,
"blockio/latency",
"distribution of block IO latencies"
);
bpfhistogram!(
BLOCKIO_SIZE,
"blockio/size",
"distribution of block IO sizes"
);
#[metric(
name = "blockio/latency",
description = "Distribution of blockio operation latency in nanoseconds",
metadata = { unit = "nanoseconds" }
)]
pub static BLOCKIO_LATENCY: RwLockHistogram = RwLockHistogram::new(HISTOGRAM_GROUPING_POWER, 64);

#[metric(
name = "blockio/size",
description = "Distribution of blockio operation sizes in bytes",
metadata = { unit = "bytes" }
)]
pub static BLOCKIO_SIZE: RwLockHistogram = RwLockHistogram::new(HISTOGRAM_GROUPING_POWER, 64);

#[metric(
name = "blockio/operations",
description = "The number of completed read operations for block devices",
formatter = blockio_metric_formatter,
metadata = { op = "read" }
metadata = { op = "read", unit = "operations" }
)]
pub static BLOCKIO_READ_OPS: LazyCounter = LazyCounter::new(Counter::default);

histogram!(BLOCKIO_READ_OPS_HISTOGRAM, "blockio/read/operations");
#[metric(
name = "blockio/read/operations",
description = "Distribution of blockio read operation rates from sample to sample",
metadata = { unit = "operations/second" }
)]
pub static BLOCKIO_READ_OPS_HISTOGRAM: AtomicHistogram =
AtomicHistogram::new(HISTOGRAM_GROUPING_POWER, 64);

#[metric(
name = "blockio/operations",
description = "The number of completed write operations for block devices",
formatter = blockio_metric_formatter,
metadata = { op = "write" }
metadata = { op = "write", unit = "operations" }
)]
pub static BLOCKIO_WRITE_OPS: LazyCounter = LazyCounter::new(Counter::default);

histogram!(BLOCKIO_WRITE_OPS_HISTOGRAM, "blockio/write/operations");
#[metric(
name = "blockio/write/operations",
description = "Distribution of blockio write operation rates from sample to sample",
metadata = { unit = "operations/second" }
)]
pub static BLOCKIO_WRITE_OPS_HISTOGRAM: AtomicHistogram =
AtomicHistogram::new(HISTOGRAM_GROUPING_POWER, 64);

#[metric(
name = "blockio/operations",
description = "The number of completed discard operations for block devices",
formatter = blockio_metric_formatter,
metadata = { op = "discard" }
metadata = { op = "discard", unit = "operations" }
)]
pub static BLOCKIO_DISCARD_OPS: LazyCounter = LazyCounter::new(Counter::default);

histogram!(BLOCKIO_DISCARD_OPS_HISTOGRAM, "blockio/discard/operations");
#[metric(
name = "blockio/discard/operations",
description = "Distribution of blockio discard operation rates from sample to sample",
metadata = { unit = "operations/second" }
)]
pub static BLOCKIO_DISCARD_OPS_HISTOGRAM: AtomicHistogram =
AtomicHistogram::new(HISTOGRAM_GROUPING_POWER, 64);

#[metric(
name = "blockio/operations",
description = "The number of completed flush operations for block devices",
formatter = blockio_metric_formatter,
metadata = { op = "flush" }
metadata = { op = "flush", unit = "operations" }
)]
pub static BLOCKIO_FLUSH_OPS: LazyCounter = LazyCounter::new(Counter::default);

histogram!(BLOCKIO_FLUSH_OPS_HISTOGRAM, "blockio/flush/operations");
#[metric(
name = "blockio/flush/operations",
description = "Distribution of blockio flush operation rates from sample to sample",
metadata = { unit = "operations/second" }
)]
pub static BLOCKIO_FLUSH_OPS_HISTOGRAM: AtomicHistogram =
AtomicHistogram::new(HISTOGRAM_GROUPING_POWER, 64);

#[metric(
name = "blockio/bytes",
description = "The number of bytes read for block devices",
formatter = blockio_metric_formatter,
metadata = { op = "read" }
metadata = { op = "read", unit = "bytes" }
)]
pub static BLOCKIO_READ_BYTES: LazyCounter = LazyCounter::new(Counter::default);

histogram!(BLOCKIO_READ_BYTES_HISTOGRAM, "blockio/read/bytes");
#[metric(
name = "blockio/read/bytes",
description = "Distribution of blockio read throughput from sample to sample",
metadata = { unit = "bytes/second" }
)]
pub static BLOCKIO_READ_BYTES_HISTOGRAM: AtomicHistogram =
AtomicHistogram::new(HISTOGRAM_GROUPING_POWER, 64);

#[metric(
name = "blockio/bytes",
description = "The number of bytes written for block devices",
formatter = blockio_metric_formatter,
metadata = { op = "write" }
metadata = { op = "write", unit = "bytes" }
)]
pub static BLOCKIO_WRITE_BYTES: LazyCounter = LazyCounter::new(Counter::default);

histogram!(BLOCKIO_WRITE_BYTES_HISTOGRAM, "blockio/write/bytes");
#[metric(
name = "blockio/write/bytes",
description = "Distribution of blockio write throughput from sample to sample",
metadata = { unit = "bytes/second" }
)]
pub static BLOCKIO_WRITE_BYTES_HISTOGRAM: AtomicHistogram =
AtomicHistogram::new(HISTOGRAM_GROUPING_POWER, 64);

#[metric(
name = "blockio/bytes",
description = "The number of bytes discarded for block devices",
formatter = blockio_metric_formatter,
metadata = { op = "discard" }
metadata = { op = "discard", unit = "bytes" }
)]
pub static BLOCKIO_DISCARD_BYTES: LazyCounter = LazyCounter::new(Counter::default);

histogram!(BLOCKIO_DISCARD_BYTES_HISTOGRAM, "blockio/discard/bytes");
#[metric(
name = "blockio/discard/bytes",
description = "Distribution of blockio discard throughput from sample to sample",
metadata = { unit = "bytes/second" }
)]
pub static BLOCKIO_DISCARD_BYTES_HISTOGRAM: AtomicHistogram =
AtomicHistogram::new(HISTOGRAM_GROUPING_POWER, 64);

#[metric(
name = "blockio/bytes",
description = "The number of bytes flushed for block devices",
formatter = blockio_metric_formatter,
metadata = { op = "flush" }
metadata = { op = "flush", unit = "bytes" }
)]
pub static BLOCKIO_FLUSH_BYTES: LazyCounter = LazyCounter::new(Counter::default);

histogram!(BLOCKIO_FLUSH_BYTES_HISTOGRAM, "blockio/flush/bytes");
#[metric(
name = "blockio/flush/bytes",
description = "Distribution of blockio flush throughput from sample to sample",
metadata = { unit = "bytes/second" }
)]
pub static BLOCKIO_FLUSH_BYTES_HISTOGRAM: AtomicHistogram =
AtomicHistogram::new(HISTOGRAM_GROUPING_POWER, 64);

/// A function to format the blockio metrics that allows for export of ops and
/// byte counters by operation type.
Expand Down
2 changes: 2 additions & 0 deletions src/samplers/cpu/linux/mod.rs
Original file line number Diff line number Diff line change
@@ -1,2 +1,4 @@
mod perf;
mod usage;

pub mod stats;
1 change: 0 additions & 1 deletion src/samplers/cpu/linux/perf/mod.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
use crate::common::Nop;
use crate::samplers::cpu::stats::*;
use crate::samplers::cpu::*;
use metriken::{DynBoxedMetric, MetricBuilder};
use perf_event::events::x86::{Msr, MsrId};
Expand Down
Loading

0 comments on commit 480025d

Please sign in to comment.