If you don’t know about Spring Insight Developer, this post may save you tons of time and potentially headache.
Imagine that you need to update some code behind a button, but you didn’t write the code. What if you could press the to-be-coded button and then see what code was invoked (including methods and arguments), the SQL invoked, and the time it took to execute?
This is what Spring Insight Developer allows you to do, and more.
It’s also free, and it uses AspectJ and AOP to load-time weave your application, you do not have to make any changes to your application code to use it.
Let’s take a look at a simple example of tracing your app, viewing the details, and seeing the code in action.
Step 1: Trace Your App
In the screen shot below, there are two windows.
- The top window shows the “Recent Activity” tab within Spring Insight running on localhost. This tab shows the “Trace History” over time. A Trace represents a thread of execution. It is usually started by an HTTP request made up of one or more operations starting with Endpoints (e.g. a GET service or other receptor of requests) but can also be started by a background job.
- The bottom window shows the VMware vFabric SpringTrader Reference Architecture application running and the button “Get Quote” being pressed. When you press the button, the Trace is captured in the history above along with the operations details.
Step 2: View the Trace Details
In the screen shot below, we see the last Trace in the history (top right) highlighted in dark green. For any user request, Spring Insight shows each Trace organized by Endpoint within an Application. Below the Trace History, we see the individual traces. We have the QuoteController#findQuote Endpoint highlighted. It took 8ms for the GET /spring-nanotrader-services/api/quote/VMW to run from the Application spring-nanotrader-services. Below this, we see the trace details (including the breakdown of what took the most time in the 8ms trace):
- Filters for servlet operations like security and authentication
- The QuoteController#findQuote request/response servlet operation
- A JDBC SELECT (QUOTE) database call
Step 3: Seeing the Method Call, Arguments Passed and Returned
By expanding QuoteController#findQuote, we can see the “VMW” argument passed in from the original GUI interaction, the return value, and the source code location. We could also see the SQL passed or similar details in a SQL transaction. This let’s you quickly drill down into problem areas that take too long. Keep in mind, Spring Insight Operations let’s you do this in production systems too.
Video of Spring Insight Developer 1.8.3
This video shows how Spring Insight can be used by developers, explains it’s integration with Google Speed Tracer, and then shows how it is integrated with SpringSource Tool Suite.
Extending the Insight with a Plug-In Architecture and RabbitMQ Example
Spring Insight has plugins for Grails, GemFire, Hadoop, Hibernate, JMS, JNDI, LDAP, MongoDB, RabbitMQ, Redis, Spring Batch, Spring Integration, Tomcat, and many more on Github. With these plugins, you can get insight across a significant set of components and architectures. There is also a bounty program where you can get paid to develop new plugins or offer to pay others. As an example, there is a post on the RabbitMQ Plugin for Spring Insight with more detail. The Rabbit plugin allows you to monitor RabbitMQ Java client libraries at the code-level and allows you to monitor your application’s performance around publishing and receiving messages with RabbitMQ. There is a more detail and an example screenshot in this article.
|>>The entire list of Spring Insight Plugins is available at Github >> You can download Spring Insight on tc Server or with STS.|
What are some Benefits?
- As mentioned, it’s free, and it’s also quite easy to download, set-up, and understand.
- Since Spring Insight uses AspectJ and AOP to load-time weave your application, you do not have to make any changes to your application code to use Spring Insight.
- It helps you code, test, troubleshoot, and iterate more quickly through development efforts.
- As you might expect, it also helps reduce project risk, makes applications more reliable, helps avoid releasing problem code into production, and makes troubleshooting production problems much easier.
- It works with Spring Insight Operations (read about the differences here) and vFabric Application Performance Manager within the vFabric Suite so that you can get the same view of code in a test, production, or other “live” system. For DevOps, this means we are all looking at the same information about application performance and problematic code.
- There are other benefits, like a plug-in based architecture, and you can read more about the approach to the “split-agent” architecture (i.e. how Spring Insight Operations works) in this article.
|About the Author: Duncan Winn is currently an architect with VMware’s SpringSource division. He has also worked at GE and IBM where he spent a considerable amount of time as a developer porting many well established commercial middleware products onto new platforms before moving into management and producing monitoring and diagnostics tooling for the JVM and Java language. More recently, he has been working to help customers transform their legacy applications and platforms into agile, lightweight alternatives to drive value back into their business. His expertise includes Java development, Websphere, Agile, middleware, SOA, in-memory data grids, cloud provisioning, PaaS, and legacy transformation. He has a degree and MSc in Oceanography from the University of Plymouth and the University of Southampton, and an MSc in Computer Science from the University of Birmingham.|