Skip to content

Commit

Permalink
Merge remote-tracking branch 'prometheus/master' into hist-exp
Browse files Browse the repository at this point in the history
  • Loading branch information
mxinden committed Jan 6, 2025
2 parents 6a141cc + 1adc994 commit cdd3b03
Show file tree
Hide file tree
Showing 8 changed files with 228 additions and 129 deletions.
11 changes: 10 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,13 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
- Implement `Atomic<u64>` for `AtomicU64` for gauges.
See [PR 226].

[PR 226]: https://github.com/prometheus/client_rust/pull/198
- Implement `EnableLabelValue` for `bool`.
See [PR 237]

[PR 173]: https://github.com/prometheus/client_rust/pull/173
[PR 198]: https://github.com/prometheus/client_rust/pull/198
[PR 226]: https://github.com/prometheus/client_rust/pull/226
[PR 237]: https://github.com/prometheus/client_rust/pull/237

### Added

Expand All @@ -32,10 +37,14 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
- Add `histogram::exponential_buckets_range`.
See [PR 233].

- Added `get` method to `Family`.
See [PR 234].

[PR 173]: https://github.com/prometheus/client_rust/pull/173
[PR 216]: https://github.com/prometheus/client_rust/pull/216
[PR 217]: https://github.com/prometheus/client_rust/pull/217
[PR 233]: https://github.com/prometheus/client_rust/pull/233
[PR 234]: https://github.com/prometheus/client_rust/pull/234

### Fixed

Expand Down
26 changes: 26 additions & 0 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
# Contributing

## Protocol Buffers

The `build.rs` script in this library depends upon the
[Protocol Buffers compiler][protoc]. Be sure that `protoc` is installed and
available within your `PATH`.

[protoc]: https://docs.rs/prost-build/latest/prost_build/#sourcing-protoc

## Python Dependencies

This repository uses the [`prometheus-client`][client-python] Python client
library in its test suite.

You may create and activate a virtual environment with this dependency
installed by running the following shell commands from the root of this
repository:

```shell
python -m venv ./venv
source venv/bin/activate
pip install prometheus-client
```

[client-python]: https://github.com/prometheus/client_python
1 change: 1 addition & 0 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ log = "0.4.22"
async-std = { version = "1", features = ["attributes"] }
axum = "0.7"
criterion = "0.5"
futures = "0.3"
http-types = "2"
pyo3 = "0.22"
quickcheck = "1"
Expand Down
6 changes: 2 additions & 4 deletions examples/hyper.rs
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
use futures::future::BoxFuture;
use http_body_util::{combinators, BodyExt, Full};
use hyper::{
body::{Bytes, Incoming},
Expand All @@ -8,10 +9,8 @@ use hyper::{
use hyper_util::rt::TokioIo;
use prometheus_client::{encoding::text::encode, metrics::counter::Counter, registry::Registry};
use std::{
future::Future,
io,
net::{IpAddr, Ipv4Addr, SocketAddr},
pin::Pin,
sync::Arc,
};
use tokio::{
Expand Down Expand Up @@ -69,8 +68,7 @@ type BoxBody = combinators::BoxBody<Bytes, hyper::Error>;
/// This function returns a HTTP handler (i.e. another function)
pub fn make_handler(
registry: Arc<Registry>,
) -> impl Fn(Request<Incoming>) -> Pin<Box<dyn Future<Output = io::Result<Response<BoxBody>>> + Send>>
{
) -> impl Fn(Request<Incoming>) -> BoxFuture<'static, io::Result<Response<BoxBody>>> {
// This closure accepts a request and responds with the OpenMetrics encoding of our metrics.
move |_req: Request<Incoming>| {
let reg = registry.clone();
Expand Down
Loading

0 comments on commit cdd3b03

Please sign in to comment.