GithubHelp home page GithubHelp logo

Comments (11)

koichiro avatar koichiro commented on July 29, 2024

環境構築からスタート
https://github.com/focuslight/focuslight

from workshop.

koichiro avatar koichiro commented on July 29, 2024

rubyインストール

 % rbenv install 2.3.0
Downloading ruby-2.3.0.tar.bz2...
-> https://cache.ruby-lang.org/pub/ruby/2.3/ruby-2.3.0.tar.bz2
Installing ruby-2.3.0...
Installed ruby-2.3.0 to /Users/koichiro/.rbenv/versions/2.3.0
% ruby -v
ruby 2.3.0p0 (2015-12-25 revision 53290) [x86_64-darwin15]

from workshop.

koichiro avatar koichiro commented on July 29, 2024

bundler

% gem install bundler
Fetching: bundler-1.11.2.gem (100%)
Successfully installed bundler-1.11.2
Parsing documentation for bundler-1.11.2
Installing ri documentation for bundler-1.11.2
Done installing documentation for bundler after 3 seconds
1 gem installed

from workshop.

koichiro avatar koichiro commented on July 29, 2024

gem install

% gem install focuslight
Fetching: raindrops-0.16.0.gem (100%)
Building native extensions.  This could take a while...
Successfully installed raindrops-0.16.0
Fetching: rack-1.6.4.gem (100%)
Successfully installed rack-1.6.4
Fetching: kgio-2.10.0.gem (100%)
Building native extensions.  This could take a while...
Successfully installed kgio-2.10.0
Fetching: unicorn-5.0.1.gem (100%)
Building native extensions.  This could take a while...
Successfully installed unicorn-5.0.1
Fetching: get_process_mem-0.2.0.gem (100%)
Successfully installed get_process_mem-0.2.0
Fetching: unicorn-worker-killer-0.4.4.gem (100%)
Successfully installed unicorn-worker-killer-0.4.4
Fetching: thor-0.19.1.gem (100%)
Successfully installed thor-0.19.1
Fetching: sqlite3-1.3.11.gem (100%)
Building native extensions.  This could take a while...
Successfully installed sqlite3-1.3.11
Fetching: tilt-2.0.2.gem (100%)
Successfully installed tilt-2.0.2
Fetching: rack-protection-1.5.3.gem (100%)
Successfully installed rack-protection-1.5.3
Fetching: sinatra-1.4.7.gem (100%)
Successfully installed sinatra-1.4.7
Fetching: rack-test-0.6.3.gem (100%)
Successfully installed rack-test-0.6.3
Fetching: multi_json-1.11.2.gem (100%)
Successfully installed multi_json-1.11.2
Fetching: backports-3.6.8.gem (100%)
Successfully installed backports-3.6.8
Fetching: sinatra-contrib-1.4.6.gem (100%)
Successfully installed sinatra-contrib-1.4.6
Fetching: sequel-4.32.0.gem (100%)
Successfully installed sequel-4.32.0
Fetching: ffi-1.9.10.gem (100%)
Building native extensions.  This could take a while...
Successfully installed ffi-1.9.10
Fetching: thread_safe-0.3.5.gem (100%)
Successfully installed thread_safe-0.3.5
Fetching: tzinfo-1.2.2.gem (100%)
Successfully installed tzinfo-1.2.2
Fetching: i18n-0.7.0.gem (100%)
Successfully installed i18n-0.7.0
Fetching: activesupport-4.2.6.gem (100%)
Successfully installed activesupport-4.2.6
Fetching: rrd-ffi-0.2.14.gem (100%)
Successfully installed rrd-ffi-0.2.14
Fetching: mysql2-0.4.3.gem (100%)
Building native extensions.  This could take a while...
Successfully installed mysql2-0.4.3
Fetching: librrd-1.0.4.gem (100%)
Building native extensions.  This could take a while...
Successfully installed librrd-1.0.4
Fetching: foreman-0.78.0.gem (100%)
Successfully installed foreman-0.78.0
Fetching: erubis-2.7.0.gem (100%)
Successfully installed erubis-2.7.0
Fetching: dotenv-2.1.0.gem (100%)
Successfully installed dotenv-2.1.0
Fetching: focuslight-0.1.4.gem (100%)
Successfully installed focuslight-0.1.4
Parsing documentation for raindrops-0.16.0
Installing ri documentation for raindrops-0.16.0
Parsing documentation for rack-1.6.4
Installing ri documentation for rack-1.6.4
Parsing documentation for kgio-2.10.0
Installing ri documentation for kgio-2.10.0
Parsing documentation for unicorn-5.0.1
Installing ri documentation for unicorn-5.0.1
Parsing documentation for get_process_mem-0.2.0
Installing ri documentation for get_process_mem-0.2.0
Parsing documentation for unicorn-worker-killer-0.4.4
Installing ri documentation for unicorn-worker-killer-0.4.4
Parsing documentation for thor-0.19.1
Installing ri documentation for thor-0.19.1
Parsing documentation for sqlite3-1.3.11
Installing ri documentation for sqlite3-1.3.11
Parsing documentation for tilt-2.0.2
Installing ri documentation for tilt-2.0.2
Parsing documentation for rack-protection-1.5.3
Installing ri documentation for rack-protection-1.5.3
Parsing documentation for sinatra-1.4.7
Installing ri documentation for sinatra-1.4.7
Parsing documentation for rack-test-0.6.3
Installing ri documentation for rack-test-0.6.3
Parsing documentation for multi_json-1.11.2
Installing ri documentation for multi_json-1.11.2
Parsing documentation for backports-3.6.8
Installing ri documentation for backports-3.6.8
Parsing documentation for sinatra-contrib-1.4.6
Installing ri documentation for sinatra-contrib-1.4.6
Parsing documentation for sequel-4.32.0
Installing ri documentation for sequel-4.32.0
Parsing documentation for ffi-1.9.10
Installing ri documentation for ffi-1.9.10
Parsing documentation for thread_safe-0.3.5
Installing ri documentation for thread_safe-0.3.5
Parsing documentation for tzinfo-1.2.2
Installing ri documentation for tzinfo-1.2.2
Parsing documentation for i18n-0.7.0
Installing ri documentation for i18n-0.7.0
Parsing documentation for activesupport-4.2.6
Installing ri documentation for activesupport-4.2.6
Parsing documentation for rrd-ffi-0.2.14
Installing ri documentation for rrd-ffi-0.2.14
Parsing documentation for mysql2-0.4.3
Installing ri documentation for mysql2-0.4.3
Parsing documentation for librrd-1.0.4
Installing ri documentation for librrd-1.0.4
Parsing documentation for foreman-0.78.0
Installing ri documentation for foreman-0.78.0
Parsing documentation for erubis-2.7.0
Installing ri documentation for erubis-2.7.0
Parsing documentation for dotenv-2.1.0
Installing ri documentation for dotenv-2.1.0
Parsing documentation for focuslight-0.1.4
Installing ri documentation for focuslight-0.1.4
Done installing documentation for raindrops, rack, kgio, unicorn, get_process_mem, unicorn-worker-killer, thor, sqlite3, tilt, rack-protection, sinatra, rack-test, multi_json, backports, sinatra-contrib, sequel, ffi, thread_safe, tzinfo, i18n, activesupport, rrd-ffi, mysql2, librrd, foreman, erubis, dotenv, focuslight after 255 seconds
28 gems installed

