Sha256: 26792a5407e9c41d0f7cf52969ce0a2ef95357309f52dfc2f573db5fc02ad2fb

Contents?: true

Size: 828 Bytes

Versions: 7

Compression:

Stored size: 828 Bytes

Contents

require 'dasht'

application = ARGV[0]

dasht do |d|
  # Consume Heroku logs.
  d.start "heroku logs --tail --app #{application}" do |l|
    # Track some metrics.
    l.count :lines, /.+/

    l.count :bytes, /.+/ do |match|
      match[0].length
    end

    l.append :visitors, /Started GET .* for (\d+\.\d+\.\d+\.\d+) at/ do |matches|
      matches[1]
    end
  end

  counter = 0
  d.interval :counter do
    sleep 1
    counter += 1
  end

  # Publish a board.
  d.board do |b|
    b.map   :visitors, :title => "Visitors", :width => 8, :height => 12
    b.value :counter,  :title => "Counter", :width => 4
    b.value :lines,    :title => "Number of Lines", :width => 4
    b.value :bytes,    :title => "Number of Bytes", :width => 4
    b.chart :bytes,    :title => "Chart of Bytes", :periods => 10, :width => 4
  end
end

Version data entries

7 entries across 7 versions & 1 rubygems

Version Path
dasht-0.1.9 examples/simple_heroku_dashboard_2.rb
dasht-0.1.8 examples/simple_heroku_dashboard_2.rb
dasht-0.1.7 examples/simple_heroku_dashboard_2.rb
dasht-0.1.6 examples/simple_heroku_dashboard_2.rb
dasht-0.1.5 examples/simple_heroku_dashboard_2.rb
dasht-0.1.4 examples/simple_heroku_dashboard_2.rb
dasht-0.1.3 examples/simple_heroku_dashboard_2.rb