Class: Unleash::MetricsReporter

Inherits:
Object
  • Object
show all
Defined in:
lib/unleash/metrics_reporter.rb

Constant Summary collapse

LONGEST_WITHOUT_A_REPORT =
600

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initializeMetricsReporter

Returns a new instance of MetricsReporter.



12
13
14
# File 'lib/unleash/metrics_reporter.rb', line 12

def initialize
  self.last_time = Time.now
end

Instance Attribute Details

#last_timeObject

Returns the value of attribute last_time.



10
11
12
# File 'lib/unleash/metrics_reporter.rb', line 10

def last_time
  @last_time
end

Instance Method Details

#generate_reportObject



16
17
18
19
20
21
# File 'lib/unleash/metrics_reporter.rb', line 16

def generate_report
  metrics = Unleash.engine&.get_metrics
  return nil if metrics.nil?

  generate_report_from_bucket metrics
end

#postObject



23
24
25
26
27
28
29
30
# File 'lib/unleash/metrics_reporter.rb', line 23

def post
  Unleash.logger.debug "post() Report"

  report = build_report
  return unless report

  send_report(report)
end