diff --git a/CHANGELOG.md b/CHANGELOG.md index 0532a102..45469111 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -18,9 +18,14 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 - Move`Encode` trait from `prometheus_client::encoding::text` to `prometheus_client::encoding`. See [PR 83]. +### Fixed + +- Fix race condition in `Family::get_or_create`. See [PR 102]. + [PR 83]: https://github.com/prometheus/client_rust/pull/83 [PR 85]: https://github.com/prometheus/client_rust/pull/85 [PR 96]: https://github.com/prometheus/client_rust/pull/96 +[PR 102]: https://github.com/prometheus/client_rust/pull/102 ## [0.18.0] diff --git a/src/metrics/family.rs b/src/metrics/family.rs index c3cf6b9b..bb163761 100644 --- a/src/metrics/family.rs +++ b/src/metrics/family.rs @@ -3,7 +3,7 @@ //! See [`Family`] for details. use super::{MetricType, TypedMetric}; -use parking_lot::{MappedRwLockReadGuard, RwLock, RwLockReadGuard}; +use parking_lot::{MappedRwLockReadGuard, RwLock, RwLockReadGuard, RwLockWriteGuard}; use std::collections::HashMap; use std::sync::Arc; @@ -223,11 +223,14 @@ impl> Family