Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Is it possible to query Jetty Server for stats?

Tags:

clojure

jetty

I am looking to send statistics like the number of requests being handled by the jetty server, the number of requests waiting in queue etc. I would like to periodically send this as a count to my statsd agent to be able to plot it on Grafana. But I could not find any public apis on the Server class that expose such metrics.
I am guessing there are other people who are already doing it. I would like to know if there is a standard way to fetch these metrics programatically?

like image 402
Ashwin Avatar asked Nov 22 '25 20:11

Ashwin


1 Answers

Jetty provides an API to collect and expose statistics - StatisticsHandler. The handler can expose metrics via JMX but it doesn't have a built-in integration with StatsD.

In order to integrate it with StatsD manually, you could use one of the java statsd clients, e.g. java-statsd-client. For instance, you could schedule a task to read the data from the StatisticsHandler and send it to the StatsD agent using the abovementioned library.

like image 191
SerCe Avatar answered Nov 24 '25 10:11

SerCe



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!