Cloud Zone is brought to you in partnership with:

Treasure Data's Big Data as-a-Service cloud platform enables data-driven businesses to focus their precious development resources on their applications, not on mundane, time-consuming integration and operational tasks. Our pre-built, multi-tenancy cloud platform is already in use by over 50 customers worldwide and is managing more than 200 billion rows of data and processing 130,000 jobs per day. Discover how Treasure Data can help you focus on your core business and benefit from the fastest time-to-answer service available. Sadayuki is a DZone MVB and is not an employee of DZone and has posted 27 posts at DZone. You can read more from them at their website. View Full User Profile

The Simplest Way To Collect Application Data On Heroku

02.01.2013
| 3392 views |
  • submit to reddit

Curator's Note: The content of this article was originally written by Masa over at the Treasure Data  blog.

At Treasure Data, we constantly try to simplify how our customers collect and interact with their data.

Over the past several months, we reached out to two dozens or so customers and listened to their feedback. One pattern emerged: they spend a lot of time on data collection and wanted something simpler.

So, we rolled up our sleeves and built a feature to simplify data collection even more: from now on, our Heroku customers can store data on Treasure Data by just printing to stdout in a specified format.

Treasure Data's Heroku Log Drain Integration

The format is very simple:

@[db_name.table_name] json_in_one_line

e.g., if you wanted to store the event { "first_name": "Bob", "last_name": "Smith" } into the table users in the database service, you just write

@[service.users] { "first_name": "Bob", "last_name": "Smith" }

into stdout. Hence, in Ruby,

puts '@[service.users] { "first_name": "Bob", "last_name": "Smith" }'

in Java,

System.out.println("@[service.users] { \"first_name\": \"Bob\", \"last_name\": \"Smith\" }")

in PHP,

echo '@[service.users] { "first_name": "Bob", "last_name": "Smith" }'.PHP_EOL;

in Node.js,

process.stdout.stream('@[service.users] { "first_name": "Bob", "last_name": "Smith" }')

and so on.

As you noticed, this new interface is language agnostic: all languages let you print out to stdout out of the box, and that’s all you need to get started with Treasure Data on Heroku now.

So, if you are a Heroku user, just run

$ heroku addons:add treasure-data:nano

and start collecting data today.

Masa

Masa, the engineer who built this new feature, likes to bike everywhere, rain or shine.



Published at DZone with permission of Sadayuki Furuhashi, author and DZone MVB. (source)

(Note: Opinions expressed in this article and its replies are the opinions of their respective authors and not those of DZone, Inc.)