TempoDB Time Series Database

This add-on is operated by TempoDB Inc

Database for storing & analyzing time series data from sensors and devices

TempoDB Time Series Database

Last Updated: 30 September 2014

This article is a work in progress, or documents a feature that is not yet released to all users. This article is unlisted. Only those with the link can access it.

Table of Contents

TempoDB is an add-on for time-series data storage and analysis.

Adding TempoDB to an application allows you to easily measure anything over time, store it all, and do instant analysis.

TempoDB is accessible via a ReST API and has supported client libraries for Java, Node.js, PHP, Python and Ruby. Full client list here.

Full API documentation here.

TempoDB Dashboard

Installing the add-on

TempoDB can be installed to a Heroku application via the CLI:

A list of all plans available can be found here.

$ heroku addons:add tempodb
-----> Adding tempodb to sharp-mountain-4005... done, v18 (free)

Once TempoDB has been added, 5 settings (TEMPODB_API_KEY, TEMPODB_API_SECRET, TEMPODB_API_HOST, TEMPODB_API_PORT, TEMPODB_API_SECURE) will be available in the app configuration. These settings contain the credentials for your TempoDB database. You can see your settings using the heroku config command.

$ heroku config | grep TEMPODB
TEMPODB_API_KEY     => your-api-key
TEMPODB_API_SECRET  => your-api-secret
TEMPODB_API_HOST    => api.tempo-db.com
TEMPODB_API_PORT    => 443
TEMPODB_API_SECURE  => True

After installing TempoDB, the application should be configured to fully integrate with the add-on.

Local development

Since the TempoDB add-on uses a few config variables, you’ll need to make them available in your local development environment. The easiest way to do this is to create a .env file in your application folder.

Copy the values from heroku config earlier into your .env file. Your local .env file should look like this:

$ cat .env
TEMPODB_API_KEY=your-api-key
TEMPODB_API_SECRET=your-api-secret
TEMPODB_API_HOST=api.tempo-db.com
TEMPODB_API_PORT=443
TEMPODB_API_SECURE=True

Using with Sinatra and Rails 3.x

Sinatra and Ruby on Rails applications will need to add the following entry into their Gemfile specifying the TempoDB client library.

gem 'tempodb'

Update application dependencies with bundler.

$ bundle install
Using daemons (1.1.8)
Using eventmachine (0.12.10)
Using json (1.6.5)
Using rack (1.4.1)
Using tilt (1.3.3)
Using sinatra (1.1.0)
Using tempodb (0.1.0)
Using thin (1.2.7)
Using bundler (1.0.22)

Below is a Sinatra code sample that shows creating a TempoDB client, performing a read of all series, and bulk writing in some speed values. A full example project can be found here.

require 'sinatra'
require 'tempodb'

get '/' do
  request_start = Time.now

  # setup the Tempo client
  api_key = ENV['TEMPODB_API_KEY']
  api_secret = ENV['TEMPODB_API_SECRET']
  api_host = ENV['TEMPODB_API_HOST']
  api_port = Integer(ENV['TEMPODB_API_PORT'])
  api_secure = ENV['TEMPODB_API_SECURE'] == "False" ? false : true

  client = TempoDB::Client.new( api_key, api_secret, api_host, api_port, api_secure )

  out = ""

  # read all series from TempoDB for user, and track how long it takes
  read_start = Time.now
  series = client.get_series()
  read_end = Time.now

  # build string of JSON representation of user series
  series.each{ |series| out += series.to_json + "<br/>"  }

  request_end = Time.now

  # write to TempoDB the page load speed, and series read speed
  client.write_bulk( Time.now, [ {'key'=>'heroku-page-load-speed', 'v'=>request_end-request_start}, {'key'=>'heroku-tempodb-read-speed', 'v'=>read_end-read_start} ] )
  out
end

Using with Django 1.x

Django applications will need to make sure that the python-tempodb client library is installed in the local environment.

pip install python-tempodb

Make sure to add it to requirements.txt

python-tempodb==0.5.0

Examples of using the Python client to read and write data to Tempo can be found here.

Python read example

Python write example

Python bulk write example

Using with Node.js

Node.js applications will need to include the tempodb client library in package.json, and run npm install locally.

{
  "name": "node-example",
  "version": "0.0.1",
  "dependencies": {
    "tempodb": ">= 0.4.0"
  }
}

Examples of using the Node.js client to read and write data to TempoDB can be found here.

Node.js read example

Node.js write example

Node.js bulk write example

Demos and examples

Integration examples can be found for each of the different clients here.

Ruby and Sinatra

Python

Node.js

Java

Dashboard

For more information on the features available within the TempoDB dashboard please see the API docs at tempo-db.com/api.

The TempoDB dashboard allows you to view your database, each of your series, and do basic plotting.

TempoDB Dashboard

The dashboard can be accessed via the CLI:

$ heroku addons:open tempodb
Opening tempodb for sharp-mountain-4005…

or by visiting the Heroku apps web interface and selecting the application in question. Select TempoDB from the Add-ons menu.

Tempo Add-ons Dropdown

Removing the add-on

TempoDB can be removed via the CLI.

This will destroy all associated data and cannot be undone!

$ heroku addons:remove tempodb
-----> Removing tempodb from sharp-mountain-4005... done, v20 (free)

Before removing TempoDB a data export can be performed by sending an email to export@tempo-db.com.

Support

All TempoDB support and runtime issues should be logged with Heroku Support at https://support.heroku.com. Any non-support related issues or product feedback is welcome at support@tempo-db.com.

Additional resources

Additional resources are available at: