Module: Gitlab::InternalEvents::EventDefinitions
- Defined in:
- lib/gitlab/internal_events/event_definitions.rb
Constant Summary collapse
- InvalidMetricConfiguration =
Class.new(StandardError)
- VALID_UNIQUE_VALUES =
%w[user.id project.id namespace.id].freeze
Class Method Summary collapse
- .known_event?(event_name) ⇒ Boolean
- .load_configurations ⇒ Object
- .unique_property(event_name) ⇒ Object
Class Method Details
.known_event?(event_name) ⇒ Boolean
28 29 30 |
# File 'lib/gitlab/internal_events/event_definitions.rb', line 28 def known_event?(event_name) events.key?(event_name) end |
.load_configurations ⇒ Object
11 12 13 14 |
# File 'lib/gitlab/internal_events/event_definitions.rb', line 11 def load_configurations @events = load_metric_definitions nil end |
.unique_property(event_name) ⇒ Object
16 17 18 19 20 21 22 23 24 25 26 |
# File 'lib/gitlab/internal_events/event_definitions.rb', line 16 def unique_property(event_name) unique_value = events[event_name]&.to_s return unless unique_value unless VALID_UNIQUE_VALUES.include?(unique_value) raise(InvalidMetricConfiguration, "Invalid unique value '#{unique_value}' for #{event_name}") end unique_value.split('.').first.to_sym end |