08 Aug

Appium tutorial [Steps for Windows & OSX]

Step by step guide for instaling Appium  for Windows

               0.JAVA_HOMEconfigured

  1. Download Android SDK
  2. Android Setup guide: http://spring.io/guides/gs/android/
  3. Android-Sdk must be installed and ANDROID_HOME set
    1. http://developer.android.com/sdk/older_releases.html
    2. VARIABLE NAME: ANDROID_HOME
    3. VARIABLE VALUE: C:\android_sdk\adt-bundle-windows-x86_64-20131030\sdk
    4. Open CMD and go to the location: C:\android_sdk\adt-bundle-windows-x86_64-20131030\sdk
    5. Type: android
    6. Inside AVD Manager Select the Tools checkbox.
    7. Select the checkbox for the latest Android SDK, Android 4.2.2 (API Level 17) as of this writing.
    8. From the Extras folder, select the checkbox for the Android Support Library.
    9. Click the Install packages… button to complete the download and installation.
  4. Create AVD Emulators
  5. android create avd –name Default –target “android-19” –abi armeabi-v7a
    1. –name Name of the new AVD.
    2. –target Target ID of the new AVD.
    3. –abi The CPU/ABI to use for the AVD.
  6. android list targets (displays a list of available targets)
  7. android list avd (Shows the list of virtual devices created)
  8. emulator -avd Default (Verify that emulator is working fine)

PATH: %ANDROID_HOME%\tools;%ANDROID_HOME%\platform-tools

http://theunlockr.com/2009/10/06/how-to-set-up-adb-usb-drivers-for-android-devices/

 

Step-by-Step Guide for Installing Appium on OS X:

Visit: http://appium.io/

Pre-Requisite:

Installed OSX 10.9.2 (Mavericks)

Installed XCode Version 5.1 (5B130a)

Step: 1 Install Node.js

Install Homebrew v.0.9.5 (in order to do a brew install in next step)

Install Node.js and npm with Homebrew

First, install Homebrew. Open the terminal and type:

ruby -e “$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)”

Then, run brew update to ensure your Homebrew is up to date.

brew update

As a safe measure, run brew doctor to make sure your system is ready to brew. Follow any recommendations from brew doctor.

brew doctor

Next, add the Homebrew location to your $PATH and source your bash or zsh profile file after adding/saving this:

export PATH=”/usr/local/bin:$PATH”

Next, install Node (npm will be installed with node):

brew install node

Step 2: Install APPIUM

run ‘npm install -g appium’

run ‘npm install wd’ (you might need to SUDO)

Now run ‘authorize_ios’

You might get this error: “error stderr maxbugger exceeded”

running again as ‘sudo authorize_ios’ but now seeing

— error: Appium will not function correctly if used under sudo. Please rerun as a non-root user. If you had to install Appium using `sudo npm install -g appium`, the solution is to reinstall Node using a method (Homebrew, for example) that doesn’t require sudo to install global npm packages.

 since authorize_ios does not work with sudo you needed to manually run chown on the Applications dir. Just ran this:

cd ‘/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator7.1.sdk’

sudo chown -R yourusername>:staff Applications

Once everything is done just type: ‘appium &’ in the terminal and it will start the Appium and you should be ready to use it.

Appium On Windows

Pre-requisite:

Appium

 

Share this
08 Aug
08 Aug

Best Automation Tools 2016

http://www.seleniumhq.org/

http://experitest.com/

http://www.ranorex.com/pu

http://jmeter.apache.org/

http://smartbear.com/product/ready-api/soapui-ng/overview/

http://www.testplant.com/

http://www.testplant.com/

http://appium.io/

https://saucelabs.com/resources/mobile-testing-tools/robotium-androidhttp://cukes.info/http://calaba.sh/

http://www.fitnesse.org/

Share this
06 Sep

ParaSoft API Test

Parasoft Service Virtualization is a product you need to seriously consider if you are developing applications that you have to test. But before I continue, let me step back a bit.

What is one of the first things you do when setting up a test environment? Well I guess that largely depends on your budget. Let us assume we all work for a company that conforms to best practices with regards to software development and the SDLC.

The easiest way to emulate the client site is to use virtualization. My current favourite being VirtualBox, but VMWare is also a great choice. Setting up a copy of the client site on a VM is the best method for testing your custom applications. It now gets even better with Parasoft Service Virtualization.

One of the major shortcomings of the old traditional Virtual Machine route is that it is nearly impossible to emulate 3rd party components or dependencies in the virtualized environment. To give you an example, I do ERP customization on a product called SYSPRO. It is always a challenge setting up the ERP copy on the VM to exactly match the client site.

The client ERP installation could also already contain customizations developed by other companies. Imagine this client then also accesses a Web Service to initiate some sort of Approval Workflow or Notification Service for management. It is almost impossible to emulate all this functionality in the Test VM you are setting up for your application.

