Skip to content

Commit

Permalink
Merge pull request #4268 from vespa-engine/toregge/test-posting-list-…
Browse files Browse the repository at this point in the history
…cache-metrics

Test posting list cache metrics.
  • Loading branch information
geirst authored Nov 12, 2024
2 parents c12c046 + 943b576 commit 18be451
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions tests/search/metrics/metrics.rb
Original file line number Diff line number Diff line change
Expand Up @@ -196,12 +196,16 @@ def assert_document_db_disk_io(metrics)
def assert_document_db_cached_disk_io(metrics, expect_cached)
f1_cached_disk_io = get_cached_disk_io_for_field('f1', metrics)
puts "f1_cached_disk_io = " + f1_cached_disk_io.to_s
posting_list_cache_hit_rate = get_postinglist_cache_hit_rate(metrics)
puts "posting_list_cache_hit_rate = " + posting_list_cache_hit_rate.to_s
if expect_cached
assert(1000 < f1_cached_disk_io["sum"])
assert(0 < f1_cached_disk_io["count"])
assert(0 < posting_list_cache_hit_rate)
else
assert_equal(0, f1_cached_disk_io["sum"])
assert_equal(0, f1_cached_disk_io["count"])
assert_equal(0, posting_list_cache_hit_rate)
end
end

Expand All @@ -221,6 +225,10 @@ def get_cached_disk_io_for_field(field_name, metrics)
{"documenttype" => "test", "field" => field_name})
end

def get_postinglist_cache_hit_rate(metrics)
metrics.get('content.proton.index.cache.postinglist.hit_rate')['last']
end

def get_size_on_disk_for_attribute_field(field_name, metrics)
metrics.get('content.proton.documentdb.ready.attribute.size_on_disk',
{"documenttype" => "test", "field" => field_name})["last"]
Expand Down

0 comments on commit 18be451

Please sign in to comment.