Class: Contrast::Agent::Reporting::Client::Interface

Inherits:
InterfaceBase show all
Defined in:
lib/contrast/agent/reporting/client/interface.rb

Overview

Interface to safely manage connections across threads.

Instance Method Summary collapse

Methods inherited from InterfaceBase

#with_monitor

Instance Method Details

#connected?Boolean

Check to see if client exists and there is connection

Returns:

  • (Boolean)

    Boolean



41
42
43
44
45
46
47
# File 'lib/contrast/agent/reporting/client/interface.rb', line 41

def connected?
  with_monitor do
    return true if reporter_client && reporting_connection

    false
  end
end

#handle_resend(event) ⇒ Object

Retry once than discard the event. This is trigger on too many events of same kind error.



32
33
34
35
36
# File 'lib/contrast/agent/reporting/client/interface.rb', line 32

def handle_resend event
  with_monitor do
    reporter_client.handle_resend(event, reporting_connection)
  end
end

#headersObject



67
68
69
# File 'lib/contrast/agent/reporting/client/interface.rb', line 67

def headers
  with_monitor { reporter_client.headers }
end

#resending?Boolean?

Check to see if event need to be resend

Returns:

  • (Boolean, nil)


57
58
59
# File 'lib/contrast/agent/reporting/client/interface.rb', line 57

def resending?
  with_monitor { reporter_client.mode.status == reporter_client.mode.resending }
end

#response_handlerContrast::Agent::Reporting::ResponseHandler

Response_handler



74
75
76
# File 'lib/contrast/agent/reporting/client/interface.rb', line 74

def response_handler
  with_monitor { reporter_client.response_handler }
end

#send_event(event) ⇒ Net::HTTPResponse

Parameters:

Returns:

  • (Net::HTTPResponse)


19
20
21
# File 'lib/contrast/agent/reporting/client/interface.rb', line 19

def send_event event
  with_monitor { reporter_client.send_event(event, reporting_connection) }
end

#sleep?Boolean

return [Boolean]

Returns:

  • (Boolean)


24
25
26
# File 'lib/contrast/agent/reporting/client/interface.rb', line 24

def sleep?
  with_monitor { reporter_client.sleep? }
end

#startupObject

Execute startup routine and



13
14
15
# File 'lib/contrast/agent/reporting/client/interface.rb', line 13

def startup
  with_monitor { reporter_client.startup!(reporting_connection) }
end

#startup_messages_sent?Boolean

Check to see if statup connections are sent or not

Returns:

  • (Boolean)


50
51
52
# File 'lib/contrast/agent/reporting/client/interface.rb', line 50

def startup_messages_sent?
  with_monitor { reporter_client.status.startup_messages_sent? }
end

#statusObject



78
79
80
# File 'lib/contrast/agent/reporting/client/interface.rb', line 78

def status
  with_monitor { reporter_client.status }
end

#timeoutObject

Return timeout in ms



62
63
64
# File 'lib/contrast/agent/reporting/client/interface.rb', line 62

def timeout
  with_monitor { reporter_client.timeout } || Contrast::Agent::Reporting::ResponseHandler::TIMEOUT
end