Class: HystrixMetrics::MetricServer
- Inherits:
-
Object
- Object
- HystrixMetrics::MetricServer
- Defined in:
- lib/hystrix_metrics/metric_server.rb
Instance Attribute Summary collapse
-
#server ⇒ Object
readonly
Returns the value of attribute server.
Instance Method Summary collapse
-
#initialize(port, path = "/metrics") ⇒ MetricServer
constructor
A new instance of MetricServer.
- #start ⇒ Object
- #stop ⇒ Object
Constructor Details
#initialize(port, path = "/metrics") ⇒ MetricServer
Returns a new instance of MetricServer.
13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 |
# File 'lib/hystrix_metrics/metric_server.rb', line 13 def initialize(port, path="/metrics") servlet = Servlets.servlet("EventStream", HystrixMetricsStreamServlet.java_class).addMapping('/*') classloader = java.lang.ClassLoader.getSystemClassLoader builder = Servlets.deployment .setDeploymentName("HystrixMetricServer") .setClassLoader(classloader) .setContextPath(path) .addServlets(servlet) manager = Servlets.defaultContainer.addDeployment(builder) manager.deploy path = Handlers.path(Handlers.redirect(path)).addPrefixPath(path, manager.start) @server = Undertow.builder .addHttpListener(port, "0.0.0.0") .setHandler(path) .build end |
Instance Attribute Details
#server ⇒ Object (readonly)
Returns the value of attribute server.
11 12 13 |
# File 'lib/hystrix_metrics/metric_server.rb', line 11 def server @server end |
Instance Method Details
#start ⇒ Object
31 32 33 |
# File 'lib/hystrix_metrics/metric_server.rb', line 31 def start @server.start end |
#stop ⇒ Object
35 36 37 |
# File 'lib/hystrix_metrics/metric_server.rb', line 35 def stop @server.stop end |