Method: FnordMetric::Namespace#announce

Defined in:
lib/fnordmetric/namespace.rb

#announce(event) ⇒ Object



31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
# File 'lib/fnordmetric/namespace.rb', line 31

def announce(event)
  if !@flags[:hide_active_users]
    announce_to_timeline(event)
    announce_to_typelist(event)
  end

  if event[:_session]
    event[:_session_key] = announce_to_session(event).session_key 
  end

  if event[:_type].to_sym == :_enterprise
    ctx = FnordMetric::Context.new(opts, FnordMetric::Enterprise::CompatibilityHandler)
    ctx.call(event, @redis, self)
    return self
  end

  if FnordMetric::ZeroConfigGauge::TYPES.include?(event[:_type].to_sym)
    ctx = FnordMetric::Context.new(opts, FnordMetric::ZeroConfigGauge::Handler)
    ctx.call(event, @redis, self)
    return self
  end

  res = [
    @handlers[event[:_type].to_s],
    @handlers["*"]
  ].flatten.compact.each do |context|
    context.call(event, @redis, self)
  end.size

  if res == 0
    FnordMetric.error("no handler for event-type: #{event[:_type]}")
  end

  self
end