I say so because to my mind, there are 2 major factors here that limit you from doing this:

  • Development Budget – We all know that a development budget isn’t an endless pit from where you can just dip in to. Spending weeks setting up a fully functional Virtual Machine just will not happen.
  • Environmental Change – Let us assume you manage to spend weeks setting up your Virtual Machine to mimic the client site almost perfectly. That’s nice…. but in the weeks you spent setting up the Virtual Machine, the client site changed significantly. It changes because it is a multi-user site with an ever evolving environment. Can your budget allow you to constantly change and maintain your VM to stay in sync with the client site?

Parasoft Service Virtualization

This all comes down to time. The less time you spend on setting up your test environment, the more time you have for actual testing. The less time you need to spend on mimicking and keeping up with changes to the client environment, the more time you have for actual development.

I don’t know about you, but in my world this equates to better code, less bugs and a healthy ending project expense on completion. Parasoft Service Virtualization allows you to do just that.

Parasoft Service Virtualization – In A Nutshell

Parasoft Service Virtualization allows you to capture and virtualize transaction behavior and the data transmitted between all these systems. This records live transactions in the client environment by analysing transaction logs or by modelling behaviour from a simple interface. In other words, instead of having to virtualize applications and settings, Parasoft ServiceVirtualization allows you to capture and virtualize data and the data between all these systems.

Let us say you are testing a web application, you can easily perform load testing using actual data recorded from the client site. And I know what you are going to ask next…. all the data can be obfuscated. So none of the recorded data can be compromised. This is probably the biggest single most important feature of the product. Imagine the possibilities.

Another fantastic feature is that you can modify recorded data. Let us assume for example that a 3rd party application is used by your client ERP. This 3rd party application generates an average of 50 Sales Orders per day. Each Sales Order is a single line order with a quantity of 1 for a specific stock code. The 3rd party generated Sales Orders are posted to the client ERP. Your application needs to check stock levels and if there is no stock, place the Sales Order on back order.

You can then easily test this by changing the recorded data to make each Sales Order contain line quantities of 1000 instead of 1. This will allow the system to reach the minimum stock level earlier and forcing your application into placing the order on back order. Imagine being able to test your application with large volumes of high quantity Sales Orders. Will it stand up to the onslaught of several sales orders per second? With Parasoft Service Virtualization, you don’t need to wonder any more. You control the data, so you can modify it to suit your test requirement.

You can also copy and modify different scenarios for different test requirements. This makes testing your application very efficient and robust.

Parasoft Service Virtualization – Initial Impressions

The product is an absolute tour de force. The potential cost saving is dramatic, especially considering what you can virtualize using Parasoft Service Virtualization and the benefit that has on development and testing. Being able to capture the interaction between your system and external components helps you understand your system. Being able to edit and replay those interactions as part of your test environment is unheard of until now. This is the power of Parasoft Virtualize.

I will concede that as a user, the configuration and implementation of the product can seem overwhelming. I would list this as a negative point, but I can’t do that. The reason I can’t do that is because Parasoft have put as much (if not more) effort into developing tutorials, training videos and user documentation as what they have in developing this product. Why not head on over to the Parasoft website and request an evaluation. See what Parasoft Service Virtualization can do for your company.

Disclosure of Material Connection: I received one or more of the products or services mentioned above for free in the hope that I would mention it on my blog. Regardless, I only recommend products or services I use personally and believe my readers will enjoy. I am disclosing this in accordance with the

Share this
06 Sep

Protractor Testing Tool

Setup

Use npm to install Protractor globally with:

npm install -g protractor

This will install two command line tools, protractor and webdriver-manager. Try running protractor --version to make sure it’s working.

The webdriver-manager is a helper tool to easily get an instance of a Selenium Server running. Use it to download the necessary binaries with:

webdriver-manager update

Now start up a server with:

webdriver-manager start

This will start up a Selenium Server and will output a bunch of info logs. Your Protractor test will send requests to this server to control a local browser. You can see information about the status of the server at http://localhost:4444/wd/hub.

Write a test

Open a new command line or terminal window and create a clean folder for testing.

Protractor needs two files to run, a spec file and a configuration file.

Let’s start with a simple test that navigates to the todo list example in the AngularJS website and adds a new todo item to the list.

Copy the following into todo-spec.js:

describe('angularjs homepage todo list', function() {
  it('should add a todo', function() {
    browser.get('https://angularjs.org');

    element(by.model('todoList.todoText')).sendKeys('write first protractor test');
    element(by.css('[value="add"]')).click();

    var todoList = element.all(by.repeater('todo in todoList.todos'));
    expect(todoList.count()).toEqual(3);
    expect(todoList.get(2).getText()).toEqual('write first protractor test');

    // You wrote your first test, cross it off the list
    todoList.get(2).element(by.css('input')).click();
    var completedAmount = element.all(by.css('.done-true'));
    expect(completedAmount.count()).toEqual(2);
  });
});

