barrel_docdb_usage (barrel_docdb v1.1.1)

View Source

Usage statistics for barrel_docdb

Provides usage statistics collected from RocksDB properties. This is a thin wrapper around existing RocksDB property access with no runtime state.

Example Usage

   %% Get usage stats for a single database
   {ok, Stats} = barrel_docdb_usage:get_db_usage(<<"mydb">>).
   #{
       database := <<"mydb">>,
       document_count := 15420,
       storage_bytes := 104857600,
       memtable_size := 2097152,
       sst_files_size := 100663296,
       last_updated := 1704067200000
   } = Stats.
  
   %% Get usage stats for all databases
   {ok, AllStats} = barrel_docdb_usage:get_all_usage().

Summary

Functions

Get usage statistics for all databases. Returns a list of stats maps, one for each database.

Get usage statistics for a single database. Returns a map with storage metrics from RocksDB.

Functions

get_all_usage()

-spec get_all_usage() -> {ok, [map()]}.

Get usage statistics for all databases. Returns a list of stats maps, one for each database.

get_db_usage(DbName)

-spec get_db_usage(binary()) -> {ok, map()} | {error, term()}.

Get usage statistics for a single database. Returns a map with storage metrics from RocksDB.