Class: Skywalking::Agent Private
- Inherits:
-
Object
- Object
- Skywalking::Agent
- Defined in:
- lib/skywalking/agent.rb
This class is part of a private API. You should avoid using this class if possible, as it may be removed or be changed in the future.
Constant Summary collapse
- LOCK =
This constant is part of a private API. You should avoid using this constant if possible, as it may be removed or be changed in the future.
Mutex.new
Class Attribute Summary collapse
- .agent_config ⇒ Object readonly private
- .logger ⇒ Object readonly private
Instance Attribute Summary collapse
- #plugins ⇒ Object readonly private
- #reporter ⇒ Object readonly private
Class Method Summary collapse
- .agent ⇒ Object private
- .start(config) ⇒ Object private
- .started? ⇒ Boolean private
- .stop ⇒ Object private
Instance Method Summary collapse
- #add_shutdown_hook ⇒ Object private
- #environment ⇒ Object private
-
#initialize(config) ⇒ Agent
constructor
private
A new instance of Agent.
- #shutdown ⇒ Object private
- #start! ⇒ Object private
Constructor Details
#initialize(config) ⇒ Agent
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
Returns a new instance of Agent.
69 70 71 72 73 74 |
# File 'lib/skywalking/agent.rb', line 69 def initialize(config) @plugins = Plugins::PluginsManager.new(config) @reporter = Reporter::Report.new(config) add_shutdown_hook end |
Class Attribute Details
.agent_config ⇒ Object (readonly)
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
64 65 66 |
# File 'lib/skywalking/agent.rb', line 64 def agent_config @agent_config end |
.logger ⇒ Object (readonly)
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
64 65 66 |
# File 'lib/skywalking/agent.rb', line 64 def logger @logger end |
Instance Attribute Details
#plugins ⇒ Object (readonly)
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
67 68 69 |
# File 'lib/skywalking/agent.rb', line 67 def plugins @plugins end |
#reporter ⇒ Object (readonly)
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
67 68 69 |
# File 'lib/skywalking/agent.rb', line 67 def reporter @reporter end |
Class Method Details
.agent ⇒ Object
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
31 32 33 |
# File 'lib/skywalking/agent.rb', line 31 def agent defined?(@agent) && @agent end |
.start(config) ⇒ Object
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 |
# File 'lib/skywalking/agent.rb', line 35 def start(config) return @agent if @agent LOCK.synchronize do return @agent if @agent config ||= {} config = Configuration.new(config) unless config.is_a?(Configuration) @logger = config.logger @agent_config = config.agent_config @agent = new(@agent_config).start! config.freeze end end |
.started? ⇒ Boolean
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
60 61 62 |
# File 'lib/skywalking/agent.rb', line 60 def started? !!(defined?(@agent) && @agent) end |
.stop ⇒ Object
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
51 52 53 54 55 56 57 58 |
# File 'lib/skywalking/agent.rb', line 51 def stop LOCK.synchronize do return unless @agent @agent&.shutdown @agent = nil end end |
Instance Method Details
#add_shutdown_hook ⇒ Object
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
90 91 92 93 94 95 96 |
# File 'lib/skywalking/agent.rb', line 90 def add_shutdown_hook return unless environment.shutdown_handler_supported? at_exit do shutdown end end |
#environment ⇒ Object
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
76 77 78 |
# File 'lib/skywalking/agent.rb', line 76 def environment @environment ||= Skywalking::Environment.instance end |
#shutdown ⇒ Object
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
86 87 88 |
# File 'lib/skywalking/agent.rb', line 86 def shutdown @reporter.stop end |
#start! ⇒ Object
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
80 81 82 83 84 |
# File 'lib/skywalking/agent.rb', line 80 def start! @plugins.init_plugins @reporter.init_reporter self end |