The describe and it syntax is from the Jasmine framework. browser is a global created by Protractor, which is used for browser-level commands such as navigation with browser.get.

Configuration

Now create the configuration file. Copy the following into conf.js:

exports.config = {
  seleniumAddress: 'http://localhost:4444/wd/hub',
  specs: ['todo-spec.js']
};

This configuration tells Protractor where your test files (specs) are, and where to talk to your Selenium Server (seleniumAddress). It will use the defaults for all other configuration. Chrome is the default browser.

Run the test

Now run the test with:

protractor conf.js

You should see a Chrome browser window open up and navigate to the todo list in the AngularJS page, then close itself (this should be very fast!). The test output should be 1 test, 3 assertions, 0 failures. Congratulations, you’ve run your first Protractor test!

Share this
06 Sep

New Relic

Getting Started With New Relic in 30 Minutes

 

This post is part of a series called Performance Monitoring With New Relic.

5 Reasons Why New Relic Is a Developer’s Best Friend

I remember working on a Rails app a few years ago and someone floated the idea of using this new service that had appeared on the scene. It was called New Relic and they were promising to give you more insight into the performance of your Rails app, than you ever could get before. We gave it a try and it was impressive, more importantly it was something the Ruby web development ecosystem truly needed.

Sponsored Content

This content was commissioned by New Relic and was written and/or edited by the Tuts+ team. Our aim with sponsored content is to publish relevant and objective tutorials, case studies, and inspirational interviews that offer genuine educational value to our readers and enable us to fund the creation of more useful content.

Fast forward to now and you’d be hard-pressed to find a Ruby web application that doesn’t have New Relic hooked in. New Relic as a company has continued to provide tools to monitor your Ruby apps, but they’ve also branched out into a number of other languages such as JavaPython and even .Net. But of course as the number of features you provide grows so does the complexity and the amount of documentation out there. It becomes hard to figure out where to start especially if you’re not yet an expert.

Today I thought we could go back to the roots of New Relic and look at how we can get started with the service to monitor a Rails application.

A Basic Rails App

In order to use New Relic we need something to monitor, so let’s set up a basic ‘Hello World’ Rails app.

The app we create will live under ~/projects/tmp/newrelic, and will be called newrelic_rails1. I assume you already have Rails installed:

1

2

3

cd ~/projects/tmp/newrelic

rails new newrelic_rails1

cd newrelic_rails1

There isn’t much for us to do to create our ‘Hello World’ app. We need a new controller:

1 rails g controller hello

Now we just need a route, we will get the root route of the application to use our controller. We also need a view, with the words ‘Hello World’. Given all this, our config/routes.rb should look like this:

1

2

3

NewrelicRails1::Application.routes.draw do

root ‘hello#index’

end

Our controller (app/controller/hello_controller.rb), will be as follows:

1

2

3

4

class HelloController > ApplicationController

def index

end

end

And our view (app/views/hello/index.html.erb), will be similar to:

1 <h1>Hello World!</h1>

We can now start up our development server:

1 rails s

When we curl localhost:3000, we get:

1

2

3

4

5

6

7

<!DOCTYPE html>

<html>

<body>

<h1>Hello World!</h1>

</body>

</html>

Everything is working!

Hooking in New Relic

With Ruby it’s very simple. We add a gem to our Gemfile, run a bundle install, drop a config file into the config folder and we have all we need. In fact, New Relic is pretty good at guiding you through this. All you need to do is log in to your account and if you haven’t deployed a New Relic agent before, it’s pretty obvious what to do:

Firstly, we install the New Relic agent gem by adding it to our Gemfile, as per the instructions:

Our Gemfile will now look like this:

01

02

03

04

05

06

07

08

09

10

11

12

13

14

15

16

source ‘https://rubygems.org

 

gem ‘rails’, ‘4.0.0’

gem ‘sqlite3’

gem ‘sass-rails’, ‘~> 4.0.0’

gem ‘uglifier’, ‘>= 1.3.0’

gem ‘coffee-rails’, ‘~> 4.0.0’

gem ‘jquery-rails’

gem ‘turbolinks’

gem ‘jbuilder’, ‘~> 1.2’

 

group :doc do

gem ‘sdoc’, require: false

end

 

gem ‘newrelic_rpm’

Whenever we add anything to the Gemfile we need to run:

1 bundle install

We also need a newrelic.yml, which you can download from New Relic:

It will come pre-configured with your license key. We need to put this file under config/newrelic.yml.

At this point if we ran our application in staging or production mode, we would already get data in our New Relic account. So let us do so:

1 RAILS_ENV=production rails s

This time when we curl localhost:3000, we get:

01

02

03

