Class: Gitlab::Database::Partitioning::PartitionMonitoring

Inherits:
Object
  • Object
show all
Defined in:
lib/gitlab/database/partitioning/partition_monitoring.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(models = PartitionCreator.models) ⇒ PartitionMonitoring

Returns a new instance of PartitionMonitoring.


9
10
11
# File 'lib/gitlab/database/partitioning/partition_monitoring.rb', line 9

def initialize(models = PartitionCreator.models)
  @models = models
end

Instance Attribute Details

#modelsObject (readonly)

Returns the value of attribute models


7
8
9
# File 'lib/gitlab/database/partitioning/partition_monitoring.rb', line 7

def models
  @models
end

Instance Method Details

#report_metricsObject


13
14
15
16
17
18
19
20
# File 'lib/gitlab/database/partitioning/partition_monitoring.rb', line 13

def report_metrics
  models.each do |model|
    strategy = model.partitioning_strategy

    gauge_present.set({ table: model.table_name }, strategy.current_partitions.size)
    gauge_missing.set({ table: model.table_name }, strategy.missing_partitions.size)
  end
end