Home > Blogs > VMware vFabric Blog


3 Steps on Using Spring Insight Developer to Analyze Code

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?

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.

8 thoughts on “3 Steps on Using Spring Insight Developer to Analyze Code

  1. Pingback: VMware vFabric Blog: A Tale of Modernization: Stopping Bank Robbers as a Service (20 Billion Times to Date) | Virtualization

  2. Pingback: Building a Multi-Tenant Development Mindset in the Travel Software Industry | VMware vFabric Blog - VMware Blogs

  3. Pingback: Scaling in Complex Domains Using CQRS, Axon, and Spring Insight | VMware Virtualization & Cloud Management - VMware Blogs

  4. http://wlimail.com

    Hello there! This blog post couldn’t be written
    any better! Looking through this article reminds me
    of my previous roommate! He always kept talking about this.
    I will send this information to him. Pretty sure he will have a
    good read. Thank you for sharing!

    Here is my homepage :: http://wlimail.com

    Reply

Leave a Reply

Your email address will not be published. Required fields are marked *

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>