Class: Gitlab::Usage::Metrics::Instrumentations::CountCreatingCiBuildMetric

Inherits:
DatabaseMetric show all
Defined in:
lib/gitlab/usage/metrics/instrumentations/count_creating_ci_build_metric.rb

Constant Summary collapse

SECURE_PRODUCT_TYPES =
i[
  apifuzzer_fuzz
  apifuzzer_fuzz_dnd
  container_scanning
  coverage_fuzzing
  dast
  dependency_scanning
  license_management
  license_scanning
  sast
  secret_detection
].freeze

Constants inherited from DatabaseMetric

DatabaseMetric::UnimplementedOperationError

Constants included from TimeFrame

TimeFrame::ALL_TIME_TIME_FRAME_NAME, TimeFrame::DEFAULT_TIMESTAMP_COLUMN, TimeFrame::SEVEN_DAYS_TIME_FRAME_NAME, TimeFrame::TWENTY_EIGHT_DAYS_TIME_FRAME_NAME

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 Attribute Summary

Attributes inherited from BaseMetric

#events, #metric_definition, #options, #time_frame

Instance Method Summary collapse

Methods inherited from DatabaseMetric

cache_start_and_finish_as, finish, #instrumentation, metric_options, operation, relation, start, timestamp_column, #to_sql, #value

Methods inherited from BaseMetric

available?, #available?, #instrumentation

Methods included from TimeFrame

#monthly_time_range, #monthly_time_range_db_params, #weekly_time_range, #weekly_time_range_db_params

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, #metrics_collection_metadata, #minimum_id, #redis_usage_data, #sum, #track_usage_event, #with_finished_at, #with_metadata, #with_prometheus_client

Constructor Details

#initialize(metric_definition) ⇒ CountCreatingCiBuildMetric

Returns a new instance of CountCreatingCiBuildMetric.

Raises:

  • (ArgumentError)


21
22
23
24
25
26
27
28
# File 'lib/gitlab/usage/metrics/instrumentations/count_creating_ci_build_metric.rb', line 21

def initialize(metric_definition)
  super

  raise ArgumentError, "secure_type options attribute is required" unless secure_type.present?
  return if secure_type_all? || SECURE_PRODUCT_TYPES.include?(secure_type)

  raise ArgumentError, "Attribute: #{secure_type} is not allowed"
end