Skip to content

Commit

Permalink
Fix for deadlock
Browse files Browse the repository at this point in the history
  • Loading branch information
scottopell committed Sep 24, 2024
1 parent 1aae608 commit bd1e798
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 27 deletions.
20 changes: 5 additions & 15 deletions Cargo.lock

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

13 changes: 7 additions & 6 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -12,12 +12,13 @@ members = [
[workspace.dependencies]
bytes = { version = "1.7", default-features = false, features = ["std"] }
byte-unit = { version = "4.0", features = ["serde"] }
metrics = { version = "0.23.0" }
metrics-util = { version = "0.17.0" }
metrics-exporter-prometheus = { version = "0.15.3", default-features = false, features = [
"http-listener",
"uds-listener",
] }

# Metrics-rs crates are pinned to 6e40d6c08f4d3a2059a0a7577a6e11930acb52ee until
# a release is cut that contains https://github.com/metrics-rs/metrics/pull/522
metrics = { git = "https://github.com/scottopell/metrics.git", rev = "6e40d6c08f4d3a2059a0a7577a6e11930acb52ee" }
metrics-util = { git = "https://github.com/scottopell/metrics.git", rev = "6e40d6c08f4d3a2059a0a7577a6e11930acb52ee" }
metrics-exporter-prometheus = { git = "https://github.com/scottopell/metrics.git", rev = "6e40d6c08f4d3a2059a0a7577a6e11930acb52ee", default-features = false, features = ["http-listener", "uds-listener"]}

prost = "0.11"
rand = { version = "0.8", default-features = false }
rustc-hash = { version = "1.1" }
Expand Down
14 changes: 8 additions & 6 deletions lading/src/captures.rs
Original file line number Diff line number Diff line change
Expand Up @@ -131,11 +131,12 @@ impl CaptureManager {
.registry
.visit_counters(|key: &metrics::Key, counter| {
let gen = counter.get_generation();

if !self
let should_store = self
.inner
.recency
.should_store_counter(key, gen, &self.inner.registry)
.has_counter_expired(key, gen, &self.inner.registry);

if !should_store
{
// Skip this metric, its too old
return;
Expand All @@ -161,11 +162,12 @@ impl CaptureManager {
.registry
.visit_gauges(|key: &metrics::Key, gauge| {
let gen = gauge.get_generation();

if !self
let should_store = self
.inner
.recency
.should_store_gauge(key, gen, &self.inner.registry)
.has_gauge_expired(key, gen, &self.inner.registry);

if !should_store
{
// Skip this metric, its too old
return;
Expand Down

0 comments on commit bd1e798

Please sign in to comment.