Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP

Home

ghermeto edited this page · 11 revisions
Clone this wiki locally

Rush

blitz.rush(options, callback)

var Blitz = require('blitz');

console.log('Starting Rush...');
new Blitz('<email>','<api-key>').rush({
    steps: [
        {url: 'http://your.cool.app'},
        {url: 'http://your.cool.ap/page1'}
    ],
    region: 'california',
    pattern: { intervals: [{start: 1, end: 10, duration: 30}]}
}).on('status', function (data) {
    process.stdout.write('.');
}).on('complete', function (data) {
    console.log('region: ' + data.region);
    console.log('duration: ' + data.duration);
    var steps = data.steps;
    for(var i in steps) {
        var step = steps[i];
        console.log("> Step " + i);
        console.log("\tstatus: " + step.response.status);
        console.log("\tduration: " + step.duration);
        console.log("\tconnect: " + step.connect);
    }
}).on('error', function (response) {
    console.log("error: " + response.error);    
    console.log("reason: " + response.reason);
});

Sprint

blitz.sprint(options, callback)

var Blitz = require('../blitz-node/lib/blitz.js');

console.log('Starting Sprint...');
new Blitz('<email>','<api-key>').sprint({
    steps: [
        {url: 'http://your.cool.app'},
        {url: 'http://your.cool.ap/page1'}
    ],
    region: 'california'
}).on('status', function (data) {
    process.stdout.write('.');
}).on('complete', function (data) {
    console.log('region: ' + data.region);
    console.log('duration: ' + data.duration);
    var steps = data.steps;
    for(var i in steps) {
        var step = steps[i];
        console.log("> Step " + i);
        console.log("\tstatus: " + step.response.status);
        console.log("\tduration: " + step.duration);
        console.log("\tconnect: " + step.connect);
    }
}).on('error', function (response) {
    console.log("error: " + response.error);    
    console.log("reason: " + response.reason);
});

Options object

{
  region: "california",
  pattern: {
    iterations: 1,
    intervals: [
      { iterations: 1, start: 100, end: 1000, duration: 60 },
      ...
    ]
  },
  steps: [
    {
      url: "http://my.cool.app/path?query#fragment",
      user-agent: "Mozilla some version",
      cookies: [ "cookie1=foo", "cookie2=blah" ],
      content: { data: [ "a=b", "c=d", "e=f" ] },
      referer: "http://my.cool.app/referring/page",
      headers: [ "h1: v1", "h2: v2" ],
      status: 200,
      timeout: 1000,
      user: "name:secret",
      ssl: "tlsv1",
      variables: {
        foo: { type: "list", entries: [ "1", "2", "3", "4" ] },
        bar: { type: "alpha", min: 4, max: 100 },
        baz: { type: "number", min: -100, max: 100 },
        meh: { type: "udid" }
      }
    },
    ... // additional steps here
  ]
}

Required:

Sprint

  • url key

Rush

  • url key
  • pattern key with at least 1 interval in the intervals array

Result Objects

Rush

{
    region: 'california',
    timeline: [
        {
            timestamp: '2011/07/20 00:00:00 +0000',
            duration: 0.0345,
            total: 100,
            hits: 80,
            errors: 10,
            timeouts: 10,
            volume: 100,
            txbytes: 10000,
            rxbytes: 4000,
            steps: [
                {
                     duration: 0.0345,
                     connect: 0.0123,
                     errors: 10,
                     timeouts: 10,
                     asserts: 0
                },
                ... // additional steps here
            ]
        },
        ...
    ]
}

Sprint

{
    region: 'california',
    duration: 0.3456,
    steps: [
        {
            duration: 0.3456,
            connect: 0.02345,
            request: {
                line: 'GET / HTTP/1.1 (...)',
                method: 'GET',
                url: 'http://example.com',
                headers: { 'content-type': 'text/html', ... },
                content: 'some utf8 string'
            },
            response: {
                line: '...',
                status: 302,
                message: 'response message',
                headers: { 'content-type': 'text/html', ... },
                content: 'some utf8 string'
            }
        },
        ... // additional steps here
    ]
}
Something went wrong with that request. Please try again.