eclipse-ee4j / eclipse-ee4j/jersey
Add exceptions to the tracing
- Dominant language
- Java
- Stars
- 730
- Forks
- 382
- PR merge metrics
- No merged PRs in 30d
Description
Tracing currently does not include information about exceptions. When exception in MBW is thrown the tracing with VERBOSE level looks like the following:
```
X-Jersey-Tracing-020=[MBW [ ---- / 226.06 ms | ---- %] [org.glassfish.jersey.message.internal.XmlCollectionJaxbProvider$General @1f00aff5] is skipped]
X-Jersey-Tracing-023=[WI [ 0.00 / 355.42 ms | 0.00 %] [org.glassfish.jersey.server.internal.JsonWithPaddingInterceptor @5a2d13c1 #3000] AFTER context.proceed()]
X-Jersey-Tracing-024=[WI [ 0.00 / 355.46 ms | 0.00 %] [org.glassfish.jersey.server.internal.MappableExceptionWrapperInterceptor @10bcc8f4 #10] AFTER context.proceed()]
X-Jersey-Tracing-021=[MBW [ ---- / 226.09 ms | ---- %] [org.glassfish.jersey.message.internal.XmlRootElementJaxbProvider$General @693e4a5a] is skipped]
Content-Length=[0]
X-Jersey-Tracing-022=[MBW [129.20 / 355.34 ms | 34.19 %] WriteTo by [org.glassfish.jersey.moxy.json.internal.ConfigurableMoxyJsonProvider @2c8c7d6]]
X-Jersey-Tracing-002=[PRE-MATCH [ 0.02 / 13.70 ms | 0.00 %] PreMatchRequest summary: 0 filters]
X-Jersey-Tracing-001=[START [ ---- / 0.65 ms | ---- %] Other request headers: user-agent=[Jersey/2.4-SNAPSHOT (HttpUrlConnection 1.6.0_65)] host=[localhost:9998] connection=[keep-alive]]
X-Jersey-Tracing-000=[START [ ---- / ---- ms | ---- %] baseUri=[http://localhost:9998/] requestUri=[http://localhost:9998/resource] method=[GET] authScheme=[n/a] accept=[text/html, image/gif, image/jpeg, *; q=.2, */*; q=.2] accept-encoding=n/a accept-charset=n/a accept-language=n/a content-type=n/a content-length=n/a] Connection=[close]
Date=[Tue, 22 Oct 2013 14:56:35 GMT]
X-Jersey-Tracing-017=[MBW [ ---- / 222.87 ms | ---- %] Find MBW for type=[org.glassfish.jersey.tests.e2e.json.XmlTypeTest$Bean1] genericType=[org.glassfish.jersey.tests.e2e.json.XmlTypeTest$Bean1] mediaType=[[javax.ws.rs.core.MediaType @456c1227]] annotations=[@javax.ws.rs.GET(), @javax.ws.rs.Produces(value=[application/json])]]
X-Jersey-Tracing-016=[WI [ 0.03 / 222.78 ms | 0.01 %] [org.glassfish.jersey.server.internal.JsonWithPaddingInterceptor @5a2d13c1 #3000] BEFORE context.proceed()]
X-Jersey-Tracing-015=[WI [ 0.02 / 222.71 ms | 0.00 %] [org.glassfish.jersey.server.internal.MappableExceptionWrapperInterceptor @10bcc8f4 #10] BEFORE context.proceed()]
X-Jersey-Tracing-014=[RESP-FILTER [ 0.02 / 220.20 ms | 0.00 %] Response summary: 0 filters]
X-Jersey-Tracing-019=[MBW [ ---- / 226.02 ms | ---- %] [org.glassfish.jersey.server.validation.internal.ValidationErrorMessageBodyWriter @25e3bbd7] is skipped]
X-Jersey-Tracing-018=[MBW [ ---- / 225.98 ms | ---- %] [org.glassfish.jersey.moxy.json.internal.ConfigurableMoxyJsonProvider @2c8c7d6] IS writeable]
X-Jersey-Tracing-011=[REQ-FILTER [ 0.01 / 20.35 ms | 0.00 %] Request summary: 0 filters]
X-Jersey-Tracing-010=[MATCH [ 6.09 / 20.26 ms | 1.61 %] RequestMatching summary]
X-Jersey-Tracing-013=[INVOKE [ ---- / 219.24 ms | ---- %] Response: [org.glassfish.jersey.message.internal.OutboundJaxrsResponse @35a271f5 <200/SUCCESSFUL|OK|org.glassfish.jersey.tests.e2e.json.XmlTypeTest$Bean1 @3be7a755>]]
X-Jersey-Tracing-012=[INVOKE [ 0.07 / 217.96 ms | 0.02 %] Resource [org.glassfish.jersey.tests.e2e.json.XmlTypeTest$Bean1Resource @2dabcea] method=[public org.glassfish.jersey.tests.e2e.json.XmlTypeTest$Bean1 org.glassfish.jersey.tests.e2e.json.XmlTypeTest$Bean1Resource.getBean1()]]
X-Jersey-Tracing-007=[MATCH [ ---- / 16.24 ms | ---- %] Matched resource: template=[resource] regexp=[/resource(/.*)?] matches=[/resource] from=[/resource]]
X-Jersey-Tracing-008=[MATCH [ ---- / 19.13 ms | ---- %] Matched method : public org.glassfish.jersey.tests.e2e.json.XmlTypeTest$Bean1 org.glassfish.jersey.tests.e2e.json.XmlTypeTest$Bean1Resource.getBean1()]
X-Jersey-Tracing-009=[MATCH [ ---- / 20.13 ms | ---- %] Resource instance: [org.glassfish.jersey.tests.e2e.json.XmlTypeTest$Bean1Resource @2dabcea]]
X-Jersey-Tracing-003=[MATCH [ ---- / 14.81 ms | ---- %] Matching path [/resource]]
X-Jersey-Tracing-004=[MATCH [ ---- / 14.88 ms | ---- %] Pattern [/application\.wadl(/)?] is NOT matched]
X-Jersey-Tracing-005=[MATCH [ ---- / 14.92 ms | ---- %] Pattern [/application\.wadl(/.*)?] is NOT matched]
X-Jersey-Tracing-006=[MATCH [ ---- / 15.01 ms | ---- %] Pattern [/resource(/)?] IS selected]
X-Jersey-Tracing-026=[FINISHED [ ---- / 355.55 ms | ---- %] Response status: 200/SUCCESSFUL|OK]
X-Jersey-Tracing-025=[WI [133.10 / 355.51 ms | 35.22 %] WriteTo summary: 2 interceptors]
X-Jersey-Tracing-028=[FINISHED [ ---- / 377.89 ms | ---- %] Response status: 500/SERVER_ERROR|Internal Server Error]
X-Jersey-Tracing-027=[RESP-FILTER [ 0.01 / 377.81 ms | 0.00 %] Response summary: 0 filters]
```
I miss there information that the exception was thrown. I would at least add this info. Additionally, it would be good to have exception stack trace (at least for the VERBOSE level).
Details:
If there would be any exception mapper, this will be probably listed in the tracing info. The problem is that there is no exception mapper and response 500 is processed. Therefore log info contains firstly 200 response status and then 500 response status.
The exception thrown is (not important for this task, but to list all needed information):
```
[Exception [EclipseLink-50013] (Eclipse Persistence Services - 2.5.0.v20130507-3faac2b): org.eclipse.persistence.exceptions.JAXBException
Exception Description: The property or field itemCount on the class org.glassfish.jersey.tests.e2e.json.XmlTypeTest$Bean1 is required to be included in the propOrder element of the XmlType annotation.]
at org.eclipse.persistence.jaxb.JAXBContext$TypeMappingInfoInput.createContextState(JAXBContext.java:1021)
at org.eclipse.persistence.jaxb.JAXBContext.(JAXBContext.java:174)
at org.eclipse.persistence.jaxb.JAXBContextFactory.createContext(JAXBContextFactory.java:165)
at org.eclipse.persistence.jaxb.JAXBContextFactory.createContext(JAXBContextFactory.java:152)
at org.eclipse.persistence.jaxb.JAXBContextFactory.createContext(JAXBContextFactory.java:112)
at org.eclipse.persistence.jaxb.JAXBContextFactory.createContext(JAXBContextFactory.java:102)
at org.eclipse.persistence.jaxb.rs.MOXyJsonProvider.getJAXBContext(MOXyJsonProvider.java:302)
at org.eclipse.persistence.jaxb.rs.MOXyJsonProvider.writeTo(MOXyJsonProvider.java:787)
at org.glassfish.jersey.message.internal.WriterInterceptorExecutor$TerminalWriterInterceptor.invokeWriteTo(WriterInterceptorExecutor.java:243)
at org.glassfish.jersey.message.internal.WriterInterceptorExecutor$TerminalWriterInterceptor.aroundWriteTo(WriterInterceptorExecutor.java:230)
at org.glassfish.jersey.message.internal.WriterInterceptorExecutor.proceed(WriterInterceptorExecutor.java:149)
at org.glassfish.jersey.server.internal.JsonWithPaddingInterceptor.aroundWriteTo(JsonWithPaddingInterceptor.java:103)
at org.glassfish.jersey.message.internal.WriterInterceptorExecutor.proceed(WriterInterceptorExecutor.java:149)
at org.glassfish.jersey.server.internal.MappableExceptionWrapperInterceptor.aroundWriteTo(MappableExceptionWrapperInterceptor.java:88)
at org.glassfish.jersey.message.internal.WriterInterceptorExecutor.proceed(WriterInterceptorExecutor.java:149)
at org.glassfish.jersey.message.internal.MessageBodyFactory.writeTo(MessageBodyFactory.java:1139)
at org.glassfish.jersey.server.ServerRuntime$Responder.writeResponse(ServerRuntime.java:557)
at org.glassfish.jersey.server.ServerRuntime$Responder.processResponse(ServerRuntime.java:381)
at org.glassfish.jersey.server.ServerRuntime$Responder.process(ServerRuntime.java:371)
at org.glassfish.jersey.server.ServerRuntime$1.run(ServerRuntime.java:262)
at org.glassfish.jersey.internal.Errors$1.call(Errors.java:271)
at org.glassfish.jersey.internal.Errors$1.call(Errors.java:267)
at org.glassfish.jersey.internal.Errors.process(Errors.java:315)
at org.glassfish.jersey.internal.Errors.process(Errors.java:297)
at org.glassfish.jersey.internal.Errors.process(Errors.java:267)
at org.glassfish.jersey.process.internal.RequestScope.runInScope(RequestScope.java:318)
at org.glassfish.jersey.server.ServerRuntime.process(ServerRuntime.java:236)
at org.glassfish.jersey.server.ApplicationHandler.handle(ApplicationHandler.java:983)
at org.glassfish.jersey.grizzly2.httpserver.GrizzlyHttpContainer.service(GrizzlyHttpContainer.java:334)
at org.glassfish.grizzly.http.server.HttpHandler$1.run(HttpHandler.java:209)
at org.glassfish.grizzly.threadpool.AbstractThreadPool$Worker.doWork(AbstractThreadPool.java:565)
at org.glassfish.grizzly.threadpool.AbstractThreadPool$Worker.run(AbstractThreadPool.java:545)
at java.lang.Thread.run(Thread.java:695)
Caused by: Exception [EclipseLink-50013] (Eclipse Persistence Services - 2.5.0.v20130507-3faac2b): org.eclipse.persistence.exceptions.JAXBException
Exception Description: The property or field itemCount on the class org.glassfish.jersey.tests.e2e.json.XmlTypeTest$Bean1 is required to be included in the propOrder element of the XmlType annotation.
at org.eclipse.persistence.exceptions.JAXBException.missingPropertyInPropOrder(JAXBException.java:250)
at org.eclipse.persistence.jaxb.compiler.AnnotationsProcessor.finalizeProperties(AnnotationsProcessor.java:883)
at org.eclipse.persistence.jaxb.compiler.AnnotationsProcessor.processClassesAndProperties(AnnotationsProcessor.java:282)
at org.eclipse.persistence.jaxb.compiler.Generator.(Generator.java:150)
at org.eclipse.persistence.jaxb.JAXBContext$TypeMappingInfoInput.createContextState(JAXBContext.java:1017)
... 32 more
```
Contributor guide
Research direction
Start by locating the tracing implementation that emits the X-Jersey-Tracing entries and follow the exception path through writer interceptors and response processing. Use the verbose tracing example and the supplied stack trace to determine where exception details belong. Done means tracing records the thrown exception, with a stack trace at VERBOSE level, without misleading response information.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- java
- Domain
- observability
- Issue type
- Feature
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100