04

05

06

07

08

09

10

11

12

13

14

15

16

17

18

19

20

21

22

23

24

25

26

27

28

<!DOCTYPE html>

<html>

<head><script type=&quot;text/javascript&quot;>var NREUMQ=NREUMQ||[];NREUMQ.push([&quot;mark&quot;,&quot;firstbyte&quot;,new Date().getTime()]);</script>

<title>NewrelicRails1</title>

<link data-turbolinks-track=&quot;true&quot; href=&quot;/stylesheets/application.css&quot; media=&quot;all&quot; rel=&quot;stylesheet&quot; />

<script data-turbolinks-track=&quot;true&quot; src=&quot;/javascripts/application.js&quot;></script>

<meta content=&quot;authenticity_token&quot; name=&quot;csrf-param&quot; />

<meta content=&quot;i5rBPaG52bzM5Kn0SJwIbq6Qz0dG0KsIlcd8tb9vMV8=&quot; name=&quot;csrf-token&quot; />

</head>

<body>

 

<h1>Hello World!</h1>

 

<script type=&quot;text/javascript&quot;>if (typeof NREUMQ !== &quot;undefined&quot;) { if (!NREUMQ.f) { NREUMQ.f=function() {

NREUMQ.push([&quot;load&quot;,new Date().getTime()]);

var e=document.createElement(&quot;script&quot;);

e.type=&quot;text/javascript&quot;;

e.src=((&quot;http:&quot;===document.location.protocol)?&quot;http:&quot;:&quot;https:&quot;) + &quot;//&quot; +

&quot;js-agent.newrelic.com/nr-100.js&quot;;

document.body.appendChild(e);

if(NREUMQ.a)NREUMQ.a();

};

NREUMQ.a=window.onload;window.onload=NREUMQ.f;

};

NREUMQ.push([&quot;nrfj&quot;,&quot;beacon-3.newrelic.com&quot;,&quot;b9119aa82e&quot;,&quot;2507356&quot;,&quot;cglYTRENCF4ERBtZB10KWRYKDABXGQ==&quot;,0,21,new Date().getTime(),&quot;&quot;,&quot;&quot;,&quot;&quot;,&quot;&quot;,&quot;&quot;]);}</script>

 

<p></body>

</html>

There is a bunch of JavaScript that got inserted into our pages so that New Relic can monitor browser time. This is one way we can tell that our New Relic integration is working. But it is not the only way, New Relic also creates a log file:

01

02

03

04

05

06

07

08

09

10

11

12

13

14

15

16

17

18

19

% cat log/newrelic_agent.log

 

Logfile created on 2013-09-22 16:23:13 +1000 by logger.rb/36483

[09/22/13 16:23:13 +1000 skorks-envato (12424)] INFO : Starting the New Relic agent in &quot;production&quot; environment.

[09/22/13 16:23:13 +1000 skorks-envato (12424)] INFO : To prevent agent startup add a NEWRELIC_ENABLE=false environment variable or modify the &quot;production&quot; section of your newrelic.yml.

[09/22/13 16:23:13 +1000 skorks-envato (12424)] INFO : Reading configuration from config/newrelic.yml

[09/22/13 16:23:13 +1000 skorks-envato (12424)] INFO : Enabling the Request Sampler.

[09/22/13 16:23:13 +1000 skorks-envato (12424)] INFO : Environment: production

[09/22/13 16:23:13 +1000 skorks-envato (12424)] INFO : Dispatcher: webrick

[09/22/13 16:23:13 +1000 skorks-envato (12424)] INFO : Application: My Application

[09/22/13 16:23:13 +1000 skorks-envato (12424)] INFO : Installing ActiveRecord 4 instrumentation

[09/22/13 16:23:13 +1000 skorks-envato (12424)] INFO : Installing Net instrumentation

[09/22/13 16:23:13 +1000 skorks-envato (12424)] INFO : Installing deferred Rack instrumentation

[09/22/13 16:23:13 +1000 skorks-envato (12424)] INFO : Installing Rails 4 Controller instrumentation

[09/22/13 16:23:13 +1000 skorks-envato (12424)] INFO : Installing Rails 4 view instrumentation

[09/22/13 16:23:13 +1000 skorks-envato (12424)] INFO : Installing Rails4 Error instrumentation

[09/22/13 16:23:13 +1000 skorks-envato (12424)] INFO : Finished instrumentation

[09/22/13 16:23:13 +1000 skorks-envato (12424)] INFO : Doing deferred dependency-detection before Rack startup

[09/22/13 16:23:16 +1000 skorks-envato (12424)] INFO : Reporting to: https://rpm.newrelic.com/accounts/303380/applications/2507356

We can also check our New Relic account to make sure a new application has appeared for monitoring:

