Skip to content

Commit

Permalink
fixup! Add :most_recent aggregation to DirectFileStore
Browse files Browse the repository at this point in the history
  • Loading branch information
Daniel Magliola committed Jun 22, 2020
1 parent a976f65 commit 15af410
Showing 1 changed file with 5 additions and 9 deletions.
14 changes: 5 additions & 9 deletions spec/prometheus/client/data_stores/direct_file_store_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -307,23 +307,19 @@

allow(Process).to receive(:pid).and_return(12345)
metric_store1.set(labels: { foo: "bar" }, val: 1)

allow(Process).to receive(:pid).and_return(23456)
metric_store2.set(labels: { foo: "bar" }, val: 3)
allow(Process).to receive(:pid).and_return(12345)
metric_store1.set(labels: { foo: "baz" }, val: 7)
allow(Process).to receive(:pid).and_return(23456)
metric_store2.set(labels: { foo: "bar" }, val: 3) # Supercedes 'bar' in PID 12345
metric_store2.set(labels: { foo: "baz" }, val: 2)
allow(Process).to receive(:pid).and_return(12345)
metric_store1.set(labels: { foo: "baz" }, val: 4)
allow(Process).to receive(:pid).and_return(23456)
metric_store2.set(labels: { foo: "zzz" }, val: 1)
metric_store2.set(labels: { foo: "yyy" }, val: 3)

allow(Process).to receive(:pid).and_return(12345)
metric_store1.set(labels: { foo: "baz" }, val: 4) # Supercedes 'baz' in PID 23456

expect(metric_store1.all_values).to eq(
{ foo: "bar" } => 3.0,
{ foo: "baz" } => 4.0,
{ foo: "zzz" } => 1.0,
{ foo: "yyy" } => 3.0,
)

# Both processes should return the same value
Expand Down

0 comments on commit 15af410

Please sign in to comment.