Class: Travis::Metrics::Reporter::Librato

Inherits:
Struct
  • Object
show all
Defined in:
lib/travis/metrics/reporter/librato.rb

Constant Summary collapse

MSGS =
{
  setup: 'Using Librato metrics reporter (source: %s, account: %s)',
  error: 'Librato error: %s (%s)'
}

Instance Attribute Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#configObject

Returns the value of attribute config

Returns:

  • (Object)

    the current value of config



6
7
8
# File 'lib/travis/metrics/reporter/librato.rb', line 6

def config
  @config
end

#loggerObject

Returns the value of attribute logger

Returns:

  • (Object)

    the current value of logger



6
7
8
# File 'lib/travis/metrics/reporter/librato.rb', line 6

def logger
  @logger
end

#reporterObject (readonly)

Returns the value of attribute reporter.



12
13
14
# File 'lib/travis/metrics/reporter/librato.rb', line 12

def reporter
  @reporter
end

Instance Method Details

#setupObject



14
15
16
17
18
19
20
21
22
23
24
# File 'lib/travis/metrics/reporter/librato.rb', line 14

def setup
  return unless email && token
  logger.info MSGS[:setup] % [source, email]
  @reporter = Metriks::LibratoMetricsReporter.new(email, token,
    source: source,
    on_error: method(:on_error),
    percentiles: [0.95, 0.99, 0.999, 1.0],
    interval: config[:interval],
  )
  reporter.start
end