There are however a few things that are not so nice:

  • Our application is named ‘My Application’
  • We accepted all the default configuration values, which may not suit our app
  • We had to launch our server in production mode (which is only possible cause it’s a brand new app that doesn’t rely on any external infrastructure)

So let us look at our newrelic.yml file in a little bit more detail to see how we can monitor our app performance exactly the way we want it.

Diving in to New Relic Configuration

First of all, the New Relic configuration file is extremely well commented and I encourage you to read the comments for the various configuration parameters to understand what all of them do.

Secondly, New Relic configuration is environment aware, and configuration for all environments is defined in the one newrelic.yml file, this is very similar to, how the Rails database.yml file works. We define a bunch of common configuration values and then override the relevant ones in the specific environment blocks e.g.:

01

02

03

04

05

06

07

08

09

10

11

12

13

14

15

16

17

18

19

20

21

22

common: &amp;default_settings

license_key: ‘<your licence key>’

app_name: My Application

monitor_mode: true

 

 

development:

<<: *default_settings

monitor_mode: false

 

test:

<<: *default_settings

monitor_mode: false

 

production:

<<: *default_settings

monitor_mode: true

 

staging:

<<: *default_settings

monitor_mode: true

We can instantly begin to see how we can fix some of the points that we raised above. If we don’t want to have to launch our app in production mode while we’re tweaking our configuration, all we have to do is enable monitoring in development mode (we will need to remember to switch this off when we’re happy with our configuration as we don’t want development data cluttering up our New Relic account).

1

2

3

development:

<<: *default_settings

monitor_mode: true

We should also override our application name for every environment that we have, to make sure they’re monitored separately and the application name makes sense:

01

02

03

04

05

06

07

08

09

10

11

12

13

14

15

16

17

18

19

20

21

22

23

24

25

26

common: &amp;default_settings

license_key: ‘<your licence key>’

app_name: newrelic_rails1

monitor_mode: true

 

 

development:

<<: *default_settings

monitor_mode: true

app_name: newrelic_rails1 (Development)

 

test:

<<: *default_settings

monitor_mode: false

app_name: newrelic_rails1 (Test)

 

production:

<<: *default_settings

monitor_mode: true

app_name: newrelic_rails1 (Production)

 

staging:

<<: *default_settings

monitor_mode: true

app_name: newrelic_rails1 (Staging)

With just those configuration tweaks, when we start our server in development mode and curl localhost:3000:

We’re now monitoring our application in development mode and our app name is what we expect. If your application is saying that it’s not receiving any data, give it a minute, it takes a little while for the data to start coming through.

The next most interesting (and often the most confusing) configuration value is the Apdex T-value. Unlike most of the other configuration parameters, this value does not live in the newrelic.yml file, but is instead found in the settings for the application within New Relic:

If you want to tweak your Apdex T-value you have to do it here, but what is this parameter and what is the right value to put in it? Well, New Relic explains it in the following way:

Your application’s Apdex T-value is set to 0.5 seconds. That means requests responding in less than 0.5 seconds are satisfying (s), responding between 0.5 seconds and 2.0 seconds are tolerating (t), and responding in more than 2.0 seconds are frustrating (f).

Essentially, New Relic uses the Apdex value to gauge the health of your application as far as performance is concerned, so if many of the requests that are monitored by New Relic take longer than your Apdex value, New Relic will consider your application to be performing poorly and if you’ve set up alerts, will notify you of the fact. Basically, you have to figure out, how fast you want each server request to be fulfilled by your application, so if you’re OK with a backend request taking two seconds, you can set your Apdex value to 2.0, but if you need a response to be returned within 100ms then you should set your Apdex value to 0.1.

If you have a new application you may set the Apdex value to the performance you desire from your application. If your app is an existing one, you may have some metrics regarding how fast it is/should be performing, and you can be guided by that. All requests which are fulfilled by the server in less than the Apdex T-value will be considered by New Relic to be fine. All requests fulfilled within Apdex * 4 seconds will be considered tolerating (i.e. users can tolerate it). All responses that take longer than Apdex * 4 will be considered frustrating (frustrated users don’t tend to stick around). So, set your Apdex T-value in such a way that you actually get useful information out of it, the actual value depends on your domain and what you want to achieve (in terms of performance), there is no right or wrong answer.

We will set our Apdex T-value to 100ms (0.1), since all we have is a ‘Hello World’ app, and it should be able to return a response very quickly (even in development mode).

Even More New Relic Configuration

It was a little funny that most of the configuration comes from the newrelic.yml file, but the Apdex T-value is in the application settings, so New Relic now allows you to move all the configuration values from the YAML file into New Relic:

The advantage of this is that you don’t have to redeploy every time you want to tweak your configuration values, so it is definitely something worth considering. We will stick with the YAML file for now.

So what are some of the other useful New Relic parameters we should know about?

Well, there is a set of parameters dealing with the New Relic agent log file:

