Пример #1
0
        private void UpdateMetrics(object?state)
        {
            try
            {
                // It seems that currently there is no other option with .NET api to extract the compaction statistics than through the dumped string
                var compactionStatsString = _db.GetProperty("rocksdb.stats");
                ProcessCompactionStats(compactionStatsString);

                if (_dbConfig.EnableDbStatistics)
                {
                    var dbStatsString = _dbOptions.GetStatisticsString();
                    // Currently we don't extract any DB statistics but we can do it here
                }
            }
            catch (Exception exc)
            {
                _logger.Error($"Error when updating metrics for {_dbName} database.", exc);
                // Maybe we would like to stop the _timer here to avoid logging the same error all over again?
            }
        }
Пример #2
0
 public ulong EstimateNumberOfKeys()
 {
     return(ulong.Parse(_rocksDb.GetProperty("rocksdb.estimate-num-keys")));
 }
Пример #3
0
 /// <inheritdoc />
 /// <remarks>
 /// See https://github.com/facebook/rocksdb/blob/master/include/rocksdb/db.h#L547 for a list of all the
 /// valid properties.
 /// </remarks>
 public string GetProperty(string propertyName, string columnFamilyName = null)
 {
     return(m_store.GetProperty(propertyName, GetColumnFamilyInfo(columnFamilyName).Handle));
 }