How can I do the equivalent:
@Override public void init(final ServletConfig config) throws ServletException { super.init(config); CsvReporter.enable(new File("/tmp/measurements"), 1, TimeUnit.MINUTES); GraphiteReporter.enable(1, TimeUnit.MINUTES, "my.host.name", 2003); } @Override protected void doGet(final HttpServletRequest req, final HttpServletResponse resp) throws ServletException, IOException { final TimerContext timerContext = Metrics.newMeter(CreateSessionServlet.class,"myservlet-meter", "requests", TimeUnit.SECONDS).time(); try { ... } finally { timerContext.stop(); }
with spring annotations and cochagal metrics as stated here ?
I thought it would be as simple as:
-annotate my servlet like this (I will need gauges and measurements):
@Timed @Gauge @Metered @Override protected void doGet(final HttpServletRequest req, final HttpServletResponse resp) throws ServletException, IOException {
- and updating my spring server to include spring annotations as described on the page mentioned above.
But when I use jconsole, I donโt see any additional entry in the MBeans section for this servlet that I measured than for other servlets that do not use annotations
So my two questions:
Is there something that I donโt see for my web application to actually send metric data through JMX?
If I want the spring annotation code to start reporting to a CSV file or graphite, what do I need to add?
Surprisingly, I did not find complete examples on the Internet or in a codahale document about this.
source share