Sha256: 816e2f79d5a49e3420824591925963078682091a5879cb394426c2ffeb62bfbc
Contents?: true
Size: 1.08 KB
Versions: 3
Compression:
Stored size: 1.08 KB
Contents
require "active_support/core_ext/numeric/conversions" module Timescale module StatsReport module_function def resume(scope=Hypertable.all) base_filter = {hypertable_name: scope.pluck(:hypertable_name)} { hypertables: { count: scope.count, uncompressed: scope.to_a.count { |h| h.compression_stats.empty? }, approximate_row_count: approximate_row_count(scope), chunks: Chunk.where(base_filter).resume, size: compression_resume(scope) }, continuous_aggregates: ContinuousAggregates.where(base_filter).resume, jobs_stats: JobStats.where(base_filter).resume } end def compression_resume(scope) sum = -> (method) { (scope.map(&method).inject(:+) || 0).to_s(:human_size)} { uncompressed: sum[:before_total_bytes], compressed: sum[:after_total_bytes] } end def approximate_row_count(scope) scope.to_a.map do |hypertable| { hypertable.hypertable_name => hypertable.approximate_row_count } end.inject(&:merge!) end end end
Version data entries
3 entries across 3 versions & 1 rubygems
Version | Path |
---|---|
timescaledb-0.1.5 | lib/timescale/stats_report.rb |
timescaledb-0.1.4 | lib/timescale/stats_report.rb |
timescaledb-0.1.3 | lib/timescale/stats_report.rb |