1

2

3

log_level: info

log_file_path: ‘log’

log_file_name: ‘newrelic_agent.log’

These have sensible defaults, but if we want the log file to go to a specific place or if we want to see more or less info in the file, we can easily control this. Since we’re just setting up New Relic we will set the log level to debug, to make sure we don’t miss any important information (when we deploy we may want to set it to warn, or even error).

We now get a wealth of information in the log file, which (if read carefully) can give us a lot of insights into how New Relic works:

01

02

03

04

05

06

07

08

09

10

11

12

13

14

15

16

17

18

19

20

21

22

23

24

25

26

27

28

29

30

31

32

33

34

35

36

37

38

39

40

41

42

43

44

45

46

47

48

49

50

51

52

53

54

55

56

57

58

59

60

61

62

63

64

65

66

67

68

69

70

% cat log/newrelic_agent.log</p>

 

[09/22/13 17:23:39 +1000 skorks-envato (12925)] INFO : Starting the New Relic agent in &quot;development&quot; environment.

[09/22/13 17:23:39 +1000 skorks-envato (12925)] INFO : To prevent agent startup add a NEWRELIC_ENABLE=false environment variable or modify the &quot;development&quot; section of your newrelic.yml.

[09/22/13 17:23:39 +1000 skorks-envato (12925)] INFO : Reading configuration from config/newrelic.yml

[09/22/13 17:23:39 +1000 skorks-envato (12925)] DEBUG : Not in Rake environment so skipping blacklisted_rake_tasks check: uninitialized constant Rake

[09/22/13 17:23:39 +1000 skorks-envato (12925)] DEBUG : Updating config (add) from NewRelic::Agent::Configuration::YamlSource. Results:

[09/22/13 17:23:39 +1000 skorks-envato (12925)] DEBUG : {…}

[09/22/13 17:23:39 +1000 skorks-envato (12925)] DEBUG : Not in Rake environment so skipping blacklisted_rake_tasks check: uninitialized constant Rake

[09/22/13 17:23:39 +1000 skorks-envato (12925)] DEBUG : Updating config (add) from NewRelic::Agent::Configuration::ManualSource. Results:

[09/22/13 17:23:39 +1000 skorks-envato (12925)] DEBUG : {…}

[09/22/13 17:23:39 +1000 skorks-envato (12925)] DEBUG : Not in Rake environment so skipping blacklisted_rake_tasks check: uninitialized constant Rake

[09/22/13 17:23:39 +1000 skorks-envato (12925)] DEBUG : Installed New Relic Browser Monitoring middleware

[09/22/13 17:23:39 +1000 skorks-envato (12925)] DEBUG : Installed New Relic Agent Hooks middleware

[09/22/13 17:23:39 +1000 skorks-envato (12925)] DEBUG : Agent is configured to use SSL

[09/22/13 17:23:39 +1000 skorks-envato (12925)] DEBUG : Using JSON marshaller

[09/22/13 17:23:39 +1000 skorks-envato (12925)] DEBUG : Transaction tracing threshold is 2.0 seconds.

[09/22/13 17:23:39 +1000 skorks-envato (12925)] DEBUG : Ignoring errors of type ‘ActionController::RoutingError’

[09/22/13 17:23:39 +1000 skorks-envato (12925)] DEBUG : Ignoring errors of type ‘Sinatra::NotFound’

[09/22/13 17:23:39 +1000 skorks-envato (12925)] DEBUG : Errors will be sent to the New Relic service.

[09/22/13 17:23:39 +1000 skorks-envato (12925)] DEBUG : Ignoring errors of type ‘ActionController::RoutingError’

[09/22/13 17:23:39 +1000 skorks-envato (12925)] DEBUG : Ignoring errors of type ‘Sinatra::NotFound’

[09/22/13 17:23:39 +1000 skorks-envato (12925)] DEBUG : RequestSampler max_samples set to 1200

[09/22/13 17:23:39 +1000 skorks-envato (12925)] DEBUG : Resetting RequestSampler

[09/22/13 17:23:39 +1000 skorks-envato (12925)] INFO : Enabling the Request Sampler.

[09/22/13 17:23:39 +1000 skorks-envato (12925)] INFO : Environment: development

[09/22/13 17:23:39 +1000 skorks-envato (12925)] INFO : Dispatcher: webrick

[09/22/13 17:23:39 +1000 skorks-envato (12925)] INFO : Application: newrelic_rails1 (Development)

