This specification is related to the JIRA ticket INSPECTIT-1053.
Motivation
The usual Business Enterprise Application are running on more that one machine (virtual machine) because they are splitted into several parts (for example FrontEndServer, BackEndServer). InspectIT can monitore each part on its own. That means you are able to see invocation sequences for the FrontEndServer and you can see invocation sequences for the BackEndServer. But you can not combine them, because you do not know which one fits togehter. It is a natural appetence to combine these sequences automatically. If you are able to do this, you can see a whole transaction on different machines. This page discribes how InspectIT combines invocation sequences on different machines.
Considerations
- in order to combine invocation sequences we need an identifier for each one
- we need to send the identifier from one machine to another
- JVM comunication based on different protocols (for example http, https, IIOP, ...)
- We must add the identifier (invocation sequence ID) to the protocol
- We must read the identifier on the other JVM
- A general implementation seems unlikely, because each protocol is different
- even the implementation of one protocol in different envirements are different (for example http on Apache Tomcat vs. JBoss vs Weblogic)
- the implementation must work without invocation sequences (no invocation sequence is neccessary to capture remote call data)
In order to prove the considerations it is necessary to make a POC. For the first shot we try to expand the http header on an Apache Tomcat.
While implementation I decissed to implement a sensor for each protocol and each different implementation of the protocol. The following table shows an overview about the implemented protocols.The table is not complet. So feel free to add more.
Apache Tomcat | JBoss | Weblogic | Glasfish | |
---|---|---|---|---|
Http | X | X | P | |
RMI | P | |||
Legend: X Done, P Planed
Http
Http is a common application protocol for distributed systems. Furthermore the header is expandable and plain text. Unfortunately Java does not provide a standart implementation of the http protocol. Java just provides the abstract class java.net.HttpURLConnection.This class provides the abstract methode connect(). This methode should open a communication link to the requested URL. This seems to be a good place to extend the http header. InspectIT already provides a mechanism to add some code before the methode body. We use this mechanism to expand the header before the methode body of the methode connect() will be execute.
Insertion of the InspectIT Header
Apache Tomcat
The implementation of the Apache Tomcate extends the abstract class java.net.HttpURLConnection with the class sun.net.www.protocol.http.HttpURLConnection.
method-sensor-type webrequestInApache info.novatec.inspectit.agent.sensor.method.webrequest.inserter.http.apache.WebrequestApacheHttpInserterSensor MAX sensor webrequestInApache sun.net.www.protocol.http.HttpURLConnection connect() charting=true
The sensor works just on this specific implementation. The class info.novatec.inspectit.agent.sensor.method.webrequest.inserter.http.apache.WebrequestApacheHttpInserterSensor handles the sensor. The correspondig hook uses the methode addRequestProperty of the class sun.net.www.protocol.http.HttpURLConnection to add an specific inspectIT header to the http header attricbutes.
Version | Tested | Supported |
---|---|---|
8.0 | X | X |
7.0 | X | X |
6.0 | X | X |
JBoss
The JBoss uses the org.jboss.ws.core.client.transport.NettyClient as implemetation for the http protocol. The methode invoke(java.lang.Object,java.lang.String,boolean,java.util.Map,java.util.Map) performs the http request. The 4. parameter of the methode is a Map of additional http headers to be added to the request. We just add the InspectIT header to this map.
Version | Tested | Supported | Know Problems |
---|---|---|---|
5.1 | X | X | |
6.x | X | X | |
7.0 | X | Insert Header, but could not extract. | Logging Problem |
8.2 (Wildfly) | X | Server do not start | Logging Problem |
Weblogic
not now.
Extraction of the InspectIT Header
Each http request will be compute in a subclass of javax.servlet.Servlet. So we can use the method service(javax.servlet.ServletRequest,javax.servlet.ServletResponse) to extract the InspectIT header.
Current UI Integration