That makes sense but require code from your own.
Regards
JB
On 22/11/2018 14:55, nino martinez wael wrote:
> I used a quite different approach (a lot smoother), using components and
> handlers.. it looks like this (hooking into the sling metrics registry):
> I also need to monitor current sessions etc.. I'll make the changes
> needed and post em.
>
> package dk.netdesign.***.frontend.jetty.configuration;
>
> import com.codahale.metrics.MetricRegistry;
> import com.codahale.metrics.jetty9.InstrumentedHandler;
> import org.eclipse.jetty.server.Handler;
> import org.osgi.framework.BundleContext;
> import org.osgi.framework.ServiceRegistration;
> import org.osgi.service.component.annotations.Activate;
> import org.osgi.service.component.annotations.Component;
> import org.osgi.service.component.annotations.Deactivate;
> import org.osgi.service.component.annotations.Reference;
>
> @Component(immediate = true)
> public class JettyConfigurator {
>
>
> private MetricRegistry registry;
> private ServiceRegistration<Handler> registerService;
> private Handler handler;
>
>
> @Activate
> public void activate(BundleContext bundleContext) {
> Handler handler = new InstrumentedHandler(registry,"JettyMetrics");
> registerService = bundleContext.registerService(Handler.class, handler, null);
> }
>
> @Deactivate
> public void deactivate() {
> if (registerService != null) {
> registerService.unregister();
> }
> }
>
> @Reference(target = "(name=sling)")
> public void setMetricsService(MetricRegistry registry) {
> this.registry = registry;
> }
> }
>
>
>
> On Thu, Nov 22, 2018 at 2:41 PM Jean-Baptiste Onofré <[email protected]
> <mailto:[email protected]>> wrote:
>
> Hi,
>
> this approach use fragment.
>
> Can you first try to use bundle:dynamic-import * on the pax-web bundle ?
>
> Regards
> JB
>
> On 22/11/2018 12:29, nino martinez wael wrote:
> > hmm this example does not seem to be working:
> >
> >
>
> https://github.com/ops4j/org.ops4j.pax.web/blob/master/samples/jetty-config-fragment/pom.xml
>
> >
> > I just added the
> >
> > <Fragment-Host>org.ops4j.pax.web.pax-web-jetty</Fragment-Host>
> >
> > to the bundle instructions
> >
> > and the jetty.xml to my resource folder of the project..
> >
> > My bundle are now ignored by pax wicket, and pax web does not
> pickup the
> > jetty.xml :(
> >
> > I just want some metrics for my web application so I can count
> > concurrent users, response times etc.. Any ideas on howto archieve
> that?
> >
> >
> >
> > On Thu, Nov 22, 2018 at 12:14 PM nino martinez wael
> > <[email protected]
> <mailto:[email protected]>
> <mailto:[email protected]
> <mailto:[email protected]>>> wrote:
> >
> > so this seems to be sort of a way:
> >
> > https://groups.google.com/forum/#!topic/ops4j/4SljkP-rBBQ
> >
> > Heres whats seems a better example:
> >
> >
>
> https://github.com/ops4j/org.ops4j.pax.web/blob/master/samples/jetty-config-fragment/pom.xml
> >
> >
> > On Thu, Nov 22, 2018 at 12:08 PM nino martinez wael
> > <[email protected]
> <mailto:[email protected]>
> <mailto:[email protected]
> <mailto:[email protected]>>>
> > wrote:
> >
> > How should I do the dynamic import? in pax web?
> >
> > PS after being to devoxx my memory seems to have been
> wiped, sorry..
> > -regards Nino
> >
> > On Thu, Nov 22, 2018 at 11:08 AM Jean-Baptiste Onofré
> > <[email protected] <mailto:[email protected]>
> <mailto:[email protected] <mailto:[email protected]>>> wrote:
> >
> > Hi Nino,
> >
> > com.codahale.metrics package is not part of Pax Web,
> that's
> > why you have
> > the ClassNotFoundException.
> >
> > Did you try a dynamic import ?
> >
> > Regards
> > JB
> >
> > On 22/11/2018 11:05, nino martinez wael wrote:
> > > Hi fellow karaflings
> > >
> > > I am have some trouble applying metrics to Jetty, I've
> > tried doing so in
> > > jetty.xml:
> > >
> > > <Set name="threadPool">
> > > <New
> >
> class="com.codahale.metrics.jetty9.InstrumentedQueuedThreadPool"/>
> > > </Set>
> > > <New id="metricshandler"
> > > class="com.codahale.metrics.jetty9.InstrumentedHandler">
> > > </New>
> > >
> > > <Set name="handler">
> > > <New id="Handlers"
> > >
> class="org.eclipse.jetty.server.handler.HandlerCollection">
> > > <Call name="addHandler">
> > > <Arg>
> > > <Ref id="metricshandler"/>
> > > </Arg>
> > > </Call>
> > > </New>
> > > </Set>
> > >
> > > But get this:
> > > Caused by: java.lang.ClassNotFoundException:
> > > com.codahale.metrics.jetty9.InstrumentedQueuedThreadPool
> > not found by
> > > org.ops4j.pax.web.pax-web-jetty
> > >
> > > I am installing the required bundle with my feature:
> > >
> > >
> >
> <bundle>mvn:io.dropwizard.metrics/metrics-jetty9/3.2.6</bundle>
> > >
> > >
> > > But it seems jetty are not able to pick it up?
> > >
> > > --
> > > Best regards / Med venlig hilsen
> > > Nino Martinez
> >
> > --
> > Jean-Baptiste Onofré
> > [email protected] <mailto:[email protected]>
> <mailto:[email protected] <mailto:[email protected]>>
> > http://blog.nanthrax.net
> > Talend - http://www.talend.com
> >
> >
> >
> > --
> > Best regards / Med venlig hilsen
> > Nino Martinez
> >
> >
> >
> > --
> > Best regards / Med venlig hilsen
> > Nino Martinez
> >
> >
> >
> > --
> > Best regards / Med venlig hilsen
> > Nino Martinez
>
> --
> Jean-Baptiste Onofré
> [email protected] <mailto:[email protected]>
> http://blog.nanthrax.net
> Talend - http://www.talend.com
>
>
>
> --
> Best regards / Med venlig hilsen
> Nino Martinez
--
Jean-Baptiste Onofré
[email protected]
http://blog.nanthrax.net
Talend - http://www.talend.com