[09/22/13 17:23:39 +1000 skorks-envato (12925)] DEBUG : EnvironmentReport failed to retrieve value for &quot;Plugin List&quot;: undefined method `plugins’ for #<Rails::Application::Configuration:0x007fb232401a00>

[09/22/13 17:23:39 +1000 skorks-envato (12925)] DEBUG : EnvironmentReport failed to retrieve value for &quot;JRuby version&quot;: uninitialized constant NewRelic::EnvironmentReport::JRUBY_VERSION

[09/22/13 17:23:39 +1000 skorks-envato (12925)] DEBUG : EnvironmentReport failed to retrieve value for &quot;Java VM version&quot;: uninitialized constant NewRelic::EnvironmentReport::ENV_JAVA

[09/22/13 17:23:39 +1000 skorks-envato (12925)] DEBUG : EnvironmentReport ignoring value for &quot;Rails threadsafe&quot; which came back falsey: nil

[09/22/13 17:23:39 +1000 skorks-envato (12925)] DEBUG : Creating Ruby Agent worker thread.

[09/22/13 17:23:39 +1000 skorks-envato (12925)] DEBUG : Creating New Relic thread: Worker Loop

[09/22/13 17:23:39 +1000 skorks-envato (12925)] DEBUG : New Relic Ruby Agent 3.6.7.152 Initialized: pid = 12925

[09/22/13 17:23:39 +1000 skorks-envato (12925)] DEBUG : Connecting Process to New Relic: bin/rails

[09/22/13 17:23:39 +1000 skorks-envato (12925)] DEBUG : Not in Rake environment so skipping blacklisted_rake_tasks check: uninitialized constant Rake

[09/22/13 17:23:39 +1000 skorks-envato (12925)] DEBUG : Created net/http handle to collector.newrelic.com:443

[09/22/13 17:23:39 +1000 skorks-envato (12925)] DEBUG : Sending request to collector.newrelic.com:443/agent_listener/12/1f69cbd2a641bde79bdb5eb4c86a0ab32360e1f8/get_redirect_host?marshal_format=json

[09/22/13 17:23:39 +1000 skorks-envato (12925)] INFO : Installing ActiveRecord 4 instrumentation

[09/22/13 17:23:39 +1000 skorks-envato (12925)] INFO : Installing Net instrumentation

[09/22/13 17:23:39 +1000 skorks-envato (12925)] INFO : Installing deferred Rack instrumentation

[09/22/13 17:23:39 +1000 skorks-envato (12925)] INFO : Installing Rails 4 Controller instrumentation

[09/22/13 17:23:39 +1000 skorks-envato (12925)] INFO : Installing Rails 4 view instrumentation

[09/22/13 17:23:39 +1000 skorks-envato (12925)] INFO : Installing Rails4 Error instrumentation

[09/22/13 17:23:39 +1000 skorks-envato (12925)] INFO : Finished instrumentation

[09/22/13 17:23:39 +1000 skorks-envato (12925)] DEBUG : Registered NewRelic::Agent::Samplers::CpuSampler for harvest time sampling.

[09/22/13 17:23:39 +1000 skorks-envato (12925)] DEBUG : Registered NewRelic::Agent::Samplers::MemorySampler for harvest time sampling.

[09/22/13 17:23:39 +1000 skorks-envato (12925)] DEBUG : NewRelic::Agent::Samplers::ObjectSampler not supported on this platform.

[09/22/13 17:23:39 +1000 skorks-envato (12925)] DEBUG : NewRelic::Agent::Samplers::DelayedJobSampler not supported on this platform.

[09/22/13 17:23:39 +1000 skorks-envato (12925)] INFO : Doing deferred dependency-detection before Rack startup

[09/22/13 17:23:40 +1000 skorks-envato (12925)] DEBUG : Uncompressed content returned

[09/22/13 17:23:40 +1000 skorks-envato (12925)] DEBUG : Created net/http handle to collector-1.newrelic.com:443

[09/22/13 17:23:40 +1000 skorks-envato (12925)] DEBUG : Sending request to collector-1.newrelic.com:443/agent_listener/12/1f69cbd2a641bde79bdb5eb4c86a0ab32360e1f8/connect?marshal_format=json

[09/22/13 17:23:42 +1000 skorks-envato (12925)] DEBUG : Uncompressed content returned

[09/22/13 17:23:42 +1000 skorks-envato (12925)] DEBUG : Server provided config: {…}

[09/22/13 17:23:42 +1000 skorks-envato (12925)] DEBUG : Not in Rake environment so skipping blacklisted_rake_tasks check: uninitialized constant Rake

[09/22/13 17:23:42 +1000 skorks-envato (12925)] DEBUG : Updating config (add) from NewRelic::Agent::Configuration::ServerSource. Results:

[09/22/13 17:23:42 +1000 skorks-envato (12925)] DEBUG : {…}

[09/22/13 17:23:42 +1000 skorks-envato (12925)] DEBUG : Wiring up Cross Application Tracing to events after finished configuring

[09/22/13 17:23:42 +1000 skorks-envato (12925)] DEBUG : Connected to New Relic Service at collector-1.newrelic.com

[09/22/13 17:23:42 +1000 skorks-envato (12925)] DEBUG : Agent Run       = 575257565.

[09/22/13 17:23:42 +1000 skorks-envato (12925)] DEBUG : Connection data = {…}

[09/22/13 17:23:42 +1000 skorks-envato (12925)] INFO : Reporting to: https://rpm.newrelic.com/accounts/303380/applications/2507376

[09/22/13 17:23:42 +1000 skorks-envato (12925)] DEBUG : Browser timing header: &quot;<script type=\\&quot;text/javascript\\&quot;>var NREUMQ=NREUMQ||[];NREUMQ.push([\&quot;mark\&quot;,\&quot;firstbyte\&quot;,new Date().getTime()]);</script>&quot;

[09/22/13 17:23:42 +1000 skorks-envato (12925)] DEBUG : Browser timing static footer: &quot;if (!NREUMQ.f) { NREUMQ.f=function() {\nNREUMQ.push([\&quot;load\&quot;,new Date().getTime()]);\nvar e=document.createElement(\&quot;script\&quot;);\ne.type=\&quot;text/javascript\&quot;;\ne.src=((\&quot;http:\&quot;===document.location.protocol)?\&quot;http:\&quot;:\&quot;https:\&quot;) + \&quot;//\&quot; +\n  \&quot;js-agent.newrelic.com/nr-100.js\&quot;;\ndocument.body.appendChild(e);\nif(NREUMQ.a)NREUMQ.a();\n};\nNREUMQ.a=window.onload;window.onload=NREUMQ.f;\n};\n&quot;

[09/22/13 17:23:42 +1000 skorks-envato (12925)] DEBUG : Real User Monitoring is using JSONP protocol

[09/22/13 17:23:42 +1000 skorks-envato (12925)] DEBUG : Reporting performance data every 60 seconds.

[09/22/13 17:23:42 +1000 skorks-envato (12925)] DEBUG : Running worker loop

[09/22/13 17:23:50 +1000 skorks-envato (12925)] DEBUG : Attempting to insert RUM header at beginning of head.

For example we can see that:

  • We can switch off monitoring even if it’s switched on in the configuration file, by setting an environment variable NEWRELIC_ENABLE=false
  • We can see that New Relic inserts a bunch of Rack middleware
  • We’re using Webrick as our server, which is obviously in development mode, but in production it would be good to confirm that New Relic recognises the server that we’re using
  • New Relic is sending data to collector.newrelic.com:443
  • New Relic is sending data every 60 seconds
  • Real user monitoring is done via JSONP

Very useful information when you’re trying to figure out how things hang together.

Most of the other configuration parameters are pretty self explanatory e.g.:

1

2

3

browser_monitoring:

auto_instrument: true

capture_params: false

The only other one to possibly be aware of is:

1

2

transaction_tracer:

transaction_threshold: apdex_f

The transaction tracer captures detailed data about requests that take too long. The transaction threshold is normally a multiple (x4) of the Apdex value, but it is often useful to divorce these values from each other. You might be happy with an Apdex score of one second, but you may want to capture detailed data about requests that take 1.5 seconds or longer (instead of the four seconds or longer which would happen by default). So you can set this parameter separately:

1

2

transaction_tracer:

transaction_threshold: 1.5

The New Relic Developer Mode

One of the configuration values you may have noticed was:

1 developer_mode: true

This should only be switched on in development (if at all). In development mode, New Relic agent will store performance data about the last 100 requests in memory. You can look at this data at any time by hitting the /newrelic endpoint of your running application:

I hardly ever use it, but it’s there if you need it.

Notifying New Relic of Deployments

Whenever you’re working on the performance of your application, it’s always good to know if a particular deploy has had a positive or negative effect on performance. For this purpose, you can notify New Relic every time you perform a deploy. This way if performance degrades or improves, you’ll be able to see which deploy was the culprit. New Relic provides Capistrano hooks to do this, but I prefer the command line way:

1

2

% newrelic deployments -a ‘newrelic_rails1 (Development)’ -e ‘development’ -u ‘skorks’ -r ‘abc123’

Recorded deployment to ‘newrelic_rails1 (Development)’ (2013-09-22 18:19:13 +1000)

The key thing is to correctly supply the application name as configured in the newrelic.yml file.

We will get nice lines on the relevant New Relic graphs to indicate when a deployment occurred.

Conclusion

You now know a whole lot about how New Relic works and how to start using it to monitor a Rails application. But configuring things properly is only half the battle, what kind of metrics will New Relic actually capture for you? And how can you use them to improve the performance of your application? We will look at some of these in a subsequent article. For now, have a go at configuring New Relic for your Rails application (you’ll get a free T-shirt) and if you have any questions don’t forget to leave a comment.

 

Share this
22 Oct

© 2015 QA Programmer. All rights reserved.

Show Buttons
Hide Buttons