Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: [jetty-users] client: getting pooled connection / destination statistics

> On Sep 14, 2017, at 10:44 PM, Simone Bordet <sbordet@xxxxxxxxxxx> wrote:
> 
> Hi,
> 
> On Thu, Sep 14, 2017 at 7:47 PM, Steven Schlansker
> <stevenschlansker@xxxxxxxxx> wrote:
>> I'm going through the process of upgrading from Apache HttpClient 4 to Jetty HttpClient -- we got tired
>> of dealing with terrible APIs and wanted asynchronous support :)
>> 
>> One thing I've not been able to figure out is how do I instrument the Jetty client to get
>> statistics out - number of connections used / available in pools; open connections
>> to each destination versus the limit, etc.
>> 
>> Didn't see a mention in the docs nor any obvious API, but I'm sure I'm just missing it.
> 
> This information is automatically exposed to JMX when using Jetty's
> JMX facilities.
> 
> Otherwise it is obtainable by downcasting to concrete classes:
> 
> HttpDestination destination = (HttpDestination)httpClient.getDestination(...);
> DuplexConnectionPool connectionPool =
> (DuplexConnectionPool)destination.getConnectionPool();
> 
> You may get different concrete classes based on the transport you have
> chosen, so maybe you need additional "instanceof" around.
> 
> HttpDestination and DuplexConnectionPool (and their parent classes)
> have methods annotated with @ManagedAttribute and those are exported
> to JMX and are probably those you're interested in.


Thanks!  JMX is great but we want to expose it over our own transport;
the magic downcasts were what I was missing.

Attachment: signature.asc
Description: Message signed with OpenPGP using GPGMail


Back to the top