Sha256: 39d6c7d404c5ebb7a157514e9e17d838fbefb932c3018a017cbf5e40aa7e334b

Contents?: true

Size: 776 Bytes

Versions: 10

Compression:

Stored size: 776 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.value :counter,  :title => "Counter"
    b.value :lines,    :title => "Number of Lines"
    b.value :bytes,    :title => "Number of Bytes"
    b.chart :bytes,    :title => "Chart of Bytes", :periods => 10
    b.map   :visitors, :title => "Visitors", :width => 12, :height => 9
  end
end

Version data entries

10 entries across 10 versions & 1 rubygems

Version Path
dasht-0.1.9 examples/simple_heroku_dashboard.rb
dasht-0.1.8 examples/simple_heroku_dashboard.rb
dasht-0.1.7 examples/simple_heroku_dashboard.rb
dasht-0.1.6 examples/simple_heroku_dashboard.rb
dasht-0.1.5 examples/simple_heroku_dashboard.rb
dasht-0.1.4 examples/simple_heroku_dashboard.rb
dasht-0.1.3 examples/simple_heroku_dashboard.rb
dasht-0.1.2 examples/simple_heroku_dashboard.rb
dasht-0.1.1 examples/simple_heroku_dashboard.rb
dasht-0.1.0 examples/simple_heroku_dashboard.rb