Class: Rearview::StatsService
- Inherits:
-
Object
- Object
- Rearview::StatsService
show all
- Includes:
- Celluloid, Logger
- Defined in:
- lib/rearview/stats_service.rb
Defined Under Namespace
Classes: StatsServiceError
Instance Method Summary
collapse
Methods included from Logger
#logger
Instance Method Details
#shutdown ⇒ Object
22
23
24
25
26
|
# File 'lib/rearview/stats_service.rb', line 22
def shutdown
logger.info "#{self} shutting down service..."
raise StatsServiceError.new("service not started") unless started?
@task.actors.first.terminate
end
|
#started? ⇒ Boolean
13
14
15
|
# File 'lib/rearview/stats_service.rb', line 13
def started?
@started
end
|
#startup ⇒ Object
16
17
18
19
20
21
|
# File 'lib/rearview/stats_service.rb', line 16
def startup
logger.info "#{self} starting up service..."
raise StatsServiceError.new("service already started") if started?
@started = true
@task = Rearview::StatsTask.supervise
end
|
#statsd ⇒ Object
6
7
8
9
10
11
12
|
# File 'lib/rearview/stats_service.rb', line 6
def statsd
@statsd ||= Rearview::Statsd.new
if block_given? && Rearview.config.stats_enabled?
yield @statsd
end
@statsd
end
|