Skip to content
Snippets Groups Projects
Commit 4afb8985 authored by Petr Špaček's avatar Petr Špaček
Browse files

Merge branch '510-prometheus-and-graphite-metrics-are-missing-some-cache-stats' into 'master'

cache: add number of entries to cache.stats()

Closes #510

See merge request !1028
parents 47b9a77e a8fc4165
Branches
Tags
1 merge request!1028cache: add number of entries to cache.stats()
Pipeline #66992 failed with stages
in 22 minutes and 2 seconds
......@@ -5,6 +5,7 @@ Improvements
------------
- capabilities are no longer constrained when running as root (!1012)
- cache: add percentage usage to cache.stats() (!1025)
- cache: add number of cache entries to cache.stats() (!1028)
- aarch64 support again, as some systems still didn't work (!1033)
Bugfixes
......
......@@ -81,6 +81,8 @@ static int cache_stats(lua_State *L)
add_stat(open);
add_stat(close);
add_stat(count);
cache->stats.count_entries = cache->api->count(cache->db, &cache->stats);
add_stat(count_entries);
add_stat(clear);
add_stat(commit);
add_stat(read);
......
......@@ -186,7 +186,7 @@ Configuration reference
.. function:: cache.stats()
Return table with low-level statistics for each internal cache operation.
Return table with low-level statistics for internal cache operation and storage.
This counts each access to cache and does not directly map to individual
DNS queries or resource records.
For query-level statistics see :ref:`stats module <mod-stats>`.
......@@ -196,23 +196,27 @@ Configuration reference
.. code-block:: lua
> cache.stats()
[read_leq_miss] => 4
[write] => 189
[read_leq] => 9
[read] => 4313
[read_miss] => 1143
[open] => 0
[clear] => 0
[close] => 0
[remove_miss] => 0
[commit] => 117
[match_miss] => 2
[match] => 21
[count] => 2
[clear] => 0
[count_entries] => 6187
[match] => 21
[match_miss] => 2
[open] => 0
[read] => 4313
[read_leq] => 9
[read_leq_miss] => 4
[read_miss] => 1143
[remove] => 17
[remove_miss] => 0
[usage_percent] => 15.625
[write] => 189
Cache operation `read_leq` (*read less or equal*, i.e. range search) was requested 9 times,
and 4 out of 9 operations were finished with *cache miss*.
Cache contains 6187 internal entries which occupy 15.625 % cache size.
.. function:: cache.max_ttl([ttl])
......
......@@ -199,6 +199,7 @@ struct kr_cdb_stats {
uint64_t open;
uint64_t close;
uint64_t count;
uint64_t count_entries;
uint64_t clear;
uint64_t commit;
uint64_t read;
......
......@@ -18,6 +18,7 @@ struct kr_cdb_stats {
uint64_t open;
uint64_t close;
uint64_t count;
uint64_t count_entries;
uint64_t clear;
uint64_t commit;
uint64_t read;
......
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment