Class JettyConnectionMetrics
java.lang.Object
org.eclipse.jetty.util.component.AbstractLifeCycle
io.micrometer.core.instrument.binder.jetty.JettyConnectionMetrics
- All Implemented Interfaces:
org.eclipse.jetty.io.Connection.Listener
,org.eclipse.jetty.util.component.LifeCycle
public class JettyConnectionMetrics
extends org.eclipse.jetty.util.component.AbstractLifeCycle
implements org.eclipse.jetty.io.Connection.Listener
Jetty connection metrics.
Usage example:
MeterRegistry registry = ...;
Server server = new Server(0);
Connector connector = new ServerConnector(server);
connector.addBean(new JettyConnectionMetrics(registry));
server.setConnectors(new Connector[] { connector });
Alternatively, configure on all connectors with
addToAllConnectors(Server, MeterRegistry, Iterable)
.- Since:
- 1.4.0
-
Nested Class Summary
Nested classes/interfaces inherited from class org.eclipse.jetty.util.component.AbstractLifeCycle
org.eclipse.jetty.util.component.AbstractLifeCycle.AbstractLifeCycleListener
Nested classes/interfaces inherited from interface org.eclipse.jetty.io.Connection.Listener
org.eclipse.jetty.io.Connection.Listener.Adapter
Nested classes/interfaces inherited from interface org.eclipse.jetty.util.component.LifeCycle
org.eclipse.jetty.util.component.LifeCycle.Listener
-
Field Summary
Fields inherited from class org.eclipse.jetty.util.component.AbstractLifeCycle
FAILED, RUNNING, STARTED, STARTING, STOPPED, STOPPING
-
Constructor Summary
ConstructorDescriptionJettyConnectionMetrics
(MeterRegistry registry) JettyConnectionMetrics
(MeterRegistry registry, Iterable<Tag> tags) JettyConnectionMetrics
(MeterRegistry registry, org.eclipse.jetty.server.Connector connector) Create aJettyConnectionMetrics
instance.JettyConnectionMetrics
(MeterRegistry registry, org.eclipse.jetty.server.Connector connector, Iterable<Tag> tags) Create aJettyConnectionMetrics
instance. -
Method Summary
Modifier and TypeMethodDescriptionstatic void
addToAllConnectors
(org.eclipse.jetty.server.Server server, MeterRegistry registry) static void
addToAllConnectors
(org.eclipse.jetty.server.Server server, MeterRegistry registry, Iterable<Tag> tags) void
onClosed
(org.eclipse.jetty.io.Connection connection) void
onOpened
(org.eclipse.jetty.io.Connection connection) Methods inherited from class org.eclipse.jetty.util.component.AbstractLifeCycle
addLifeCycleListener, doStart, doStop, getState, getState, getStopTimeout, isFailed, isRunning, isStarted, isStarting, isStopped, isStopping, removeLifeCycleListener, setStopTimeout, start, stop, toString
-
Constructor Details
-
JettyConnectionMetrics
-
JettyConnectionMetrics
-
JettyConnectionMetrics
Create aJettyConnectionMetrics
instance.Connector.getName()
will be used for connector.name tag.- Parameters:
registry
- registry to useconnector
- connector to instrument- Since:
- 1.8.0
-
JettyConnectionMetrics
public JettyConnectionMetrics(MeterRegistry registry, org.eclipse.jetty.server.Connector connector, Iterable<Tag> tags) Create aJettyConnectionMetrics
instance.Connector.getName()
will be used for connector.name tag.- Parameters:
registry
- registry to useconnector
- connector to instrumenttags
- tags to add to metrics- Since:
- 1.8.0
-
-
Method Details
-
onOpened
public void onOpened(org.eclipse.jetty.io.Connection connection) - Specified by:
onOpened
in interfaceorg.eclipse.jetty.io.Connection.Listener
-
onClosed
public void onClosed(org.eclipse.jetty.io.Connection connection) - Specified by:
onClosed
in interfaceorg.eclipse.jetty.io.Connection.Listener
-
addToAllConnectors
public static void addToAllConnectors(org.eclipse.jetty.server.Server server, MeterRegistry registry, Iterable<Tag> tags) -
addToAllConnectors
public static void addToAllConnectors(org.eclipse.jetty.server.Server server, MeterRegistry registry)
-