Announcing Transaction Traces for the Agent SDK

As those of you who’ve been following along will know, we’ve been hard at work developing new features for the Agent SDK. Today, we’re excited to announce support for Transaction Traces in the Agent SDK Beta.

To show you what the SDK can do today, we set up and instrumented WordPress running on the HipHop Virtual Machine (hhvm). We used this to demonstrate how to get started using the SDK and immediately have performance data show up in New Relic, including the newly supported transaction traces.

Getting Started

Before getting started, you should read the following articles to set up WordPress and familiarize yourself with hhvm’s Extension API:

Installing the Agent SDK

  1. Download the Agent SDK
  2. Copy the library files to /usr/lib or /usr/local/lib
  3. Copy the header files to /usr/include or /usr/local/include

Building the Agent SDK hhvm extension

  1. Checkout Agent SDK Samples to get the hhvm example
  2. Build the extension:
    > cd hhvm/extension
    > hphpize
    > cmake .
    > make

This will create a library file named which you will point to when configuring hhvm.

Configuring hhvm

The Agent SDK example ships with a sample hhvm config file called hhvm.hdf. You’ll need to make the following changes to this file:

  • Replace NEWRELIC_LICENSE_KEY with your license key under the EnvVariables section
  • Set the newrelic path under the DynamicExtensions section to the library that you built in the previous step, e.g.: newrelic = /var/www/

Instrumenting WordPress

Now that you’ve built the Agent SDK hhvm extension you can begin instrumenting WordPress. Most of the work done inside WordPress goes through a single function that processes actions (actions are events that occur within the lifecycle of a page). This function is called do_action. This provides a logical place for us to add instrumentation, and it will give you a nice breakdown of all the actions that occur for a given transaction.

Inside the Agent SDK examples download, we’ve included a file called wordpress-snippets.php that contains several code snippets with instructions. The instructions will tell you where to paste these code snippets.

Running WordPress

All you have to do next is fire up hhvm, navigate the site a bit, and you’ll start to see transactions show up in New Relic.

Here’s how:

  • Run $HPHP_HOME/hphp/hhvm/hhvm –mode daemon –config /path/to/hhvm.hdf
  • Open a browser and navigate to: http://localhost:8888
  • Click around on the site to initiate some WordPress actions
  • Wait a couple minutes, then log into New Relic

Now you’ll get a good picture of what’s happening in your WordPress site. If your site is really responsive, you probably won’t see a transaction trace. However, since you’re just trying out the SDK, you might want to artificially make a slow page to see a trace show up in New Relic. Here’s what a trace for a WordPress transaction looks like:


For more information about the Agent SDK, see:

Abner Germanow was formerly Senior Director of Partner Marketing & Evangelism at New Relic. View posts by .

Interested in writing for New Relic Blog? Send us a pitch!