Class: Gitlab::UsageData::Topology

Inherits:
Object
  • Object
show all
Includes:
Gitlab::Utils::UsageData
Defined in:
lib/gitlab/usage_data/topology.rb

Defined Under Namespace

Classes: CollectionFailure

Constant Summary collapse

JOB_TO_SERVICE_NAME =
{
  'gitlab-rails' => 'web',
  'gitlab-sidekiq' => 'sidekiq',
  'gitlab-workhorse' => 'workhorse',
  'redis' => 'redis',
  'postgres' => 'postgres',
  'gitaly' => 'gitaly',
  'prometheus' => 'prometheus',
  'node' => 'node-exporter',
  'registry' => 'registry'
}.freeze
TIMEOUT_ERRORS =

If these errors occur, all subsequent queries are likely to fail for the same error

[Errno::ETIMEDOUT, Net::OpenTimeout, Net::ReadTimeout].freeze

Constants included from Gitlab::Utils::UsageData

Gitlab::Utils::UsageData::DISTRIBUTED_HLL_FALLBACK, Gitlab::Utils::UsageData::FALLBACK, Gitlab::Utils::UsageData::HISTOGRAM_FALLBACK, Gitlab::Utils::UsageData::MAX_BUCKET_SIZE

Instance Method Summary collapse

Methods included from Gitlab::Utils::UsageData

#add, #add_metric, #alt_usage_data, #average, #count, #distinct_count, #estimate_batch_distinct_count, #histogram, #maximum_id, #measure_duration, #minimum_id, #redis_usage_data, #sum, #track_usage_event, #with_finished_at, #with_metadata, #with_prometheus_client

Instance Method Details

#topology_usage_dataObject



29
30
31
32
33
34
35
36
37
38
# File 'lib/gitlab/usage_data/topology.rb', line 29

def topology_usage_data
  @failures = []
  @instances = Set[]
  topology_data, duration = measure_duration { topology_fetch_all_data }
  {
    topology: topology_data
                .merge(duration_s: duration)
                .merge(failures: @failures.map(&:to_h))
  }
end