Hi Romain,

On this commit to master:
https://github.com/cesarhernandezgt/tomee-mp-metrics-examples/commit/37e40dfc4fbdc65e95f90f3651b186aa2652c89f

I added @ApplicationScoped to the resource, removed the monotonic and added
beans.xml but still, the issue arises


El lun., 15 oct. 2018 a las 16:21, Romain Manni-Bucau (<
rmannibu...@gmail.com>) escribió:

> Hey César,
>
> not sure the link with monotonic - there is none - but the issue is when
> using a name which does not exist then the endpoint fail with a 500
>
> Your endpoint not being a CDI bean it does not support MP metrics so just
> adding @ApplicationScoped is enough to fix it.
> On another side i'll try to make the endpoint not failing this way on
> geronimo-metrics side.
>
> Romain Manni-Bucau
> @rmannibucau <https://twitter.com/rmannibucau> |  Blog
> <https://rmannibucau.metawerx.net/> | Old Blog
> <http://rmannibucau.wordpress.com> | Github <
> https://github.com/rmannibucau> |
> LinkedIn <https://www.linkedin.com/in/rmannibucau> | Book
> <
> https://www.packtpub.com/application-development/java-ee-8-high-performance
> >
>
>
> Le lun. 15 oct. 2018 à 22:58, César Hernández Mendoza <
> cesargu...@gmail.com>
> a écrit :
>
> > Thanks for the reply, this is the repo I created with the minimal
> > configuration to show the issue:
> > https://github.com/cesarhernandezgt/tomee-mp-metrics-examples
> >
> > El lun., 15 oct. 2018 a las 13:18, Romain Manni-Bucau (<
> > rmannibu...@gmail.com>) escribió:
> >
> > > Can you push your app on github with tomee maven plugin set up? Will be
> > > easier to check.
> > >
> > > Le lun. 15 oct. 2018 19:46, César Hernández Mendoza <
> > cesargu...@gmail.com>
> > > a écrit :
> > >
> > > >
> > > >> I noticed that on my previous email I paste I paste the exception
> from
> > > > the HTTP response and not the one from the log (attached).
> > > >
> > > > Some other things I did without success:
> > > > * Added `geronimo.metrics.jaxrs.activated=true` to tomee
> > > system.properties.
> > > > * Make the Resource @ApplicationScoped
> > > > * Debugged geronimo-metrics code and for some reason I couldn't
> > identify
> > > > so far, this is where we get the Nullpointer:
> > > >
> > >
> >
> https://github.com/apache/geronimo-metrics/blob/master/src/main/java/org/apache/geronimo/microprofile/metrics/jaxrs/PrometheusFormatter.java#L55
> > > > it  seems like if the annotation was not added.
> > > > * The same issue arise when you try to use @Gauge annotation. I
> haven't
> > > > check the others types of metrics.
> > > >
> > > >
> > > > El dom., 14 oct. 2018 a las 23:01, Romain Manni-Bucau (<
> > > > rmannibu...@gmail.com>) escribió:
> > > >
> > > >> Hi César,
> > > >>
> > > >> the actual error is in the cause - available in logs.
> > > >>
> > > >> Romain Manni-Bucau
> > > >> @rmannibucau <https://twitter.com/rmannibucau> |  Blog
> > > >> <https://rmannibucau.metawerx.net/> | Old Blog
> > > >> <http://rmannibucau.wordpress.com> | Github <
> > > >> https://github.com/rmannibucau> |
> > > >> LinkedIn <https://www.linkedin.com/in/rmannibucau> | Book
> > > >> <
> > > >>
> > >
> >
> https://www.packtpub.com/application-development/java-ee-8-high-performance
> > > >> >
> > > >>
> > > >>
> > > >> Le lun. 15 oct. 2018 à 06:24, César Hernández Mendoza <
> > > >> cesargu...@gmail.com>
> > > >> a écrit :
> > > >>
> > > >> > Any opinion on this issue?
> > > >> > Base on your expertise-instinct do you think this is not Tomee but
> > > >> > geronimo MP Metrics related?
> > > >> >
> > > >> > El vie., 12 oct. 2018 a las 17:27, César Hernández Mendoza (<
> > > >> > cesargu...@gmail.com>) escribió:
> > > >> >
> > > >> > > Hi,
> > > >> > >
> > > >> > > Within a JAX-RS resource I annotated the following method:
> > > >> > >
> > > >> > > @Counted(name = "cesar", absolute = true, monotonic = true)
> > > >> > > @GET
> > > >> > > public String message() {
> > > >> > >     return "Hi Microprofile JWT!";
> > > >> > > }
> > > >> > >
> > > >> > >
> > > >> > > Metric endpoint http://localhost:8181/moviefun/rest/metrics/
> > works
> > > >> fine.
> > > >> > >
> > > >> > > GET to http://localhost:8181/moviefun/rest/metrics/application
> > > >> returns
> > > >> > > 200 without any payload back.
> > > >> > >
> > > >> > > But when I try to do a GET to
> > > >> > > http://localhost:8181/moviefun/rest/metrics/application/cesar I
> > > got:
> > > >> > > <!doctype html><html lang="en"><head><title>HTTP Status 500 –
> > > Internal
> > > >> > > Server Error</title><style type="text/css">h1
> > > >> > >
> > > >> >
> > > >>
> > >
> >
> {font-family:Tahoma,Arial,sans-serif;color:white;background-color:#525D76;font-size:22px;}
> > > >> > > h2
> > > >> > >
> > > >> >
> > > >>
> > >
> >
> {font-family:Tahoma,Arial,sans-serif;color:white;background-color:#525D76;font-size:16px;}
> > > >> > > h3
> > > >> > >
> > > >> >
> > > >>
> > >
> >
> {font-family:Tahoma,Arial,sans-serif;color:white;background-color:#525D76;font-size:14px;}
> > > >> > > body
> > > >> > >
> > > >> >
> > > >>
> > >
> >
> {font-family:Tahoma,Arial,sans-serif;color:black;background-color:white;} b
> > > >> > >
> > > >> >
> > > >>
> > >
> >
> {font-family:Tahoma,Arial,sans-serif;color:white;background-color:#525D76;}
> > > >> > > p
> > > >> > >
> > > >> >
> > > >>
> > >
> >
> {font-family:Tahoma,Arial,sans-serif;background:white;color:black;font-size:12px;}
> > > >> > > a {color:black;} a.name {color:black;} .line
> > > >> > >
> > > >> >
> > > >>
> > >
> >
> {height:1px;background-color:#525D76;border:none;}</style></head><body><h1>HTTP
> > > >> > > Status 500 – Internal Server Error</h1><hr class="line"
> > > >> /><p><b>Type</b>
> > > >> > > Exception Report</p><p><b>Message</b> Error processing
> webservice
> > > >> > > request</p><p><b>Description</b> The server encountered an
> > > unexpected
> > > >> > > condition that prevented it from fulfilling the
> > > >> > >
> > > >>
> > request.</p><p><b>Exception</b></p><pre>javax.servlet.ServletException:
> > > >> > > Error processing webservice request
> > > >> > >
> > > >> > >
> > > >> >
> > > >>
> > >
> >
> org.apache.tomee.webservices.CXFJAXRSFilter.doFilter(CXFJAXRSFilter.java:98)
> > > >> > >
> > > org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:53)
> > > >> > >
> > org.apache.openejb.server.httpd.EEFilter.doFilter(EEFilter.java:65)
> > > >> > >
> > > >> >
> > > >>
> > >
> >
> org.apache.tomee.microprofile.jwt.MPJWTFilter.doFilter(MPJWTFilter.java:72)
> > > >> > >
> > > >> > >
> > > >> >
> > > >>
> > >
> >
> org.apache.geronimo.microprofile.opentracing.microprofile.server.OpenTracingFilter.doFilter(OpenTracingFilter.java:126)
> > > >> > >
> > > >> >
> > > >>
> > >
> >
> org.apache.tomee.microprofile.jwt.MPJWTFilter.doFilter(MPJWTFilter.java:72)
> > > >> > > </pre><p><b>Root
> Cause</b></p><pre>java.lang.NullPointerException
> > > >> > >
> > > >> > >
> > > >> >
> > > >>
> > >
> >
> org.apache.geronimo.microprofile.metrics.jaxrs.PrometheusFormatter.lambda$toText$0(PrometheusFormatter.java:55)
> > > >> > >
> > > >>
> > >
> java.util.stream.ReferencePipeline$3$1.accept(ReferencePipeline.java:193)
> > > >> > > java.util.Collections$2.tryAdvance(Collections.java:4717)
> > > >> > > java.util.Collections$2.forEachRemaining(Collections.java:4725)
> > > >> > >
> > > java.util.stream.AbstractPipeline.copyInto(AbstractPipeline.java:481)
> > > >> > >
> > > >> > >
> > > >> >
> > > >>
> > >
> >
> java.util.stream.AbstractPipeline.wrapAndCopyInto(AbstractPipeline.java:471)
> > > >> > >
> > > >> >
> > > >>
> > >
> >
> java.util.stream.ReduceOps$ReduceOp.evaluateSequential(ReduceOps.java:708)
> > > >> > >
> > > java.util.stream.AbstractPipeline.evaluate(AbstractPipeline.java:234)
> > > >> > >
> > > java.util.stream.ReferencePipeline.collect(ReferencePipeline.java:510)
> > > >> > >
> > > >> > >
> > > >> >
> > > >>
> > >
> >
> org.apache.geronimo.microprofile.metrics.jaxrs.PrometheusFormatter.toText(PrometheusFormatter.java:106)
> > > >> > >
> > > >> > >
> > > >> >
> > > >>
> > >
> >
> org.apache.geronimo.microprofile.metrics.jaxrs.PrometheusFormatter$$OwbNormalScopeProxy0.toText(org&#47;apache&#47;geronimo&#47;microprofile&#47;metrics&#47;jaxrs&#47;PrometheusFormatter.java)
> > > >> > >
> > > >> > >
> > > >> >
> > > >>
> > >
> >
> org.apache.geronimo.microprofile.metrics.jaxrs.MetricsEndpoints.getText(MetricsEndpoints.java:114)
> > > >> > > sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
> > > >> > >
> > > >> > >
> > > >> >
> > > >>
> > >
> >
> sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
> > > >> > >
> > > >> > >
> > > >> >
> > > >>
> > >
> >
> sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
> > > >> > > java.lang.reflect.Method.invoke(Method.java:498)
> > > >> > >
> > > >> > >
> > > >> >
> > > >>
> > >
> >
> org.apache.openejb.server.cxf.rs.PojoInvoker.performInvocation(PojoInvoker.java:43)
> > > >> > >
> > > >> > >
> > > >> >
> > > >>
> > >
> >
> org.apache.cxf.service.invoker.AbstractInvoker.invoke(AbstractInvoker.java:96)
> > > >> > > org.apache.cxf.jaxrs.JAXRSInvoker.invoke(JAXRSInvoker.java:193)
> > > >> > > org.apache.cxf.jaxrs.JAXRSInvoker.invoke(JAXRSInvoker.java:103)
> > > >> > >
> > > >> > >
> > > >> >
> > > >>
> > >
> >
> org.apache.openejb.server.cxf.rs.AutoJAXRSInvoker.invoke(AutoJAXRSInvoker.java:68)
> > > >> > >
> > > >> > >
> > > >> >
> > > >>
> > >
> >
> org.apache.cxf.interceptor.ServiceInvokerInterceptor$1.run(ServiceInvokerInterceptor.java:59)
> > > >> > >
> > > >> > >
> > > >> >
> > > >>
> > >
> >
> org.apache.cxf.interceptor.ServiceInvokerInterceptor.handleMessage(ServiceInvokerInterceptor.java:96)
> > > >> > >
> > > >> > >
> > > >> >
> > > >>
> > >
> >
> org.apache.cxf.phase.PhaseInterceptorChain.doIntercept(PhaseInterceptorChain.java:308)
> > > >> > >
> > > >> > >
> > > >> >
> > > >>
> > >
> >
> org.apache.cxf.transport.ChainInitiationObserver.onMessage(ChainInitiationObserver.java:121)
> > > >> > >
> > > >> > >
> > > >> >
> > > >>
> > >
> >
> org.apache.cxf.transport.http.AbstractHTTPDestination.invoke(AbstractHTTPDestination.java:267)
> > > >> > >
> > > >> > >
> > > >> >
> > > >>
> > >
> >
> org.apache.openejb.server.cxf.rs.CxfRsHttpListener.doInvoke(CxfRsHttpListener.java:253)
> > > >> > >
> > > >> > >
> > > >> >
> > > >>
> > >
> >
> org.apache.tomee.webservices.CXFJAXRSFilter.doFilter(CXFJAXRSFilter.java:94)
> > > >> > >
> > > org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:53)
> > > >> > >
> > org.apache.openejb.server.httpd.EEFilter.doFilter(EEFilter.java:65)
> > > >> > >
> > > >> >
> > > >>
> > >
> >
> org.apache.tomee.microprofile.jwt.MPJWTFilter.doFilter(MPJWTFilter.java:72)
> > > >> > >
> > > >> > >
> > > >> >
> > > >>
> > >
> >
> org.apache.geronimo.microprofile.opentracing.microprofile.server.OpenTracingFilter.doFilter(OpenTracingFilter.java:126)
> > > >> > >
> > > >> >
> > > >>
> > >
> >
> org.apache.tomee.microprofile.jwt.MPJWTFilter.doFilter(MPJWTFilter.java:72)
> > > >> > > </pre><p><b>Note</b> The full stack trace of the root cause is
> > > >> available
> > > >> > > in the server logs.</p><hr class="line" /><h3>Apache Tomcat
> > > >> > (TomEE)/9.0.12
> > > >> > > (8.0.0-RC2-SNAPSHOT)</h3></body></html>
> > > >> > >
> > > >> > > In the pom I'm using:
> > > >> > >
> > > >> > > <dependency>
> > > >> > >   <groupId>org.eclipse.microprofile.jwt</groupId>
> > > >> > >   <artifactId>microprofile-jwt-auth-api</artifactId>
> > > >> > >   <version>${mp-jwt.version}</version>
> > > >> > >   <scope>provided</scope>
> > > >> > > </dependency>
> > > >> > >
> > > >> > > <mp-metric.version>1.1</mp-metric.version>
> > > >> > >
> > > >> > >
> > > >> > > I notice that if I remove the monotonic = true
> > > >> > > Then both endpoint returns empty json response.
> > > >> > >
> > > >> > > Is there any flag I missed to use during tomee:run ?
> > > >> > > --
> > > >> > > Atentamente:
> > > >> > > César Hernández Mendoza.
> > > >> > >
> > > >> >
> > > >> >
> > > >> > --
> > > >> > Atentamente:
> > > >> > César Hernández Mendoza.
> > > >> >
> > > >>
> > > >
> > > >
> > > > --
> > > > Atentamente:
> > > > César Hernández Mendoza.
> > > >
> > >
> >
> >
> > --
> > Atentamente:
> > César Hernández Mendoza.
> >
>


-- 
Atentamente:
César Hernández Mendoza.

Reply via email to