Module: ModularizationStatistics
- Extended by:
- T::Sig
- Defined in:
- lib/modularization_statistics/tag.rb,
lib/modularization_statistics.rb,
lib/modularization_statistics/tags.rb,
lib/modularization_statistics/private.rb,
lib/modularization_statistics/gauge_metric.rb,
lib/modularization_statistics/private/metrics.rb,
lib/modularization_statistics/private/metrics/files.rb,
lib/modularization_statistics/private/datadog_reporter.rb,
lib/modularization_statistics/private/metrics/packages.rb,
lib/modularization_statistics/private/source_code_file.rb,
lib/modularization_statistics/private/metrics/nested_packs.rb,
lib/modularization_statistics/private/metrics/public_usage.rb,
lib/modularization_statistics/private/metrics/rubocop_usage.rb,
lib/modularization_statistics/private/metrics/packages_by_team.rb,
lib/modularization_statistics/private/metrics/packwerk_checker_usage.rb
Overview
typed: strict frozen_string_literal: true
Defined Under Namespace
Modules: Tags Classes: GaugeMetric, Tag
Constant Summary collapse
- ROOT_PACKAGE_NAME =
T.let('root'.freeze, String)
- DEFAULT_COMPONENTIZED_SOURCE_CODE_LOCATIONS =
T.let( [ Pathname.new('components'), Pathname.new('gems'), ].freeze, T::Array[Pathname] )
- DEFAULT_PACKAGED_SOURCE_CODE_LOCATIONS =
T.let( [ Pathname.new('packs'), Pathname.new('packages'), ].freeze, T::Array[Pathname] )
Class Method Summary collapse
- .get_metrics(source_code_pathnames:, componentized_source_code_locations:, packaged_source_code_locations:, app_name:, use_gusto_legacy_names: false) ⇒ Object
- .report_to_datadog!(datadog_client:, app_name:, source_code_pathnames:, componentized_source_code_locations: DEFAULT_COMPONENTIZED_SOURCE_CODE_LOCATIONS, packaged_source_code_locations: DEFAULT_PACKAGED_SOURCE_CODE_LOCATIONS, report_time: Time.now, verbose: false, use_gusto_legacy_names: false) ⇒ Object
Class Method Details
.get_metrics(source_code_pathnames:, componentized_source_code_locations:, packaged_source_code_locations:, app_name:, use_gusto_legacy_names: false) ⇒ Object
100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 |
# File 'lib/modularization_statistics.rb', line 100 def self.get_metrics( source_code_pathnames:, componentized_source_code_locations:, packaged_source_code_locations:, app_name:, use_gusto_legacy_names: false ) all_metrics = Private::DatadogReporter.get_metrics( source_code_files: source_code_files( source_code_pathnames: source_code_pathnames, componentized_source_code_locations: componentized_source_code_locations, packaged_source_code_locations: packaged_source_code_locations ), app_name: app_name ) if use_gusto_legacy_names all_metrics = Private.convert_metrics_to_legacy(all_metrics) end all_metrics end |
.report_to_datadog!(datadog_client:, app_name:, source_code_pathnames:, componentized_source_code_locations: DEFAULT_COMPONENTIZED_SOURCE_CODE_LOCATIONS, packaged_source_code_locations: DEFAULT_PACKAGED_SOURCE_CODE_LOCATIONS, report_time: Time.now, verbose: false, use_gusto_legacy_names: false) ⇒ Object
50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 |
# File 'lib/modularization_statistics.rb', line 50 def self.report_to_datadog!( datadog_client:, app_name:, source_code_pathnames:, componentized_source_code_locations: DEFAULT_COMPONENTIZED_SOURCE_CODE_LOCATIONS, packaged_source_code_locations: DEFAULT_PACKAGED_SOURCE_CODE_LOCATIONS, report_time: Time.now, # rubocop:disable Rails/TimeZone verbose: false, use_gusto_legacy_names: false ) all_metrics = self.get_metrics( source_code_pathnames: source_code_pathnames, componentized_source_code_locations: componentized_source_code_locations, packaged_source_code_locations: packaged_source_code_locations, app_name: app_name, use_gusto_legacy_names: use_gusto_legacy_names, ) # This helps us debug what metrics are being sent if verbose all_metrics.each do |metric| puts "Sending metric: #{metric}" end end if use_gusto_legacy_names all_metrics = Private.convert_metrics_to_legacy(all_metrics) end Private::DatadogReporter.report!( datadog_client: datadog_client, report_time: report_time, metrics: all_metrics ) end |