Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
113 commits
Select commit Hold shift + click to select a range
0ceb89e
fix prometheus metric name and label key sanitizer (#296)
wx-csy Apr 8, 2022
9742439
metrics-util: add ability to collect metrics on a per-thread basis vi…
tobz May 2, 2022
8d1f0f8
(cargo-release) version 0.12.1
tobz May 2, 2022
69405ab
Improve handling of the global recorder instance (#302)
Noratrieb May 25, 2022
5cfd33f
Fix `metrics::Cow` provenance issue (#303)
Noratrieb May 27, 2022
c569514
Quantile Remapping Fix (#304)
dwlbnks May 30, 2022
2122f82
update changelogs prior to release
tobz May 30, 2022
d6c1e30
(cargo-release) version 0.19.0
tobz May 30, 2022
74c3fa1
(cargo-release) version 0.13.0
tobz May 30, 2022
c369fd4
(cargo-release) version 0.11.0
tobz May 30, 2022
caeb1ca
(cargo-release) version 0.10.0
tobz May 30, 2022
0dd62d5
Update CHANGELOG.md
tobz May 30, 2022
a261edd
Update README.md
tobz Jun 3, 2022
807fde0
Update ci.yml
tobz Jun 28, 2022
b8450d6
Update ci.yml
tobz Jun 28, 2022
1b95311
Add RollingSummary to prevent summary saturation (#306)
danielnelson Jun 28, 2022
e97f857
Update quanta requirement from 0.9.3 to 0.10.0 (#301)
dependabot[bot] Jun 29, 2022
1af6758
Document CI enforced msrv in readme and rust-version fields (#311)
rukai Jul 6, 2022
4d92d07
Change description to be SharedString (#312)
fredr Jul 7, 2022
12a1014
Update hashbrown requirement from 0.11 to 0.12 (#266)
dependabot[bot] Jul 20, 2022
6f043e8
Shims remaining AtomicU64 usage (#313)
huntc Jul 20, 2022
94efd43
Update parking_lot requirement from 0.11 to 0.12 (#268)
dependabot[bot] Jul 20, 2022
7384bcc
update changelogs
tobz Jul 21, 2022
fa7589b
(cargo-release) version 0.13.1
tobz Jul 21, 2022
65d965c
add std atomics handle support back + changelogs
tobz Jul 21, 2022
67e8799
(cargo-release) version 0.20.0
tobz Jul 21, 2022
a5e60c2
(cargo-release) version 0.14.0
tobz Jul 21, 2022
2770bf0
(cargo-release) version 0.11.0
tobz Jul 21, 2022
f9891ba
changelog
tobz Jul 21, 2022
4c10ade
(cargo-release) version 0.12.0
tobz Jul 21, 2022
4c50eb1
(cargo-release) version 0.7.0
tobz Jul 21, 2022
6eb2b13
update changelog
tobz Jul 22, 2022
0042439
(cargo-release) version 0.6.0
tobz Jul 22, 2022
be6eba2
update changelog
tobz Jul 22, 2022
43287e5
(cargo-release) version 0.20.1
tobz Jul 22, 2022
64d5c5a
Remove incorrect return info (#316)
fredr Jul 27, 2022
1bb22fe
Add a `KeyName` argument to `LabelFilter::should_include_label` (#342)
zohnannor Jan 21, 2023
425aea2
rewind
tobz Jan 21, 2023
0f41ac5
(cargo-release) version 0.13.0
tobz Jan 21, 2023
8775cbf
Use std sync primitives instead of parking_lot. (#344)
BratSinot Mar 12, 2023
1d92d57
clean up github CI workflow + rust-toolchain.toml to match quanta
tobz Apr 5, 2023
058d29e
update portable-atomic to 1.0
tobz Apr 5, 2023
65d57b0
bump to prost 0.11 + fix spelling issue in metrics-tracing-context
tobz Apr 5, 2023
a47f3c3
bump MSRV to 1.61 + update hashbrown/ahash deps
tobz Apr 5, 2023
471201f
update termion/ordered-float and pin predicates-* to avoid stupid 1.6…
tobz Apr 5, 2023
a0bd91a
update syn
tobz Apr 5, 2023
9805689
update quanta + clean up semver notation in cargo.toml
tobz Apr 5, 2023
34933cb
cleanup README wording for MSRV policy
tobz Apr 5, 2023
0dc3a2f
Add white background to splash image (#348)
Xaeroxe Apr 5, 2023
1c40c2d
Install protoc in CI.
tobz Apr 5, 2023
8105332
fix spelling error in CI workflow
tobz Apr 5, 2023
a38c534
Update ci.yml
tobz Apr 5, 2023
7e4b161
no need to run CI against macOS/Windows specifically
tobz Apr 5, 2023
c2c9908
Bring the metrics-observer protobufs up to date (#345)
ceejbot Apr 5, 2023
179a083
Use global paths for macros (#358)
CinchBlue Apr 13, 2023
3dd299a
fix changes to fully qualified metrics crate ref change in macros
tobz Apr 14, 2023
4d879a5
update changelog
tobz Apr 14, 2023
cd6d24a
update tui to 0.19
tobz Apr 14, 2023
665a662
bump numpy dep
tobz Apr 14, 2023
90dbd7e
impl std::error::Error for metrics_exporter_tcp::Error
tobz Apr 15, 2023
7e565c5
changelog
tobz Apr 15, 2023
9c56ae4
tweak test to avoid unused code
tobz Apr 15, 2023
a3a706b
rework 32 vs 64-bit arch atomics support + a lot of import consolidat…
tobz Apr 15, 2023
f1937fe
const-ify some stuff + rewrite some comments for the global recorder …
tobz Apr 15, 2023
1e9815b
clean up clippy lints
tobz Apr 15, 2023
68f7bd3
bump MSRV to 1.61.0
tobz Apr 15, 2023
2152daf
(cargo-release) version 0.7.0
tobz Apr 16, 2023
14876b0
(cargo-release) version 0.21.0
tobz Apr 16, 2023
9108ad5
(cargo-release) version 0.15.0
tobz Apr 16, 2023
ccb9a90
(cargo-release) version 0.14.0
tobz Apr 16, 2023
e659c36
(cargo-release) version 0.8.0
tobz Apr 16, 2023
78aad2b
(cargo-release) version 0.12.0
tobz Apr 16, 2023
8e2e39d
allow publishing
tobz Apr 16, 2023
8aa249c
(cargo-release) version 0.2.0
tobz Apr 16, 2023
d28fa41
make it publishable pt 2
tobz Apr 16, 2023
c91d8f1
push-gateway support authentication (#366)
JasonLi-cn May 9, 2023
96ab47f
Merge branch 'main' of github.com:metrics-rs/metrics
tobz May 9, 2023
ca59173
update changelog + fix failing feature check test
tobz May 9, 2023
f7434bd
(cargo-release) version 0.12.1
tobz May 9, 2023
c15c0ed
feat(util): new helper type for recovering recorder after installing …
tobz May 12, 2023
a4b2fc1
Update aho-corasick to 1.0.
tobz Jun 5, 2023
20d207f
Impl From<std::borrow::Cow> for KeyName (#378)
mooso Jun 13, 2023
c282e44
changelog
tobz Jun 13, 2023
c04028c
Add `Borrow` impl to `KeyName` (#381)
hlbarber Jun 22, 2023
61580c0
bump deps + clippy stuff
tobz Jul 2, 2023
4ba145f
changelog
tobz Jul 2, 2023
9d141d1
pin hashbrown to avoid MSRV bump
tobz Jul 2, 2023
deead8b
(cargo-release) version 0.15.1
tobz Jul 2, 2023
0ffcc48
(cargo-release) version 0.21.1
tobz Jul 2, 2023
0193688
Add metadata to metrics (#380)
hlbarber Jul 15, 2023
d817f5c
add https support in Prometheus gateway (#392)
Sep 21, 2023
d788aae
migrate from procedural to declarative macros (#386)
hlbarber Sep 21, 2023
67d5100
Make `Unit` methods return `&'static str` where possible (#393)
david-perez Sep 22, 2023
3fca508
simplify macros (#394)
hlbarber Oct 9, 2023
9aab03c
Add support for `Arc<T>` to `metrics::Cow<'a, T>`. (#402)
tobz Nov 12, 2023
c37a407
Add support for `tracing::Span::record`ed fields in `metrics-tracing-…
zohnannor Nov 29, 2023
a41ea8e
fix(prom): `RollingSummary` overflow panic (#423)
LucioFranco Dec 12, 2023
9f1709c
update CHANGELOG
tobz Dec 13, 2023
d900c8b
(cargo-release) version 0.12.2
tobz Dec 13, 2023
b20cb6b
Remove unneeded unsafe from test (#427)
rukai Dec 22, 2023
9578300
Fix feature check in CI (#428)
rukai Dec 22, 2023
6e3f710
update changelogs/release notes
tobz Dec 22, 2023
a818f50
fix unsafe/incorrect crossbeam-epoch usage in Block<T>
tobz Dec 22, 2023
52f5a50
Add a clippy CI check (#416) (#417)
nstinus Dec 22, 2023
e9b8230
Try other resolved addresses if the first one fails (#429)
vvv Dec 22, 2023
851c930
update changelog
tobz Dec 22, 2023
545878b
Update quanta requirement from 0.11 to 0.12 (#396)
dependabot[bot] Dec 22, 2023
49d96b1
Update ordered-float requirement from 3.4 to 4.2 (#421)
dependabot[bot] Dec 22, 2023
96e0083
Merge remote-tracking branch 'metrics-rs/main'
jvimal-eg Dec 23, 2023
948b581
fix quantile api
jvimal-eg Dec 23, 2023
79c06e1
missing clear
jvimal-eg Dec 23, 2023
7255247
reintroduce old way to avoid big refactor
jvimal-eg Dec 23, 2023
c8bd25f
Merge branch 'main' into main
jvimal-eg Dec 24, 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
4 changes: 2 additions & 2 deletions .github/dependabot.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,5 +3,5 @@ updates:
- package-ecosystem: cargo
directory: "/"
schedule:
interval: daily
open-pull-requests-limit: 10
interval: weekly
open-pull-requests-limit: 10
105 changes: 45 additions & 60 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,88 +10,73 @@ jobs:
fmt:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v3
- name: Install Rust Nightly
uses: actions-rs/toolchain@v1
with:
toolchain: nightly
override: true
components: rustfmt, clippy
run: rustup default nightly
- name: Check Formatting
uses: actions-rs/cargo@v1
with:
command: fmt
args: --all -- --check
run: cargo fmt --all -- --check
feature-check:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: Install Rust
uses: actions-rs/toolchain@v1
with:
toolchain: stable
override: true
- uses: actions/checkout@v3
- name: Install Protobuf Compiler
run: sudo apt-get install protobuf-compiler
- name: Install Rust Stable
run: rustup default stable
- name: Install cargo-hack
uses: actions-rs/cargo@v1
uses: taiki-e/install-action@v2
with:
command: install
args: cargo-hack
tool: cargo-hack
- name: Check Feature Matrix
uses: actions-rs/cargo@v1
with:
command: hack
args: build --all --all-targets --feature-powerset
run: cargo hack check --all --all-targets --feature-powerset --release
test:
name: Test ${{ matrix.rust_version }}/${{ matrix.os }}
runs-on: ${{ matrix.os }}
name: Test ${{ matrix.rust_version }}
runs-on: ubuntu-latest
strategy:
matrix:
rust_version: ['1.55.0', 'stable', 'nightly']
os: [ubuntu-latest, windows-latest, macOS-latest]
rust_version: ['1.61.0', 'stable', 'nightly']
steps:
- uses: actions/checkout@v1
- uses: actions/checkout@v3
- name: Install Protobuf Compiler
run: sudo apt-get install protobuf-compiler
- name: Install Rust ${{ matrix.rust_version }}
uses: actions-rs/toolchain@v1
with:
toolchain: ${{ matrix.rust_version }}
override: true
run: rustup default ${{ matrix.rust_version }}
- name: Run Tests
uses: actions-rs/cargo@v1
with:
command: test
args: --all-features --workspace --exclude=metrics-observer
run: cargo test --all-features --workspace --exclude=metrics-observer -- --test-threads=1
docs:
runs-on: ubuntu-latest
env:
RUSTDOCFLAGS: -Dwarnings
steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v3
- name: Install Protobuf Compiler
run: sudo apt-get install protobuf-compiler
- name: Install Rust Nightly
uses: actions-rs/toolchain@v1
with:
toolchain: nightly
override: true
components: rust-docs
run: rustup default nightly
- name: Check Docs
uses: actions-rs/cargo@v1
with:
command: doc
args: --all-features --workspace --exclude=metrics-observer --no-deps
run: cargo doc --all-features --workspace --exclude=metrics-observer --no-deps
bench:
name: Bench ${{ matrix.os }}
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [ubuntu-latest, windows-latest, macOS-latest]
name: Bench
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v1
- uses: actions/checkout@v3
- name: Install Protobuf Compiler
run: sudo apt-get install protobuf-compiler
- name: Install Rust Stable
uses: actions-rs/toolchain@v1
with:
toolchain: stable
override: true
run: rustup default stable
- name: Run Benchmarks
uses: actions-rs/cargo@v1
with:
command: bench
args: --all-features --workspace --exclude=metrics-observer
run: cargo bench --all-features --workspace --exclude=metrics-observer
clippy:
name: Clippy ${{ matrix.rust_version }}
runs-on: ubuntu-latest
strategy:
matrix:
rust_version: ['1.61.0', 'stable', 'nightly']
steps:
- uses: actions/checkout@v3
- name: Install Protobuf Compiler
run: sudo apt-get install protobuf-compiler
- name: Install Rust ${{ matrix.rust_version }}
run: rustup default ${{ matrix.rust_version }}
- name: Run Clippy
run: cargo clippy --all-features --workspace --exclude=metrics-observer
1 change: 0 additions & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
[workspace]
members = [
"metrics",
"metrics-macros",
"metrics-util",
"metrics-exporter-tcp",
"metrics-exporter-prometheus",
Expand Down
29 changes: 25 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -48,25 +48,46 @@ If you're a library author, you'll only care about using [`metrics`][metrics] to
Overall, this repository is home to the following crates:

* [`metrics`][metrics]: A lightweight metrics facade, similar to [`log`][log].
* [`metrics-macros`][metrics-macros]: Procedural macros that power `metrics`.
* [`metrics-tracing-context`][metrics-tracing-context]: Allow capturing [`tracing`][tracing] span
fields as metric labels.
* [`metrics-exporter-tcp`][metrics-exporter-tcp]: A `metrics`-compatible exporter for serving metrics over TCP.
* [`metrics-exporter-prometheus`][metrics-exporter-prometheus]: A `metrics`-compatible exporter for
serving a Prometheus scrape endpoint.
* [`metrics-util`][metrics-util]: Helper types/functions used by the `metrics` ecosystem.

# community integrations

As well, there are also some community-maintained exporters and other integrations:

* [`metrics-exporter-statsd`][metrics-exporter-statsd]: A `metrics`-compatible exporter for sending metrics via StatsD.
* [`metrics-exporter-newrelic`][metrics-exporter-newrelic]: A `metrics`-compatible exporter for sending metrics to New Relic.
* [`opinionated_metrics`][opinionated-metrics]: Opinionated interface to emitting metrics for CLI/server applications, based on `metrics`.

## MSRV and MSRV policy

Minimum supported Rust version (MSRV) is currently **1.61.0**, enforced by CI.

`metrics` will always support _at least_ the latest four versions of stable Rust, based on minor
version releases, and excluding patch versions. Overall, we strive to support older versions where
possible, which means that we generally try to avoid staying up-to-date with every single dependency
(except for security/correctness reasons) and avoid bumping the MSRV just to get access to new
helper methods in the standard library, and so on.

# contributing

We're always looking for users who have thoughts on how to make `metrics` better, or users with interesting use cases. Of course, we're also happy to accept code contributions for outstanding feature requests! 😀
To those of you who have already contributed to `metrics` in some way, shape, or form: **a big, and continued, "thank you!"** ❤️

To everyone else that we haven't had the pleasure of interacting with: we're always looking for thoughts on how to make `metrics` better, or users with interesting use cases. Of course, we're also happy to accept code contributions for outstanding feature requests directly. 😀

We'd love to chat about any of the above, or anything else, really! You can find us over on [Discord](https://discord.gg/eTwKyY9).
We'd love to chat about any of the above, or anything else related to metrics. Don't hesitate to file an issue on the repository, or come and chat with us over on [Discord](https://discord.gg/eTwKyY9).

[metrics]: https://github.com/metrics-rs/metrics/tree/main/metrics
[metrics-macros]: https://github.com/metrics-rs/metrics/tree/main/metrics-macros
[metrics-tracing-context]: https://github.com/metrics-rs/metrics/tree/main/metrics-tracing-context
[metrics-exporter-tcp]: https://github.com/metrics-rs/metrics/tree/main/metrics-exporter-tcp
[metrics-exporter-prometheus]: https://github.com/metrics-rs/metrics/tree/main/metrics-exporter-prometheus
[metrics-util]: https://github.com/metrics-rs/metrics/tree/main/metrics-util
[log]: https://docs.rs/log
[tracing]: https://tracing.rs
[metrics-exporter-statsd]: https://docs.rs/metrics-exporter-statsd
[metrics-exporter-newrelic]: https://docs.rs/metrics-exporter-newrelic
[opinionated-metrics]: https://docs.rs/opinionated_metrics
Binary file modified assets/splash.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
11 changes: 6 additions & 5 deletions metrics-benchmark/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -3,14 +3,15 @@ name = "metrics-benchmark"
version = "0.1.1-alpha.5"
authors = ["Toby Lawrence <toby@nuclearfurnace.com>"]
edition = "2018"
rust-version = "1.61.0"
publish = false

[dependencies]
log = "0.4"
pretty_env_logger = "0.4"
pretty_env_logger = "0.5"
getopts = "0.2"
hdrhistogram = { version = "7.2", default-features = false }
quanta = "0.9.3"
atomic-shim = "0.2"
metrics = { version = "^0.18", path = "../metrics" }
metrics-util = { version = "^0.12", path = "../metrics-util" }
quanta = "0.12"
portable-atomic = { version = "1", default-features = false, features = ["fallback"] }
metrics = { version = "0.21", path = "../metrics" }
metrics-util = { version = "0.15", path = "../metrics-util" }
30 changes: 15 additions & 15 deletions metrics-benchmark/src/main.rs
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
use atomic_shim::AtomicU64;
use getopts::Options;
use hdrhistogram::Histogram as HdrHistogram;
use log::{error, info};
use metrics::{
gauge, histogram, increment_counter, register_counter, register_gauge, register_histogram,
Counter, Gauge, Histogram, Key, KeyName, Recorder, Unit,
counter, gauge, histogram, Counter, Gauge, Histogram, Key, KeyName, Metadata, Recorder,
SharedString, Unit,
};
use metrics_util::registry::{AtomicStorage, Registry};
use portable_atomic::AtomicU64;
use quanta::{Clock, Instant as QuantaInstant};
use std::{
env,
Expand Down Expand Up @@ -62,21 +62,21 @@ impl BenchmarkingRecorder {
}

impl Recorder for BenchmarkingRecorder {
fn describe_counter(&self, _: KeyName, _: Option<Unit>, _: &'static str) {}
fn describe_counter(&self, _: KeyName, _: Option<Unit>, _: SharedString) {}

fn describe_gauge(&self, _: KeyName, _: Option<Unit>, _: &'static str) {}
fn describe_gauge(&self, _: KeyName, _: Option<Unit>, _: SharedString) {}

fn describe_histogram(&self, _: KeyName, _: Option<Unit>, _: &'static str) {}
fn describe_histogram(&self, _: KeyName, _: Option<Unit>, _: SharedString) {}

fn register_counter(&self, key: &Key) -> Counter {
fn register_counter(&self, key: &Key, _metadata: &Metadata<'_>) -> Counter {
self.registry.get_or_create_counter(key, |c| Counter::from_arc(c.clone()))
}

fn register_gauge(&self, key: &Key) -> Gauge {
fn register_gauge(&self, key: &Key, _metadata: &Metadata<'_>) -> Gauge {
self.registry.get_or_create_gauge(key, |g| Gauge::from_arc(g.clone()))
}

fn register_histogram(&self, key: &Key) -> Histogram {
fn register_histogram(&self, key: &Key, _metadata: &Metadata<'_>) -> Histogram {
self.registry.get_or_create_histogram(key, |h| Histogram::from_arc(h.clone()))
}
}
Expand Down Expand Up @@ -120,9 +120,9 @@ impl Generator {
if let Some(t0) = self.t0 {
let start = if loop_counter % LOOP_SAMPLE == 0 { Some(clock.now()) } else { None };

increment_counter!("ok");
gauge!("total", self.gauge as f64);
histogram!("ok", t1.sub(t0));
counter!("ok").increment(1);
gauge!("total").set(self.gauge as f64);
histogram!("ok").record(t1.sub(t0));

if let Some(val) = start {
let delta = clock.now() - val;
Expand All @@ -145,9 +145,9 @@ impl Generator {
let clock = Clock::new();
let mut loop_counter = 0;

let counter = register_counter!("ok");
let gauge = register_gauge!("total");
let histogram = register_histogram!("ok");
let counter = counter!("ok");
let gauge = gauge!("total");
let histogram = histogram!("ok");

loop {
loop_counter += 1;
Expand Down
Loading