Module: NewRelic::Agent::Instrumentation::LogStasher

Included in:
LogStasher::Prepend
Defined in:
lib/new_relic/agent/instrumentation/logstasher/instrumentation.rb

Defined Under Namespace

Modules: Chain, Prepend

Constant Summary collapse

INSTRUMENTATION_NAME =
NewRelic::Agent.base_name(name)

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.enabled?Boolean

Returns:

  • (Boolean)


9
10
11
# File 'lib/new_relic/agent/instrumentation/logstasher/instrumentation.rb', line 9

def self.enabled?
  NewRelic::Agent.config[:'instrumentation.logstasher'] != 'disabled'
end

Instance Method Details

#build_logstash_event_with_new_relic(*args) ⇒ Object



13
14
15
16
17
18
19
20
21
22
# File 'lib/new_relic/agent/instrumentation/logstasher/instrumentation.rb', line 13

def build_logstash_event_with_new_relic(*args)
  logstasher_event = yield
  log = logstasher_event.instance_variable_get(:@data)

  ::NewRelic::Agent.record_instrumentation_invocation(INSTRUMENTATION_NAME)
  ::NewRelic::Agent.agent.log_event_aggregator.record_logstasher_event(log)
  ::NewRelic::Agent::LocalLogDecorator.decorate(log)

  logstasher_event
end