Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
280 commits
Select commit Hold shift + click to select a range
035624b
Split setInterval metrics out into their own lib
Apr 17, 2010
54cb903
More work to upgrade to 0.1.91 api
Apr 17, 2010
fba0e8b
Fix paperboy and ws to work with node v0.1.91
Apr 17, 2010
71a36ed
Add content-length to tracking pixel
Apr 18, 2010
a8828d0
Refactor in preparation for jspec
Apr 18, 2010
4e2d70f
Add some specs
Apr 18, 2010
bfba6e3
Add logic to detect is UI webserver is already running
Apr 18, 2010
a7e379e
Have to write a body when outputting 500 errors
Apr 18, 2010
b2f374e
Roll back to node v0.1.33 until ry fixes bug in node v0.1.91 http parser
Apr 19, 2010
a10ed81
Switch timestamp to integer for easier parsing in mongo
Apr 19, 2010
2d8f2f4
update readme
Apr 19, 2010
f1c3801
Allow local UI to use prod server
Apr 19, 2010
7a91ca3
Draw empty graph to start
Apr 19, 2010
b54f64f
Add date timestamps to graph
Apr 19, 2010
dfb7718
Add 'per second' to make graphs clearer
Apr 19, 2010
c671d9c
Auto-scale graphs
Apr 20, 2010
8fb8cb1
Combine sales graphs with sales images
Apr 20, 2010
657d6f7
Resort sales by view rate
Apr 20, 2010
6b75d92
Add values to individual sales
Apr 21, 2010
5941373
Add product_id parsing; store parsed values in mongo
Apr 21, 2010
9e18095
Add metrics logging to hummingbird; pass in the mongo db to hummingbi…
Apr 23, 2010
3e110a3
Stop hard-coding specific metrics into hummingbird
mnutt Apr 25, 2010
f8ed645
Move metrics out into their own files
mnutt Apr 25, 2010
85177dd
clean up class requiring
mnutt Apr 25, 2010
b47bafa
Forgot to change static asset dir
Apr 23, 2010
c6117a0
Change sales alignment to justified, below the cart adds canvas
Apr 25, 2010
24fefc1
Show scale change separator between old scale and new scale
Apr 25, 2010
7ae7838
Parse the data average as a float when sorting sales
bdotdub Apr 25, 2010
eaad5ca
Trying out gource log script
Apr 25, 2010
b521165
Better regex for determining url_key and product_id
Apr 25, 2010
86a992b
Merge commit '7ae7838a47bc3b3ee372c3c1a44bec5e36a56580'
Apr 26, 2010
55f410e
Switching back to pages/second for sales graphs; having different sca…
Apr 26, 2010
37d9dbd
Update readme
Apr 26, 2010
6c0db01
Freeze jspec libs
Apr 26, 2010
ce16fb7
Fix broken spec
Apr 26, 2010
c54567f
Merge commit 'origin/master' into bdotdub
bdotdub Apr 26, 2010
13f23af
Adding an aggregates page. Kind of really ugly right now, but just tr…
bdotdub Apr 26, 2010
3997051
Make sure we push limits on the MR set
bdotdub Apr 27, 2010
9987c8c
Show 1-second axis marks on the graph; when changing scale, don't sho…
Apr 27, 2010
1d038e4
Show upcoming sales as well as active sales
Apr 27, 2010
34facbc
Merge branch 'master' into aggregates
Apr 28, 2010
29e65b1
Only parseInt once
Apr 28, 2010
841080c
Easier way to compute beginning-of-day
Apr 28, 2010
6278309
Add metrics to mongo by minute instead of by metric interval
Apr 28, 2010
9836ca2
Switch metrics logging to single line mode
Apr 28, 2010
24346b0
Strip off url hash from url_keys
Apr 28, 2010
faaf033
Cleaner timestamps for metrics
Apr 28, 2010
eea67f5
css and copy tweaks
Apr 30, 2010
2d28a48
Add a weekly json feed
Apr 28, 2010
9c2c829
Weekly stats url now working at /week.json
Apr 30, 2010
40f4912
Limit days to 1 week; sort weekly results; work around bug in mapredu…
Apr 30, 2010
1e8aa30
Building out the weekly page
Apr 30, 2010
199a816
After weekly stats page has loaded, update the most recent entry cont…
May 1, 2010
e3b9360
css tweaks for ipad
May 1, 2010
32c305f
Removing unmatched div tag
bdotdub May 2, 2010
5ff1a45
Allowing weekly to pull from production
bdotdub May 2, 2010
e5ff24f
Check if a sale exists before adding it to the top sales for a day
bdotdub May 2, 2010
72bbe1d
Whitespace
bdotdub May 3, 2010
cba48fe
Switch from Float timestamps to Time. Need to run the migrations in …
May 4, 2010
0e03928
Still need to send datetimes as timestamps so that js can parse them
May 4, 2010
401495b
Change monitor port to 8888...will sort this out soon
May 4, 2010
84c3580
Since the timestamps coming back from the server are UTC, we have to …
bdotdub May 4, 2010
908e8f3
Add express framework
May 5, 2010
af0154d
Upgrade node-ws for node 0.1.92
May 5, 2010
f90d571
Add in express handlers
May 5, 2010
d4d115a
Fix sale_list json proxy
May 5, 2010
771a254
Remove proxy require
May 5, 2010
30118ec
Upgrade mongodb-native and paperboy to latest versions
May 5, 2010
61eba86
Add private site-specific settings dir
May 6, 2010
69d1bb6
Fix weekly view to use express
May 6, 2010
30b9839
Changing monitor port again, sorry (8888)
May 6, 2010
de8b47b
Breaking out the monitor into a standalone express app
bdotdub May 7, 2010
ac6ee7b
Updating the README as well as converting it to GHF markdown
bdotdub May 7, 2010
1e19ffa
Properly clone date so that timestamps aren't wrong
May 8, 2010
24b8d32
Fix sales metrics so that they're not accidentally reset
May 8, 2010
02cbad8
Simplify incrementing
May 8, 2010
e7e57c4
Reduce json output on the weekly page
May 8, 2010
71ac0dd
interval explanation
May 9, 2010
c9ab06e
Add node-microseconds for more granular profiling
May 9, 2010
23b603f
Refactor metrics to aggregate data in realtime with upserts rather th…
May 9, 2010
1489ea1
ignore backups dir; don't use private dir anymore
May 9, 2010
2d83b17
Capistrano deploy scripts
May 9, 2010
d9e61c2
Make websocket server configurable via url. Make server name configu…
May 9, 2010
dc11adf
Add license
May 9, 2010
2f2451f
Add ubuntu upstart scripts for reference
May 9, 2010
10ab998
Upgrade node-mongodb-native to use buffers
May 10, 2010
1954115
Use Buffer for serving tracking pixel
May 10, 2010
aebbd53
Fix cartAdds metric
May 10, 2010
56ed465
Typo in cartAdds
May 10, 2010
751a7cb
Adding regex for City url_keys
bdotdub May 10, 2010
1aa6e99
Refactor Hummingbird.WebSocket to be inheritable
bdotdub May 11, 2010
1fcb815
Set a lower bound on the graph axis
bdotdub May 11, 2010
31b5da6
Update the left scale only when the separator reaches it
bdotdub May 11, 2010
36c4b22
Converting to $(document).ready for consistency
bdotdub May 11, 2010
942f4fe
Renaming Hummingbird.WebSocket.Main to Hummingbird.WebSocket.Dashboard
bdotdub May 11, 2010
2a7f1c9
Adding referrer to tracking pixel
bdotdub May 11, 2010
bd9bfdf
Symlink app settings in capistrano
May 11, 2010
580399e
Add mongod upstart script
May 11, 2010
8a8f396
Sort weekly stats descending
May 11, 2010
2ed09f0
Remove some gilt-specific sale code
mnutt May 13, 2010
091d913
Adding install notes for older git submodule commands. closes #2
bdotdub May 17, 2010
139222f
Switch to miksago's node-websocket library; update tracking server to…
May 18, 2010
32a0977
Performance improvement: use a simpler querystring parser to increase…
May 20, 2010
c2186eb
Reset the metric data on server start so that it gets default values
May 20, 2010
75b17ba
Fix for bad requests with no querystring
May 20, 2010
00e53a5
Flash the axis when it changes scale
May 21, 2010
a1bee36
Update node-websocket-server to not crash app when clients disconnect…
May 21, 2010
eb70aa7
Upgrade node-websocket-server submodule to fix websocket failures
May 21, 2010
a775216
Remove old websocket library
May 21, 2010
bc32c26
Preliminary authentication; very very basic right now
May 21, 2010
10f3a0c
Update node.js version in readme
mnutt May 29, 2010
fb56f72
Passing the config to JSON.parse() as a string instead of a Buffer.
sir-pinecone Jun 27, 2010
87fe6af
Newer versions of node parse files into Buffer and not a string. Bein…
bdotdub Jun 29, 2010
2429308
updated .gitmodules to use http instead of git protocol
brianjriddle Aug 26, 2010
b5aeb00
updated express and node-mongodb-native submodules.
brianjriddle Aug 26, 2010
142c529
added instructions on building node-mongodb-native
brianjriddle Aug 26, 2010
3ce5efd
can now start monitor.js but nothing shows yet.
brianjriddle Aug 26, 2010
88d203b
migrate monitor.js to use latest express.
brianjriddle Aug 30, 2010
4e5ec12
updated express plugin.
brianjriddle Aug 30, 2010
12b7316
added an id to the page views canvas.
brianjriddle Aug 30, 2010
330aa8c
Fix things to work with newest version of express
mnutt Sep 3, 2010
a1edfb3
Upgrade server component to use latest versions; switch to socket.io …
mnutt Sep 7, 2010
c9049ca
Switch graph from canvas to just html elements
mnutt Sep 9, 2010
32fde80
Switch to plain html file and remove express
mnutt Oct 23, 2010
dfbbdd8
upgrade jspec
mnutt Oct 23, 2010
f6ac93d
remove all unused submodules
mnutt Oct 23, 2010
f42b6ef
remove some unused libs
mnutt Oct 23, 2010
b4aef7b
update readme
mnutt Oct 23, 2010
f9b7601
Create widgets which are bound to specific properties on the websocke…
mnutt Oct 24, 2010
8bfe8a0
Convert analytics to Graph widget; de-minify jquery for now
mnutt Oct 24, 2010
084df3b
clean up analytics widget
mnutt Oct 24, 2010
9bf10cc
Try to make examples a bit clearer; allow customizable height on grap…
mnutt Oct 24, 2010
e338666
Move average stuff out of graph.js and into base; now any widgets can…
mnutt Oct 24, 2010
1f264c3
favicon to shut webkit up
mnutt Oct 24, 2010
ac8a6eb
scale down to 50 to start
mnutt Oct 24, 2010
21876e3
Update sample config; add customization notes to the readme, simplify…
mnutt Oct 27, 2010
b02fddc
add map widget example
mnutt Oct 27, 2010
3163a8e
listen on all interfaces
mnutt Oct 27, 2010
9eb4d08
Modified server.js and the sample app config file to support specifyi…
caphrim007 Oct 27, 2010
70f25aa
Catch errors on geoip lookups
mnutt Oct 28, 2010
f042527
Make firefox happy by not redefining console
mnutt Oct 28, 2010
23257f4
add location cache to make sure we don't hit ipinfodb too much
mnutt Oct 28, 2010
5852dd0
Fix label background on city names, add raphael
mnutt Oct 30, 2010
dc0f08c
just kidding, remove raphael. the integration with polymaps looks co…
mnutt Oct 30, 2010
acceb66
forgot to revert svg container
mnutt Oct 30, 2010
260f44c
Remove logging statement; fix bug in geoip caching
mnutt Oct 31, 2010
42e0392
Upgrade to jquery 1.4.3
mnutt Oct 31, 2010
7132ad0
If metric has ignoreOnEmpty prop, don't broadcast its data if no hits…
mnutt Oct 31, 2010
fdd12f5
Use jquery for svg animation; restore polymaps' Point type; fix jquer…
mnutt Oct 31, 2010
73e7070
switch cloudmade map styles
mnutt Nov 2, 2010
acdaf73
Upgrade to socket.io 0.6
mnutt Nov 4, 2010
394c8aa
Fix map fullscreen bug; tweak map labels
mnutt Nov 4, 2010
143f4cc
Merge branch 'master', remote branch 'mnutt/master'
Nov 18, 2010
99db006
Merge branch 'master', remote branch 'mnutt/master'
brianjriddle Nov 18, 2010
c132010
using npm to manage dependencies instead of submodules.
brianjriddle Nov 18, 2010
3d69f77
Merge branch 'master' of github.com:brianjriddle/hummingbird
Nov 19, 2010
1b97c35
Since we are using npm need to bump the version of node up to 0.2.0
Nov 19, 2010
ff233f5
fix for tests to run don't pass yet though.
Nov 19, 2010
99851b0
readded update submodules for public/socket.io
Nov 19, 2010
0c2cc41
upgrade socket.io to latest
mnutt Jan 21, 2011
a29bd26
fix css bug when switching from smaller axis to larger
mnutt Jan 21, 2011
2a64eb9
merge in master
mnutt Jan 21, 2011
27bfcac
ignore bundled npm packages
mnutt Jan 21, 2011
a326d72
Switch to use socket.io's CDN so we can drop the submodule dependency
mnutt Jan 21, 2011
6417c37
Remove submodule instructions from readme
mnutt Jan 21, 2011
8369789
switch back to serving socket.io locally; update readme
mnutt Jan 21, 2011
3216017
switch to geoip module instead of using an external service
mnutt Jan 22, 2011
b02e3ff
Update readme for geoip
mnutt Jan 22, 2011
2593559
upgrade packages to latest
mnutt Mar 19, 2011
06cdbe9
recenter map
mnutt Mar 19, 2011
fcb1a95
Enables hummingbird to be used behind a proxy server (nginx, for exam…
Apr 14, 2011
7da2e5d
fix graph for average
mnutt Apr 17, 2011
e3e85c8
refactor insertData into its own function in preparation for udp support
mnutt Apr 15, 2011
d3eea95
add support for receiving stats via udp
mnutt Apr 15, 2011
b68b7e2
upgrade polymaps
mnutt Apr 17, 2011
0418c89
bumps node-static version
robertjwhitney May 17, 2011
b233cbd
Merge pull request #26 from robertjwhitney/master
mnutt May 17, 2011
167a873
clean up the api between frontend and backend
mnutt May 21, 2011
67d809c
remove console.log; don't get into an infinite loop
mnutt May 21, 2011
fdb97bb
Converted config to a module. Freeing the dependency on fs and the us…
Jun 15, 2011
023799b
using the config module.
Jun 15, 2011
ad879d7
missed reference in hummingbird.js
Jun 15, 2011
9e2750b
Merge pull request #27 from thurmda/master
mnutt Jun 16, 2011
c2e941a
no more require.paths
mnutt Sep 7, 2011
5c2d500
upgrade mongodb to fix require.paths issue
mnutt Sep 7, 2011
52efc55
upgrade packages
mnutt Sep 7, 2011
6c81795
upgrade socket.io to 0.8.4; rework client side pubsub
mnutt Sep 7, 2011
5b23194
update cap deploy script
mnutt Sep 7, 2011
edfaec8
extract out our polymaps changes
mnutt Oct 28, 2011
1901cda
improvements in map markers
mnutt Oct 28, 2011
06cbe6e
fix minuteData reporting
mnutt Oct 28, 2011
8a2da13
show different color markers for different events
mnutt Oct 28, 2011
00b0769
check to make sure geoip returned a location
mnutt Oct 28, 2011
792ed59
Updated Dependancies
thinkroth Nov 9, 2011
ac6ab27
Merge pull request #37 from thinkroth/master
mnutt Nov 14, 2011
c316151
add package.json options for nodejitsu
mnutt Dec 1, 2011
338f379
revert back to geoip-0.3.4 for easier linux compatibility
mnutt Dec 1, 2011
05a036e
switch WS server to dashboard
mnutt Jan 21, 2012
5267069
split up hummingbird into a tracker and a dashboard; clean up metric api
mnutt Sep 13, 2012
d9a3b8f
update readme
mnutt Sep 13, 2012
044fc36
update index.html to modify cart add request
mnutt Sep 13, 2012
fe3c22a
make metric loading asynchronous
mnutt Sep 14, 2012
a69eea3
don't require plugins to call this.hasChanged = true
mnutt Sep 14, 2012
e36075f
add hummingbird demo domain for nodejitsu
mnutt Sep 14, 2012
6fe2075
absolutely positioned elements; cooler greys
mnutt Sep 17, 2012
cf94968
upgrade socket.io
mnutt Sep 19, 2012
f41b0c2
nicer looking map markers
mnutt Sep 19, 2012
043834b
use d3.js for map markers
mnutt Sep 19, 2012
b91976a
send region and country in location metric
mnutt Sep 19, 2012
a8999b6
clean up graph code
mnutt Sep 19, 2012
c1fc605
styling header
mnutt Sep 19, 2012
bb81d68
make cart_add button show cart_add on the map
mnutt Sep 19, 2012
dc1285c
full size map in ff
mnutt Sep 19, 2012
039b777
remove tracking pixel gif
mnutt Sep 19, 2012
03a33f3
add demo mode for demo.hummingbirdstats.com
mnutt Sep 19, 2012
504ff6f
protect against no headers being sent to tracker
mnutt Sep 19, 2012
3c5ad4c
tweaking the green
mnutt Sep 19, 2012
03c8afd
upgrade geoip to support iso-8859-1 city names
mnutt Sep 19, 2012
8715f6f
don't show markers with no city
mnutt Sep 19, 2012
ee724b5
move sample traffic log from log/ to data/ for nodejitsu
mnutt Sep 19, 2012
559c523
clean up head and switch to html5 doctype
mnutt Sep 20, 2012
ec1424f
main background
mnutt Sep 23, 2012
23ad1a2
fix zoomRange for retina displays
mnutt Sep 23, 2012
bdc0f1b
add legend to map
mnutt Sep 23, 2012
d1277c2
don't use reserved static keyword
mnutt Oct 5, 2012
a0891ca
use relative asset paths to assist in using frontend under a subdirec…
mnutt Sep 25, 2012
3452bf1
remove protocol from map tiles
mnutt Oct 5, 2012
e32cb75
Updated UDP tracker to work.
Nov 26, 2012
4ad577d
Merge pull request #42 from markwillis82/master
mnutt Dec 7, 2012
a6bc04b
clean up sample client js code and improve README
mnutt Dec 23, 2012
10cfa8c
make sure test buttons don't get cached on firefox
mnutt Jan 19, 2013
a70e39e
Fixed an array keying error in the 'hummingbird.js' sample js tracker…
ochronus Feb 13, 2013
8a3a973
Merge pull request #48 from ochronus/fix_sample_js_tracker
mnutt Mar 7, 2013
7f3cb49
update geoip module to partially fix a memory leak
mnutt Mar 10, 2013
c6636b7
switch geoip to fork that fixes the memory leak. fixes #50
mnutt Mar 10, 2013
48fc93f
ignore history data
mnutt Mar 21, 2013
83980fd
raw widget
mnutt Apr 17, 2011
9a9ce7b
add list of contributors
mnutt Mar 26, 2013
0256789
merge dannyakakong's fixes for zoom level and configuration
mnutt Mar 26, 2013
5eccfcb
add dannyakakong as contributor
mnutt Mar 26, 2013
0404530
gitignore config and automatically copy from the sample if it doesn't…
mnutt Mar 26, 2013
eecf408
User new geoip
xinbenlv Jul 11, 2013
3044974
Merge pull request #53 from xinbenlv/master
mnutt Dec 4, 2013
1a7133c
allow starting with 'npm start'
mnutt Dec 4, 2013
5d6b24b
upgrade geoip to latest version
mnutt Dec 4, 2013
72d90e0
update readme with node requirements and contributors
mnutt Dec 4, 2013
ae91d03
Checked out https://github.com/mnutt/hummingbird and deleted old usel…
Apr 14, 2014
a0d16d1
Merge remote-tracking branch 'sourcenew/master' into HEAD
Apr 14, 2014
d4d46ae
chore(package): update dependencies
greenkeeper[bot] Nov 8, 2016
d765d29
Merge pull request #1 from frank-dspeed/greenkeeper/update-all
frank-dspeed Nov 8, 2016
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
*.swp
/backups
/config/config.js
/node_modules
/GeoLiteCity.dat
/data/*.json
3 changes: 3 additions & 0 deletions .gitmodules
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
[submodule "public/socket.io"]
path = public/socket.io
url = http://github.com/LearnBoost/Socket.IO.git
4 changes: 4 additions & 0 deletions Capfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
load 'deploy' if respond_to?(:namespace) # cap2 differentiator
Dir['vendor/plugins/*/recipes/*.rb'].each { |plugin| load(plugin) }

load 'config/deploy' # remove this line to skip loading any of the default tasks
24 changes: 24 additions & 0 deletions LICENSE.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
The MIT License
===============

Copyright (c) 2010 Michael Nutt <michael@nuttnet.net> and others.

Permission is hereby granted, free of charge, to any person obtaining
a copy of this software and associated documentation files (the
'Software'), to deal in the Software without restriction, including
without limitation the rights to use, copy, modify, merge, publish,
distribute, sublicense, and/or sell copies of the Software, and to
permit persons to whom the Software is furnished to do so, subject to
the following conditions:

The above copyright notice and this permission notice shall be
included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND,
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

6 changes: 0 additions & 6 deletions README

This file was deleted.

133 changes: 133 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,133 @@
HUMMINGBIRD
===========

Site tracking and analytics storage


Description
---------------

Hummingbird serves a 1x1 tracking pixel to users. In the browser's GET request it
sends back tracking data generated by javascript.


Requirements
-------------------

* node.js v0.8.0 or higher

Installation
--------------

git clone git://github.com/mnutt/hummingbird.git
cd hummingbird

# Use npm to install the dependencies
npm install

# To use the map, download MaxMind's GeoIP database and extract to the root directory:
wget http://geolite.maxmind.com/download/geoip/database/GeoLiteCity.dat.gz
gunzip GeoLiteCity.dat.gz


Running Hummingbird
------------------------------

To start the analytics server, run the following:

node server.js

By default a dashboard will be run on port 8080. You can disable it for production use in
config/config.js. The dashboard is just html served out of public/; you can serve it using
any webserver.


Deployment
----------

Make sure to properly secure the dashboard if you don't want outside people to see it. This
typically means putting the dashboard behind nginx or apache using basic auth. The dashboard's
'listen' function takes a second argument that is the interface to bind; typically you
would choose "127.0.0.1" to only allow access from localhost, or "0.0.0.0" to listen on all
interfaces. You should then run the tracking pixel on a different port so that it is accessible
to the outside world.


Setting Up Tracking
-------------------

The file `client/hummingbird.js` contains a small script to trigger a hummingbird event. You
can either paste the contents of the file into the body of your webpage or you can upload it
to your server as a .js file and reference it with a `<script>` tag. Once you have done so,
in the footer of your page you can call

HummingbirdTracker.track();

Called with no arguments, it will send over some standard parameters such as the page URL. You
can also pass arbitrary data with the event:

HummingbirdTracker.track({logged_in: true});

The data can be used within Hummingbird's metrics to filter events on the backend.


Architecture Overview
---------------------

Hummingbird is organized into two parts: a node.js-based tracking server that records user
activity via a tracking pixel, and a collection of javascript-based widgets that display that
activity. The server broadcasts all activity to the clients using Websockets if possible, and
falls back to Flash sockets or long polling if necessary.

The Hummingbird.WebSocket object receives websocket events from the server in the form of JSON
objects. Individual widgets subscribe to a metric and register handler functions to be called
whenever that metric is present.


Logging Customization
---------------------

Metrics are stored in lib/metrics and auto-loaded. Each metric contains a handler function that is
called every time a new user event occurs. Metrics store data in the `data` object property which
gets emitted to clients in intervals specified by the metric. A basic example can be found in
lib/metrics/total_views.js. An example of how a metric can filter based on query params is in
lib/metric/cart_adds.js.


Display Customization
---------------------

Hummingbird comes with some stock widgets (Counter, Logger, Graph) that demonstrate how to hook into
the data provided by the node.js server. For the minimum amount required to create a widget, see
public/js/widgets/logger.js. A widget is an object whose prototype extends Hummingbird.Base and
implements onMessage.


Tips
-----

* To run the UI locally but stream data from your production server, use the url http://localhost:8080/?ws_server=your-host.com&ws_port=12345


Contributors
------------

* Michael Nutt <michael@nuttnet.net>
* Benny Wong <benny@bwong.net>
* mikecampo
* caphrim007
* brianjriddle
* lbosque
* robertjwhitney
* Dan Thurman
* thinkroth
* markwillis82
* ochronus
* dannyakakong
* xinbenlv


License
-------

Hummingbird is licensed under the MIT License. (See LICENSE)
5 changes: 0 additions & 5 deletions TODO

This file was deleted.

32 changes: 32 additions & 0 deletions client/file_watcher.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
var dgram = require('dgram');
var fs = require('fs');

function sendMessage(data) {
var message = new Buffer(JSON.stringify(data));
var client = dgram.createSocket("udp4");
client.send(message, 0, message.length, 8000, "localhost");
client.close();
}

var filename = process.argv[1];
if(!filename) {
console.log("No file specified");
exit(1);
}
console.log("Watching " + filename);

fs.watchFile(filename, function(curr, prev) {
console.log("HERE");
if(prev.size > curr.size) return {clear:true};
var stream = fs.createReadStream(filename, { start: prev.size, end: curr.size});
stream.addListener("data", function(lines) {
console.log("GOT MESSAGE");
lines.toString('utf-8').split("\n").forEach(function(line) {
var data = JSON.parse(line);
data.ip = data.remote_addr;
data.u = data.request_uri;
delete data.remote_addr;
delete data.request_uri;
});
});
});
30 changes: 30 additions & 0 deletions client/hummingbird.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
HummingbirdTracker = {
track: function(env) {
if(typeof(env) == "undefined") { env = {}; }

// send some miscellaneous info about the request
env.u = document.location.href;
env.bw = window.innerWidth;
env.bh = window.innerHeight;

// example of sending a cookie named 'guid'
// env.guid = (document.cookie.match(/guid=([^\_]*)_([^;]*)/) || [])[2];

if(document.referrer && document.referrer != "") {
env.ref = document.referrer;
}

env.rnd = Math.floor(Math.random() * 10e12);

var params = [];
for(var key in env) {
if(env.hasOwnProperty(key)) {
params.push(encodeURIComponent(key) + "=" + encodeURIComponent(env[key]));
}
}

// replace 'localhost:8080' with hummingbird's URL
var img = new Image();
img.src = 'http://localhost:8080/tracking_pixel.gif?' + params.join('&');
}
};
23 changes: 23 additions & 0 deletions client/udpSocketInterval.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@

var Buffer = require('buffer').Buffer;
var dgram = require('dgram');

var sock = dgram.createSocket("udp4");

var data = {
ip: '127.0.0.1',
// '141.101.99.4',
event: 'cart_add',
headers: '/' // this is the full url
};




var buf = new Buffer(JSON.stringify(data));

console.log('buf:' + buf);

setInterval(function() {
sock.send(buf, 0, buf.length, 8000, "0.0.0.0");
},100);
23 changes: 23 additions & 0 deletions client/udp_client_sample.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
var Buffer = require('buffer').Buffer;
var dgram = require('dgram');

var sock = dgram.createSocket("udp4");

var data = {
"ip" : "129.59.1.10",
"timestamp" : "Sat Oct 23 2010 21:39:35 GMT-0400 (EDT)",
"url_key" : 123,
"product_id" : 456
};




var buf = new Buffer(JSON.stringify(data));

console.log('buf:' + buf);

setInterval(function() {
sock.send(buf, 0, buf.length, 8000, "0.0.0.0");
},100);

28 changes: 28 additions & 0 deletions config/config.example.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
module.exports = config = {
"name" : "Hummingbird",

// Replay some existing traffic logs to get an idea of what Hummingbird
// looks like. Change this to false when you're ready to actually use
// Hummingbird in production.
"demo_mode": true,

// Port where the dashboard will be shown. Change it to false to disable
// the dashboard. (you might do this if you were integrating
// Hummingbird into an existing admin interface)
"dashboard_port" : 8080,

// If you want to have the tracking pixel listen on a different port
// (for instance in order to password-protect your dashboard) you can
// specify the port to listen on (change from false to port number)
"tracking_port" : 8000,

// Allow stats to be sent over UDP instead of HTTP. This works best for
// sending stats from backend servers within the same datacenter as
// Hummingbird. Change to false to disable.
"udp_tracking_port" : 8000,

// Interface to bind the UDP listener to. Use 127.0.0.1 to only allow
// other apps on your machine to connect, or 0.0.0.0 to bind to all
// interfaces and allow any machine to connect.
"udp_trackin_address" : "127.0.0.1"
}
69 changes: 69 additions & 0 deletions config/deploy.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,69 @@
require 'json'

settings = JSON.parse File.read(File.join(File.dirname(__FILE__), 'app.json'))

set :application, "hummingbird"
set :scm, :git

set :repository, settings['capistrano']['repository']

set :hummingbird_host, settings['capistrano']['hummingbird_host']

role :web, hummingbird_host
role :app, hummingbird_host
role :db, hummingbird_host

depend :remote, :command, 'git'

set :git_enable_submodules, 1
set :deploy_to, "/var/www/#{application}"

default_run_options[:pty] = true

namespace :deploy do
task :restart, :roles => :app, :except => { :no_release => true } do
run "#{try_sudo} restart hummingbird"
run "#{try_sudo} restart hummingbird_monitor"
end

task :update_node_modules, :roles => :app do
run "cd #{latest_release}/#{current} && npm install"
end
end

desc 'Tail the production log'
task :tail, :roles => :app do
run "tail -100f #{shared_path}/log/hummingbird.log"
end

desc 'Tail nginx error log'
task :tail_error, :roles => :app do
sudo "tail -100f /var/log/nginx/error.log"
end

namespace :update do
desc 'Creates symlinks for shared resources'
task :symlink_shared do
symlinks = { 'log' => 'log', 'config/app.json' => 'config/app.json' }
symlinks.each do |shared, current|
run "rm -rf #{latest_release}/#{current}"
run "ln -s #{shared_path}/#{shared} #{latest_release}/#{current}"
end
end
end

desc "Backup the remote production database"
task :backup, :roles => :db do
filename = "#{application}.dump.#{Time.now.to_s.gsub(/[^0-9\-]/, '')}.bson"
file = "/tmp/hummingbird/metrics.bson"
on_rollback { run "rm #{file}" }
run "echo $PATH; mongodump -d hummingbird -c metrics -o /tmp" do |ch, stream, data|
puts data
end
`mkdir -p #{File.dirname(__FILE__)}/../backups/`
get file, "backups/#{filename}"
run "rm #{file}"
end

after 'deploy:update_code', 'update:symlink_shared'
after 'deploy:update_code', 'deploy:update_node_modules'
Loading