Class: PackStats::Private::Metrics::Files
- Inherits:
-
Object
- Object
- PackStats::Private::Metrics::Files
- Extended by:
- T::Sig
- Defined in:
- lib/pack_stats/private/metrics/files.rb
Class Method Summary collapse
- .get_file_metrics(metric_name_suffix, tags, files) ⇒ Object
- .get_metrics(source_code_files, app_name) ⇒ Object
Class Method Details
.get_file_metrics(metric_name_suffix, tags, files) ⇒ Object
37 38 39 40 41 42 43 |
# File 'lib/pack_stats/private/metrics/files.rb', line 37 def self.get_file_metrics(metric_name_suffix, , files) [ GaugeMetric.for("component_files.#{metric_name_suffix}", files.count(&:componentized_file?), ), GaugeMetric.for("packaged_files.#{metric_name_suffix}", files.count(&:packaged_file?), ), GaugeMetric.for("all_files.#{metric_name_suffix}", files.count, ), ] end |
.get_metrics(source_code_files, app_name) ⇒ Object
16 17 18 19 20 21 22 23 24 25 26 27 28 |
# File 'lib/pack_stats/private/metrics/files.rb', line 16 def self.get_metrics(source_code_files, app_name) all_metrics = T.let([], T::Array[GaugeMetric]) app_level_tag = Tag.for('app', app_name) source_code_files.group_by { |file| file.team_owner&.name }.each do |team_name, files_for_team| = Metrics.(team_name) + [app_level_tag] all_metrics += get_file_metrics('by_team', , files_for_team) end = [app_level_tag] all_metrics += get_file_metrics('totals', , source_code_files) all_metrics end |