from workshop.

koichiro avatar koichiro commented on July 29, 2024

focuslightインストール

% rehash
% focuslight new
% cd focuslight
% ls -la
total 12
drwxr-xr-x  6 koichiro  staff  204  3 26 11:27 ./
drwxr-xr-x  3 koichiro  staff  102  3 26 11:27 ../
-rw-r--r--  1 koichiro  staff  338  3 26 11:27 .env
-rw-r--r--  1 koichiro  staff  100  3 26 11:27 Procfile
-rw-r--r--  1 koichiro  staff  346  3 26 11:27 config.ru
drwxr-xr-x  2 koichiro  staff   68  3 26 11:27 log/
 % focuslight init
 % focuslight start
11:27:44 web.1     | started with pid 9115
11:27:44 worker1.1 | started with pid 9116
11:27:44 worker2.1 | started with pid 9117
11:27:44 web.1     | I, [2016-03-26T11:27:44.306185 #9115]  INFO -- : listening on addr=0.0.0.0:5125 fd=9
11:27:44 web.1     | I, [2016-03-26T11:27:44.306304 #9115]  INFO -- : worker=0 spawning...
11:27:44 web.1     | I, [2016-03-26T11:27:44.307409 #9115]  INFO -- : master process ready
11:27:44 web.1     | I, [2016-03-26T11:27:44.308573 #9118]  INFO -- : worker=0 spawned pid=9118
11:27:44 web.1     | I, [2016-03-26T11:27:44.309004 #9118]  INFO -- : Refreshing Gem list
11:27:44 web.1     | I, [2016-03-26T11:27:44.803235 #9118]  INFO -- : worker=0 ready

from workshop.

koichiro avatar koichiro commented on July 29, 2024

データ投入

curl -F number=30 http://localhost:5125/api/socialgame/member/register

グラフがでない
image

エラー

11:34:29 web.1     | 2016-03-26 11:34:29 - RuntimeError - RRDtool returns error to draw graph, error: option -u - Cannot convert '' to float:
11:34:29 web.1     |    /Users/koichiro/.rbenv/versions/2.3.0/lib/ruby/gems/2.3.0/gems/focuslight-0.1.4/lib/focuslight/rrd.rb:255:in `graph'
11:34:29 web.1     |    /Users/koichiro/.rbenv/versions/2.3.0/lib/ruby/gems/2.3.0/gems/focuslight-0.1.4/lib/focuslight/web.rb:433:in `block in <class:Web>'
11:34:29 web.1     |    /Users/koichiro/.rbenv/versions/2.3.0/lib/ruby/gems/2.3.0/gems/sinatra-1.4.7/lib/sinatra/base.rb:1611:in `call'
11:34:29 web.1     |    /Users/koichiro/.rbenv/versions/2.3.0/lib/ruby/gems/2.3.0/gems/sinatra-1.4.7/lib/sinatra/base.rb:1611:in `block in compile!'
11:34:29 web.1     |    /Users/koichiro/.rbenv/versions/2.3.0/lib/ruby/gems/2.3.0/gems/sinatra-1.4.7/lib/sinatra/base.rb:975:in `block (3 levels) in route!'
11:34:29 web.1     |    /Users/koichiro/.rbenv/versions/2.3.0/lib/ruby/gems/2.3.0/gems/sinatra-1.4.7/lib/sinatra/base.rb:994:in `route_eval'
11:34:29 web.1     |    /Users/koichiro/.rbenv/versions/2.3.0/lib/ruby/gems/2.3.0/gems/sinatra-1.4.7/lib/sinatra/base.rb:975:in `block (2 levels) in route!'
11:34:29 web.1     |    /Users/koichiro/.rbenv/versions/2.3.0/lib/ruby/gems/2.3.0/gems/sinatra-1.4.7/lib/sinatra/base.rb:1015:in `block in process_route'
11:34:29 web.1     |    /Users/koichiro/.rbenv/versions/2.3.0/lib/ruby/gems/2.3.0/gems/sinatra-1.4.7/lib/sinatra/base.rb:1013:in `catch'
11:34:29 web.1     |    /Users/koichiro/.rbenv/versions/2.3.0/lib/ruby/gems/2.3.0/gems/sinatra-1.4.7/lib/sinatra/base.rb:1013:in `process_route'
11:34:29 web.1     |    /Users/koichiro/.rbenv/versions/2.3.0/lib/ruby/gems/2.3.0/gems/sinatra-1.4.7/lib/sinatra/base.rb:973:in `block in route!'
11:34:29 web.1     |    /Users/koichiro/.rbenv/versions/2.3.0/lib/ruby/gems/2.3.0/gems/sinatra-1.4.7/lib/sinatra/base.rb:972:in `each'
11:34:29 web.1     |    /Users/koichiro/.rbenv/versions/2.3.0/lib/ruby/gems/2.3.0/gems/sinatra-1.4.7/lib/sinatra/base.rb:972:in `route!'
11:34:29 web.1     |    /Users/koichiro/.rbenv/versions/2.3.0/lib/ruby/gems/2.3.0/gems/sinatra-1.4.7/lib/sinatra/base.rb:1085:in `block in dispatch!'
11:34:29 web.1     |    /Users/koichiro/.rbenv/versions/2.3.0/lib/ruby/gems/2.3.0/gems/sinatra-1.4.7/lib/sinatra/base.rb:1067:in `block in invoke'
11:34:29 web.1     |    /Users/koichiro/.rbenv/versions/2.3.0/lib/ruby/gems/2.3.0/gems/sinatra-1.4.7/lib/sinatra/base.rb:1067:in `catch'
11:34:29 web.1     |    /Users/koichiro/.rbenv/versions/2.3.0/lib/ruby/gems/2.3.0/gems/sinatra-1.4.7/lib/sinatra/base.rb:1067:in `invoke'
11:34:29 web.1     |    /Users/koichiro/.rbenv/versions/2.3.0/lib/ruby/gems/2.3.0/gems/sinatra-1.4.7/lib/sinatra/base.rb:1082:in `dispatch!'
11:34:29 web.1     |    /Users/koichiro/.rbenv/versions/2.3.0/lib/ruby/gems/2.3.0/gems/sinatra-1.4.7/lib/sinatra/base.rb:907:in `block in call!'
11:34:29 web.1     |    /Users/koichiro/.rbenv/versions/2.3.0/lib/ruby/gems/2.3.0/gems/sinatra-1.4.7/lib/sinatra/base.rb:1067:in `block in invoke'
11:34:29 web.1     |    /Users/koichiro/.rbenv/versions/2.3.0/lib/ruby/gems/2.3.0/gems/sinatra-1.4.7/lib/sinatra/base.rb:1067:in `catch'
11:34:29 web.1     |    /Users/koichiro/.rbenv/versions/2.3.0/lib/ruby/gems/2.3.0/gems/sinatra-1.4.7/lib/sinatra/base.rb:1067:in `invoke'
11:34:29 web.1     |    /Users/koichiro/.rbenv/versions/2.3.0/lib/ruby/gems/2.3.0/gems/sinatra-1.4.7/lib/sinatra/base.rb:907:in `call!'
11:34:29 web.1     |    /Users/koichiro/.rbenv/versions/2.3.0/lib/ruby/gems/2.3.0/gems/sinatra-1.4.7/lib/sinatra/base.rb:895:in `call'
11:34:29 web.1     |    /Users/koichiro/.rbenv/versions/2.3.0/lib/ruby/gems/2.3.0/gems/rack-protection-1.5.3/lib/rack/protection/xss_header.rb:18:in `call'
11:34:29 web.1     |    /Users/koichiro/.rbenv/versions/2.3.0/lib/ruby/gems/2.3.0/gems/rack-protection-1.5.3/lib/rack/protection/path_traversal.rb:16:in `call'
11:34:29 web.1     |    /Users/koichiro/.rbenv/versions/2.3.0/lib/ruby/gems/2.3.0/gems/rack-protection-1.5.3/lib/rack/protection/json_csrf.rb:18:in `call'
11:34:29 web.1     |    /Users/koichiro/.rbenv/versions/2.3.0/lib/ruby/gems/2.3.0/gems/rack-protection-1.5.3/lib/rack/protection/base.rb:49:in `call'
11:34:29 web.1     |    /Users/koichiro/.rbenv/versions/2.3.0/lib/ruby/gems/2.3.0/gems/rack-protection-1.5.3/lib/rack/protection/base.rb:49:in `call'
11:34:29 web.1     |    /Users/koichiro/.rbenv/versions/2.3.0/lib/ruby/gems/2.3.0/gems/rack-protection-1.5.3/lib/rack/protection/frame_options.rb:31:in `call'
11:34:29 web.1     |    /Users/koichiro/.rbenv/versions/2.3.0/lib/ruby/gems/2.3.0/gems/rack-1.6.4/lib/rack/nulllogger.rb:9:in `call'
11:34:29 web.1     |    /Users/koichiro/.rbenv/versions/2.3.0/lib/ruby/gems/2.3.0/gems/rack-1.6.4/lib/rack/head.rb:13:in `call'
11:34:29 web.1     |    /Users/koichiro/.rbenv/versions/2.3.0/lib/ruby/gems/2.3.0/gems/sinatra-1.4.7/lib/sinatra/base.rb:182:in `call'
11:34:29 web.1     |    /Users/koichiro/.rbenv/versions/2.3.0/lib/ruby/gems/2.3.0/gems/sinatra-1.4.7/lib/sinatra/base.rb:2013:in `call'
11:34:29 web.1     |    /Users/koichiro/.rbenv/versions/2.3.0/lib/ruby/gems/2.3.0/gems/sinatra-1.4.7/lib/sinatra/base.rb:1487:in `block in call'
11:34:29 web.1     |    /Users/koichiro/.rbenv/versions/2.3.0/lib/ruby/gems/2.3.0/gems/sinatra-1.4.7/lib/sinatra/base.rb:1787:in `synchronize'
11:34:29 web.1     |    /Users/koichiro/.rbenv/versions/2.3.0/lib/ruby/gems/2.3.0/gems/sinatra-1.4.7/lib/sinatra/base.rb:1487:in `call'
11:34:29 web.1     |    /Users/koichiro/.rbenv/versions/2.3.0/lib/ruby/gems/2.3.0/gems/unicorn-5.0.1/lib/unicorn/http_server.rb:562:in `process_client'
11:34:29 web.1     |    /Users/koichiro/.rbenv/versions/2.3.0/lib/ruby/gems/2.3.0/gems/unicorn-worker-killer-0.4.4/lib/unicorn/worker_killer.rb:52:in `process_client'
11:34:29 web.1     |    /Users/koichiro/.rbenv/versions/2.3.0/lib/ruby/gems/2.3.0/gems/unicorn-worker-killer-0.4.4/lib/unicorn/worker_killer.rb:92:in `process_client'
11:34:29 web.1     |    /Users/koichiro/.rbenv/versions/2.3.0/lib/ruby/gems/2.3.0/gems/unicorn-5.0.1/lib/unicorn/http_server.rb:658:in `worker_loop'
11:34:29 web.1     |    /Users/koichiro/.rbenv/versions/2.3.0/lib/ruby/gems/2.3.0/gems/unicorn-5.0.1/lib/unicorn/http_server.rb:508:in `spawn_missing_workers'
11:34:29 web.1     |    /Users/koichiro/.rbenv/versions/2.3.0/lib/ruby/gems/2.3.0/gems/unicorn-5.0.1/lib/unicorn/http_server.rb:132:in `start'
11:34:29 web.1     |    /Users/koichiro/.rbenv/versions/2.3.0/lib/ruby/gems/2.3.0/gems/unicorn-5.0.1/bin/unicorn:126:in `<top (required)>'
11:34:29 web.1     |    /Users/koichiro/.rbenv/versions/2.3.0/bin/unicorn:23:in `load'
11:34:29 web.1     |    /Users/koichiro/.rbenv/versions/2.3.0/bin/unicorn:23:in `<main>'

from workshop.

koichiro avatar koichiro commented on July 29, 2024

:upper_limit :lower_limit のargsが空文字でわたってくるのが問題っぽい

from workshop.

koichiro avatar koichiro commented on July 29, 2024

graphメソッドにわたってくるargsのupper_limitが空文字でくる

11:53:59 web.1     | args
11:53:59 web.1     | {:service_name=>"socialgame", :section_name=>"member", :graph_name=>"register", :complex=>nil, :from=>"2016/03/18 11:53:55", :to=>"2016/03/26 11:53:55", :width=>390, :height=>110, :graphonly=>false, :logarithmic=>false, :background_color=>"f3f3f3", :canvas_color=>"ffffff", :font_color=>"000000", :frame_color=>"000000", :axis_color=>"000000", :shadea_color=>"cfcfcf", :shadeb_color=>"9e9e9e", :border=>3, :legend=>true, :notitle=>false, :xgrid=>"", :ygrid=>"", :upper_limit=>"", :lower_limit=>"", :rigid=>false, :sumup=>false, :step=>nil, :cf=>"AVERAGE"}

結果としてrrdoptionsに-uオプション2つ含まれて2個目の-uオプションの値が空文字になる> "-u", ""

11:53:59 web.1     | rrdoptions
11:53:59 web.1     | ["/var/folders/_0/81x3y3ws5x985sy3108m8dzm0000gn/T/20160326-11405-1d3ktud.png", "-w", 390, "-h", 110, "-a", "PNG", "-l", 0, "-u", 2, "-x", "HOUR:1:HOUR:2:HOUR:2:0:%H", "-s", -118800, "-e", "now", "--slope-mode", "--disable-rrdtool-tag", "--color", "BACK#F3F3F3", "--color", "CANVAS#FFFFFF", "--color", "FONT#000000", "--color", "FRAME#000000", "--color", "AXIS#000000", "--color", "SHADEA#CFCFCF", "--color", "SHADEB#9E9E9E", "--border", "3", "-t", "Day (5min avg)", "--font", "AXIS:8:", "--font", "LEGEND:8:", "-u", "", "-l", "", "DEF:num0t=./data/c4ca4238a0b923820dcc509a6f75849b.rrd:num:AVERAGE", "CDEF:num0=num0t,-1000000000,1000000000000000,LIMIT,1,*", "AREA:num0#33cc66:register ", "GPRINT:num0:LAST:Cur\\: %4.1lf%s", "GPRINT:num0:AVERAGE:Avg\\: %4.1lf%s", "GPRINT:num0:MAX:Max\\: %4.1lf%s", "GPRINT:num0:MIN:Min\\: %4.1lf%s\\l", "VDEF:num0cur=num0,LAST", "PRINT:num0cur:%.8lf", "VDEF:num0avg=num0,AVERAGE", "PRINT:num0avg:%.8lf", "VDEF:num0max=num0,MAXIMUM", "PRINT:num0max:%.8lf", "VDEF:num0min=num0,MINIMUM", "PRINT:num0min:%.8lf"]

from workshop.

koichiro avatar koichiro commented on July 29, 2024

rrd.rbにある upper_limit のデフォルト値は2になっている。

  rrdoptions = [
      tmpfile.path,
      '-w', width,
      '-h', height,
      '-a', 'PNG',
      '-l', 0, #minimum
      '-u', 2, #maximum

一方 web.rb のデフォルト値は空文字になってる。

graph_rendering_request_spec = {
...
    upper_limit: { default: '' },
    lower_limit: { default: '' },
...

空文字のweb.rbが有効になっているのでweb.rb側でも2をデフォルトにすればよさそう。

from workshop.

koichiro avatar koichiro commented on July 29, 2024

web.rbのグラフ表示のデフォルト値を数値すると表示できた

diff --git a/lib/focuslight/web.rb b/lib/focuslight/web.rb
index 6dce3d0..784ec56 100644
--- a/lib/focuslight/web.rb
+++ b/lib/focuslight/web.rb
@@ -391,8 +391,8 @@ class Focuslight::Web < Sinatra::Base
     notitle: { default: 'false', rule: rule(:bool) },
     xgrid: { default: '' },
     ygrid: { default: '' },
-    upper_limit: { default: '' },
-    lower_limit: { default: '' },
+    upper_limit: { default: 2 },
+    lower_limit: { default: 0 },
     rigid: { default: 'false', rule: rule(:bool) },
     sumup: { default: 'false', rule: rule(:bool) },
     step: { excludable: true, rule: rule(:uint) },

from workshop.

kou avatar kou commented on July 29, 2024

おつかれさまでした!

from workshop.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.