mjc-gh / batsd-dash

Sinatra-based dash app for batsd
49 stars 11 forks source link

Graph does not work #8

Closed GoranP closed 12 years ago

GoranP commented 12 years ago

Using Ubuntu 12.04 I followed instructions and installed as suggested -> sudo gem install batsd-dash after that I've installed thin -> sudo gem install thin I've started rackup and it looks fine

I am using Ruby 1.9.3

Request on: http://localhost:9292/available

returns my counters and gauges in this form -> ["counters:account.activate","counters:cpu","gauges:cpu"]

But http://localhost:9292/graph#counters=cpu returns error "Sinatra doesn’t know this ditty." Same for gauges.

When I hit http://localhost:9292/counters whatever date I select I have error message "Error: Invalid metrics"

In HTML pages and Ajax requests I don't see any reference to nvd3...

Is there a solution?

mjc-gh commented 12 years ago

What does the following give you:

curl -H "Accept: application/json" http://localhost:9292/data?counters=cpu
GoranP commented 12 years ago

goran@tenchi:~$ curl -H "Accept: application/json" http://localhost:9292/data?counters=cpu <!DOCTYPE html>

Sinatra doesn’t know this ditty.

Try this:
get '/data' do
  "Hello World"
end
GoranP commented 12 years ago

Ups sorry... now this more readable...

goran@tenchi:~$ curl -H "Accept: application/json" http://localhost:9292/data?counters=cpu <!DOCTYPE html> <html> <head> <style type="text/css"> body { text-align:center;font-family:helvetica,arial;font-size:22px; color:#888;margin:20px} #c {margin:0 auto;width:500px;text-align:left} </style> </head> <body> <h2>Sinatra doesn&rsquo;t know this ditty.</h2> <img src='http://localhost:9292/__sinatra__/404.png'> <div id="c"> Try this: <pre>get '/data' do "Hello World" end</pre> </div> </body> </html>

mjc-gh commented 12 years ago

Should have realized this right away, the version of the the gem that isn't released doesn't match up with docs\README. In particular, commit 6823a136 made big changes to the API and routing.

You can take a look at the old README here for info on the old routes\API: https://github.com/mikeycgto/batsd-dash/blob/6823a13671ff25bec72fe63905e063302257d123/README.md

Alternatively, you can just use the code off github as opposed to rubygems. If you're using a Gemfile in your project something like the following should do the job:

gem 'batsd-dash', :git => 'git://github.com/mikeycgto/batsd-dash.git'

We need to just fix up a few front-end aspects with the project then we will release version 0.3.0 to rubygems.

GoranP commented 12 years ago

works like a charm... thnx.

mjc-gh commented 12 years ago

No problem! Hope you find this project useful.

We should be releasing the updated gem within a few days (possibly even tonight).

GoranP commented 12 years ago

It is quite nice project. I like the graphs and the way you generate them through nvd3. Althought I have some problems with gauges (blocks server - ruby goes on 100%) but it is probably because of junk in my redis. If I find any issues I will send it to you. :)

mjc-gh commented 12 years ago

Disk reads can be rather sluggish, especially with a lot of data.

If you're on the version from rubygems, there is a chance your requests without any time parameters are 'falling through' to the next retention level. We bumped down the default to 30 minutes to avoid this (e2577acdb).

Accessing multiple metrics is a known slow spot as well. We fetch each stat from the batsd data server in series not in parallel. This is something we will eventually change (going to make a ticket right now :smile:)