Commit Graph

304 Commits

Author SHA1 Message Date
Matheus Cardoso 1d3174bf5d
chore(histogram): Simplify code by using std lib method (#547)
* chore(histogram): Simplify code by using std lib method

Leverage existing standard library method to simplify implementation. No changes to public API or MSRV.

Signed-off-by: Matheus <cardosaum@pm.me>

* refactor(histogram): Remove `duration_to_seconds` function

Signed-off-by: Matheus <cardosaum@pm.me>

* tests(histogram): Remove `duration_to_second` test

After removing the aforementioned method in a previous commit, this test became obsolete.

Signed-off-by: Matheus <cardosaum@pm.me>

---------

Signed-off-by: Matheus <cardosaum@pm.me>
Co-authored-by: Luca Bruno <lucab@lucabruno.net>
2025-04-16 09:37:45 +02:00
Matheus Cardoso 53d306635f
chore(registry): Fix linter warning (#548)
Signed-off-by: Matheus <cardosaum@pm.me>
2025-04-14 09:55:35 +02:00
Luca Bruno e07efb4f37
prometheus: release 0.14.0 (#545)
Signed-off-by: Luca BRUNO <lucab@lucabruno.net>
2025-03-27 16:33:36 +08:00
Liam Gray 26e46ec03a
Hashing improvements (#532)
* perf: optimise CounterVec hashing, enable other hashers

Signed-off-by: Liam Gray <hoxxep@gmail.com>

* Remove nohash-hasher dependency

Signed-off-by: Liam Gray <hoxxep@gmail.com>

* Restrict nohash visibility explicitly

Signed-off-by: Liam Gray <hoxxep@gmail.com>

---------

Signed-off-by: Liam Gray <hoxxep@gmail.com>
2025-03-21 10:44:25 +01:00
dependabot[bot] e17c5ced2b
build(deps): update procfs requirement from ^0.16 to ^0.17 (#543)
Updates the requirements on [procfs](https://github.com/eminence/procfs) to permit the latest version.
- [Release notes](https://github.com/eminence/procfs/releases)
- [Commits](https://github.com/eminence/procfs/compare/v0.16.0...v0.17.0)

---
updated-dependencies:
- dependency-name: procfs
  dependency-type: direct:production
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2025-03-20 09:06:54 +01:00
dependabot[bot] e5809b7ab9
build(deps): update hyper requirement from ^0.14 to ^1.4 (#524)
* build(deps): update hyper requirement from ^0.14 to ^1.4

Updates the requirements on [hyper](https://github.com/hyperium/hyper) to permit the latest version.
- [Release notes](https://github.com/hyperium/hyper/releases)
- [Changelog](https://github.com/hyperium/hyper/blob/master/CHANGELOG.md)
- [Commits](https://github.com/hyperium/hyper/compare/v0.14.0...v1.4.0)

---
updated-dependencies:
- dependency-name: hyper
  dependency-type: direct:production
...

Signed-off-by: dependabot[bot] <support@github.com>

* examples: fix hyper server example

Signed-off-by: Luca BRUNO <lucab@lucabruno.net>

---------

Signed-off-by: dependabot[bot] <support@github.com>
Signed-off-by: Luca BRUNO <lucab@lucabruno.net>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: Luca BRUNO <lucab@lucabruno.net>
2025-03-19 16:16:45 +01:00
Sander van Harmelen 4a0e282888
Use AsRef<str> for owned label values (#537)
Signed-off-by: Sander van Harmelen <sander@vanharmelen.nl>
Co-authored-by: Luca Bruno <lucab@lucabruno.net>
2025-03-19 10:52:55 +01:00
Sven Kanoldt c3865f3c40
cargo: upgrade to protobuf 3.7 (#541)
* feat!: upgrade to protobuf 3.7

- keep some of the `get_` and `set_` methods around and mark them as deprecated
- keep api changes to a minimal

Signed-off-by: Sven Kanoldt <sven+oss@d34dl0ck.me>

* fix: fix all issues related to api combatibility when the protobuf feature is not enabled

Signed-off-by: Sven Kanoldt <sven+oss@d34dl0ck.me>

* implement review feedback and close all minor remarks

Signed-off-by: Sven Kanoldt <sven+oss@d34dl0ck.me>

* fix ci errors

Signed-off-by: Sven Kanoldt <sven@d34dl0ck.me>

---------

Signed-off-by: Sven Kanoldt <sven+oss@d34dl0ck.me>
Signed-off-by: Sven Kanoldt <sven@d34dl0ck.me>
2025-03-19 10:21:43 +01:00
Antonio Nuno Monteiro 7e4e6f2d33
docs: fix `register_histogram_vec_with_registry` docstring (#528)
Signed-off-by: Antonio Nuno Monteiro <anmonteiro@gmail.com>
Co-authored-by: Luca Bruno <lucab@lucabruno.net>
2025-03-14 15:54:08 +01:00
Sander van Harmelen 5b62f4b78b
Fix LSP and Clippy warnings and errors (#540)
Signed-off-by: Sander van Harmelen <sander@vanharmelen.nl>
Co-authored-by: Luca Bruno <lucab@lucabruno.net>
2025-03-13 17:49:22 +01:00
Luca Bruno 52d76fc2d8
cargo: bump MSRV to 1.81 (#539)
Signed-off-by: Luca BRUNO <lucab@lucabruno.net>
2025-03-13 00:00:20 +08:00
Kai Ren 3bd0e82f1f
Upgrade `thiserror` crate from 1.0 to 2.0 version (#534)
Signed-off-by: Kai Ren <tyranron@gmail.com>
2025-03-12 09:15:40 +01:00
John Vandenberg 45c43c9130
README.md: Document protobuf feature (#531)
Signed-off-by: John Vandenberg <jayvdb@gmail.com>
2024-12-13 10:41:36 +01:00
Eval Exec f0c9bc271b
static-metric: fix typos in docstrings (#479)
It should be `flashable` instead of `flash able`

Signed-off-by: Eval EXEC <execvy@gmail.com>
2024-05-06 16:00:46 +02:00
Luca Bruno 04fce2f3bf
prometheus: release 0.13.4 (#520)
Signed-off-by: Luca BRUNO <lucab@lucabruno.net>
2024-05-04 18:51:47 +02:00
dependabot[bot] 6e435db331
build(deps): update reqwest requirement from ^0.11 to ^0.12 (#516)
Updates the requirements on [reqwest](https://github.com/seanmonstar/reqwest) to permit the latest version.
- [Release notes](https://github.com/seanmonstar/reqwest/releases)
- [Changelog](https://github.com/seanmonstar/reqwest/blob/master/CHANGELOG.md)
- [Commits](https://github.com/seanmonstar/reqwest/compare/v0.11.0...v0.12.0)

---
updated-dependencies:
- dependency-name: reqwest
  dependency-type: direct:production
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: Luca Bruno <luca.bruno@coreos.com>
2024-05-03 19:24:25 +02:00
Matt Weber 439e3b8c14
Prevent `clippy::ignored_unit_patterns` in macro expansions (#497)
This is a pedantic lint added in 1.73.0. Because it occurs inside a
macro expansion, the lint is triggered from user code. The justification
given by the lint definition is:

> Matching with `()` explicitly instead of `_` outlines the fact that
> the pattern contains no data. Also it would detect a type change that
> `_` would ignore.

Removing the lint requires a trivial change. It does introduce the
possibility for compilation errors in the event the return type of the
function currently returning `()` changes, but that seems like more of a
benefit than a drawback. In these cases, it seems unlikely that the
return type in question will change in the future.

The user experience can be seen by linting the examples:

```
% cargo +nightly clippy --examples -- -A clippy::all -W clippy::ignored_unit_patterns -Z macro-backtrace
   Compiling prometheus v0.13.3 (/home/matt/src/rust-prometheus)
...
warning: matching over `()` is more explicit
   --> /home/matt/src/rust-prometheus/src/macros.rs:217:58
    |
214 |   macro_rules! register_counter {
    |   -----------------------------
    |   |
    |   in this expansion of `register_counter!` (#1)
    |   in this expansion of `register_counter!` (#2)
    |   in this expansion of `register_counter!` (#3)
...
217 |           $crate::register(Box::new(counter.clone())).map(|_| counter)
    |                                                            ^
...
221 |           register_counter!(@of_type Counter, $OPTS)
    |           ------------------------------------------ in this macro invocation (#3)
...
225 |           register_counter!(opts!($NAME, $HELP))
    |           -------------------------------------- in this macro invocation (#2)
    |
   ::: examples/example_push.rs:16:40
    |
16  |       static ref PUSH_COUNTER: Counter = register_counter!(
    |  ________________________________________-
17  | |         "example_push_total",
18  | |         "Total number of prometheus client pushed."
19  | |     )
    | |_____- in this macro invocation (#1)
    |
    = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#ignored_unit_patterns
    = note: requested on the command line with `-W clippy::ignored-unit-patterns`
...
```

Signed-off-by: Matt Weber <30441572+mweber15@users.noreply.github.com>
Co-authored-by: Luca Bruno <luca.bruno@coreos.com>
2024-05-03 18:49:46 +02:00
Luca Bruno bf696d642c
ci: bump MSRV to fix test jobs (#519)
* ci: bump MSRV to fix test jobs

Signed-off-by: Luca BRUNO <lucab@lucabruno.net>

* src: fix new linting warnings

Signed-off-by: Luca BRUNO <lucab@lucabruno.net>

---------

Signed-off-by: Luca BRUNO <lucab@lucabruno.net>
2024-05-03 18:34:36 +02:00
Tamo b7e874524f
Let the cargo.toml know which example requires which features (#511)
Signed-off-by: Tamo <tamo@meilisearch.com>
2024-05-03 10:37:22 +02:00
Seth Westphal f49c724df0
cargo: update all dependencies (#504)
* Update dependencies.
Signed-off-by: Seth Westphal <westy92@gmail.com>

* Updates.

Signed-off-by: Seth Westphal <westy92@gmail.com>

---------

Signed-off-by: Seth Westphal <westy92@gmail.com>
2023-11-23 11:56:11 +01:00
Bruce Mitchener 76a634587a
ci: Update to `actions/checkout@v4`. (#499)
The main thing here is an update on the GitHub side for what version
of Node is being used to stay ahead of their deprecation schedule.

Signed-off-by: Bruce Mitchener <bruce.mitchener@gmail.com>
2023-11-20 11:35:10 +01:00
Bruce Mitchener a72d8d7db8
Bump MSRV to 1.65 to fix CI. (#505)
Signed-off-by: Bruce Mitchener <bruce.mitchener@gmail.com>
2023-11-20 10:27:48 +01:00
Bruce Mitchener 7a9adcacd0
ci: Update badge info to not refer to Travis CI (#500)
Signed-off-by: Bruce Mitchener <bruce.mitchener@gmail.com>
2023-11-20 16:32:10 +08:00
Croxx 6e81890773
bump MSRV to 1.60.0 (#491)
Signed-off-by: MrCroxx <mrcroxx@outlook.com>
2023-05-17 10:28:32 +02:00
nickelc 36acf4753d
Replace unmaintained/outdated github actions (#476)
The toolchain is now installed with `dtolnay/rust-toolchain`.

Signed-off-by: Constantin Nickel <constantin.nickel@gmail.com>
2023-02-01 14:46:31 +00:00
Kai Ren a7b8f09b8f
pulling_gauge: fix build with --no-default-features (#473)
* Add CI checks for `--no-default-features`

Signed-off-by: tyranron <tyranron@gmail.com>

* Fix broken compilation

Signed-off-by: tyranron <tyranron@gmail.com>

Signed-off-by: tyranron <tyranron@gmail.com>
2022-12-22 10:59:36 +00:00
Jan Berktold 8b462b1945
Add PullingGauge (#405)
Signed-off-by: Jan Berktold <jberktold@roblox.com>

Signed-off-by: Jan Berktold <jberktold@roblox.com>
2022-11-15 10:49:12 +00:00
Luca Bruno 422b3afcf4
ci: add a job for minimum toolchain (MSRV) (#467)
This adds a new CI job to verify building with a minimum supported
Rust version (MSRV), currently set at 1.57.
This is done in preparation for a future edition-2021 switch.

Signed-off-by: Luca BRUNO <luca.bruno@coreos.com>

Signed-off-by: Luca BRUNO <luca.bruno@coreos.com>
2022-10-24 07:04:02 +00:00
Luca Bruno c092b95879
prometheus: release 0.13.3 (#466)
Signed-off-by: Luca BRUNO <luca.bruno@coreos.com>

Signed-off-by: Luca BRUNO <luca.bruno@coreos.com>
2022-10-21 07:02:08 +00:00
Anthony Ramine a11df02f27
Prevent underflow with CPU time counter (#465)
Signed-off-by: Anthony Ramine <nox@nox.paris>

Signed-off-by: Anthony Ramine <nox@nox.paris>
2022-10-20 10:30:32 +00:00
dependabot[bot] fc591fdee0
build(deps): update criterion requirement from 0.3 to 0.4 (#459)
Updates the requirements on [criterion](https://github.com/bheisler/criterion.rs) to permit the latest version.
- [Release notes](https://github.com/bheisler/criterion.rs/releases)
- [Changelog](https://github.com/bheisler/criterion.rs/blob/master/CHANGELOG.md)
- [Commits](https://github.com/bheisler/criterion.rs/compare/0.3.0...0.4.0)

---
updated-dependencies:
- dependency-name: criterion
  dependency-type: direct:production
...

Signed-off-by: dependabot[bot] <support@github.com>

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2022-09-12 08:33:02 +00:00
dependabot[bot] e38ac6b4f2
build(deps): update procfs requirement from ^0.12 to ^0.14 (#452)
* build(deps): update procfs requirement from ^0.12 to ^0.14

Updates the requirements on [procfs](https://github.com/eminence/procfs) to permit the latest version.
- [Release notes](https://github.com/eminence/procfs/releases)
- [Commits](https://github.com/eminence/procfs/compare/v0.12.0...v0.14.0)

---
updated-dependencies:
- dependency-name: procfs
  dependency-type: direct:production
...

Signed-off-by: dependabot[bot] <support@github.com>

* process: update to new procfs-0.14 API

Signed-off-by: Luca BRUNO <luca.bruno@coreos.com>

Signed-off-by: dependabot[bot] <support@github.com>
Signed-off-by: Luca BRUNO <luca.bruno@coreos.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: Luca BRUNO <luca.bruno@coreos.com>
2022-09-09 15:22:53 +00:00
Luca Bruno 4e552eede7
prometheus: release 0.13.2 (#457)
* ci: update linting toolchain, fix new warnings

Signed-off-by: Luca BRUNO <luca.bruno@coreos.com>

* prometheus: release 0.13.2

Signed-off-by: Luca BRUNO <luca.bruno@coreos.com>

Signed-off-by: Luca BRUNO <luca.bruno@coreos.com>
2022-09-08 07:35:29 +00:00
Frank Denis 5ca37fe4fe
process_collector: fix compilation on 32-bit targets (#446)
The crate didn't compile on 32-bit targets any more due to
libc::sysconf() returning a 32-bit value on those targets.

Signed-off-by: Frank Denis <github@pureftpd.org>
2022-06-27 13:12:15 +00:00
Luca Bruno 935d968333
prometheus: release 0.13.1 (#440)
Signed-off-by: Luca BRUNO <luca.bruno@coreos.com>
2022-05-19 09:09:19 +00:00
keepsimple1 f44caa5f04
fix doc for encode (#433)
Signed-off-by: Han Xu <keepsimple@gmail.com>
2022-04-08 07:11:24 +00:00
Jaseem Abid 6cfacdd47e
Derive default instead of obvious manual impl (#437)
Signed-off-by: Jaseem Abid <me@jabid.in>
2022-03-10 08:27:30 +00:00
Jaseem Abid 117b0df83e
Fix crates.io badge (#436)
Not sure what happened to http://meritbadge.herokuapp.com, but it's not running anymore and points to default heroku error page.

Sheilds.io has a crates.io integration, so this should just work out of the box.

```
![crates.io](https://img.shields.io/crates/v/$CRATE.svg)
```

Example [![crates.io](https://img.shields.io/crates/v/prometheus.svg)](https://crates.io/crates/prometheus)

Signed-off-by: Jaseem Abid <me@jabid.in>
2022-03-02 16:57:15 +00:00
dependabot[bot] ea68788420
build(deps): update parking_lot requirement from ^0.11 to ^0.12 (#434) 2022-02-05 23:23:22 +08:00
Wu Aoxiang ac86a26422
feat(process): ProcessCollector use IntGauge to provide better performance, close #429 (#430)
Signed-off-by: wuaoxiang <wuaoxiang@stargraph.cn>

Co-authored-by: Luca Bruno <luca.bruno@coreos.com>
2022-01-03 10:30:50 +00:00
Bruce Mitchener 8038e9e7bf
Fix broken doc links. (#426)
Signed-off-by: Bruce Mitchener <bruce.mitchener@gmail.com>

Co-authored-by: Luca Bruno <luca.bruno@coreos.com>
2022-01-03 10:00:27 +00:00
Bruce Mitchener 0a63d51460
clippy: Remove needless borrow. (#427)
Signed-off-by: Bruce Mitchener <bruce.mitchener@gmail.com>
2022-01-03 09:45:45 +00:00
dependabot[bot] e3e2ffdd56
build(deps): update procfs requirement from ^0.11 to ^0.12 (#428)
Updates the requirements on [procfs](https://github.com/eminence/procfs) to permit the latest version.
- [Release notes](https://github.com/eminence/procfs/releases)
- [Commits](https://github.com/eminence/procfs/compare/v0.11.0...v0.12.0)

---
updated-dependencies:
- dependency-name: procfs
  dependency-type: direct:production
...

Signed-off-by: dependabot[bot] <support@github.com>

Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2021-12-13 08:51:04 +00:00
dependabot[bot] d1528e11ab
build(deps): update procfs requirement from ^0.10 to ^0.11 (#418)
Updates the requirements on [procfs](https://github.com/eminence/procfs) to permit the latest version.
- [Release notes](https://github.com/eminence/procfs/releases)
- [Commits](https://github.com/eminence/procfs/compare/v0.10.0...v0.11.0)

---
updated-dependencies:
- dependency-name: procfs
  dependency-type: direct:production
...

Signed-off-by: dependabot[bot] <support@github.com>

Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2021-10-15 07:54:57 +00:00
Jeremy Rodi 99b606469f
Fix re-export of TEXT_FORMAT to not require protobuf (#416)
A minor change, but previously the root-level re-export of
TEXT_FORMAT would require cfg(feature = "protobuf"), despite
the text export format not requiring protobufs.  Since this is
the only location where TEXT_FORMAT is made public, it should
be exported regardless of protobuf feature availability.

Signed-off-by: Jeremy Rodi <me@telios.dev>
2021-10-11 07:42:14 +00:00
Luca Bruno fe0a284cbf
prometheus: release 0.13.0 (#415)
Signed-off-by: Luca BRUNO <luca.bruno@coreos.com>
2021-09-28 06:56:29 +00:00
Hyeonu Park 3451d052a4
Allow trailing comma on macros (#390)
Signed-off-by: Hyeonu Park <nemo1275@gmail.com>
2021-09-13 08:45:39 +00:00
dependabot[bot] 1e92ec7df2
build(deps): update procfs requirement from ^0.9 to ^0.10 (#408)
Updates the requirements on [procfs](https://github.com/eminence/procfs) to permit the latest version.
- [Release notes](https://github.com/eminence/procfs/releases)
- [Commits](https://github.com/eminence/procfs/compare/v0.9.0...v0.10.0)

---
updated-dependencies:
- dependency-name: procfs
  dependency-type: direct:production
...

Signed-off-by: dependabot[bot] <support@github.com>

Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2021-08-23 07:44:07 +00:00
Moustafa Baiou 1533b1a3f3
feat(macros): add macros for custom registry (#396)
Signed-off-by: Moustafa Baiou <moustafa@ditto.live>
2021-08-11 07:46:25 +00:00
Alin Sinpalean fab7e7640b
Export thread count from `process_collector` (#401)
This simply retrieves and exports the value of the  field from the
already populated  that CPU, memory and start time are
sourced.

Signed-off-by: Alin Sinpalean <alin.sinpalean@gmail.com>
2021-08-09 07:27:50 +00:00