Class: GitlabInternalEventsCli::Metric::TimeFrames

Inherits:
Struct
  • Object
show all
Defined in:
lib/gitlab_internal_events_cli/metric.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#valueObject

Returns the value of attribute value

Returns:

  • (Object)

    the current value of value



362
363
364
# File 'lib/gitlab_internal_events_cli/metric.rb', line 362

def value
  @value
end

Instance Method Details

#descriptionObject



363
364
365
366
367
# File 'lib/gitlab_internal_events_cli/metric.rb', line 363

def description
  (%w[all 28d 7d] & value).map do |time_trame|
    TimeFramedKeyPath::METRIC_TIME_FRAME_DESC[time_trame].capitalize
  end.join('/')
end

#directory_nameObject



369
370
371
372
373
# File 'lib/gitlab_internal_events_cli/metric.rb', line 369

def directory_name
  return 'counts_all' unless single?

  "counts_#{value.first}"
end

#key_pathObject



375
376
377
# File 'lib/gitlab_internal_events_cli/metric.rb', line 375

def key_path
  description&.downcase if single? && %w[7d 28d].include?(value.first)
end

#single?Boolean

TODO: Delete once we are able to deduplicate and merge metric files

Returns:

  • (Boolean)


380
381
382
# File 'lib/gitlab_internal_events_cli/metric.rb', line 380

def single?
  !value.is_a?(Array) || value.length == 1
end