rhoconnect 3.3.1.beta4 → 3.3.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/CHANGELOG.md +6 -0
- data/CREDITS +16 -0
- data/Gemfile.lock +2 -2
- data/bench/lib/bench/test_data.rb +26 -26
- data/bench/scripts/cud_script.rb +1 -1
- data/bench/scripts/test_query_script.rb +13 -7
- data/doc/bulk-sync.txt +11 -0
- data/doc/supported-platforms.txt +3 -3
- data/generators/templates/application/Gemfile +2 -2
- data/lib/rhoconnect/api/app/bulk_data.rb +1 -1
- data/lib/rhoconnect/api/client/list_client_docs.rb +11 -9
- data/lib/rhoconnect/api/system/get_license_info.rb +5 -5
- data/lib/rhoconnect/bulk_data/bulk_data.rb +3 -1
- data/lib/rhoconnect/client_sync.rb +4 -2
- data/lib/rhoconnect/graph_helper.rb +170 -88
- data/lib/rhoconnect/jobs/bulk_data_job.rb +2 -2
- data/lib/rhoconnect/server.rb +1 -1
- data/lib/rhoconnect/version.rb +1 -1
- data/lib/rhoconnect/web-console/models/stats.js +66 -2
- data/lib/rhoconnect/web-console/public/bootstrap-collapse.js +157 -0
- data/lib/rhoconnect/web-console/public/jquery-1.7.1.min.js +4 -154
- data/lib/rhoconnect/web-console/server.rb +26 -1
- data/lib/rhoconnect/web-console/templates/index.erb +4 -2
- data/lib/rhoconnect/web-console/templates/jqplot.erb +13 -13
- data/lib/rhoconnect/web-console/views/new_ping.js +9 -2
- data/lib/rhoconnect/web-console/views/stats.js +69 -25
- data/spec/async_spec.rb +1 -1
- data/spec/bulk_data/bulk_data_spec.rb +17 -2
- data/spec/jobs/bulk_data_job_spec.rb +37 -1
- data/spec/spec_helper.rb +2 -2
- metadata +636 -625
- data/examples/simple/Gemfile.lock +0 -101
- data/examples/simple/dump.rdb +0 -0
data/CHANGELOG.md
CHANGED
@@ -1,3 +1,9 @@
|
|
1
|
+
## 3.3.1 (2012-07-19)
|
2
|
+
* #33021139 - ping test page doesn't send sound parameter
|
3
|
+
* disable sqlite3 dependency by default so applications deploy on heroku without modification
|
4
|
+
* #28696971 - select which models to bulk sync
|
5
|
+
* cleaner layout on statistics page
|
6
|
+
|
1
7
|
## 3.3.1.beta4 (2012-07-17)
|
2
8
|
* #32952425/EMBPD00067402/EMBPD00067382 - rhoconnect startbg fails on windows
|
3
9
|
|
data/CREDITS
CHANGED
@@ -2375,3 +2375,19 @@ RhoConnect uses or references the following open source software:
|
|
2375
2375
|
|
2376
2376
|
warbler 1.3.5 (https://github.com/jruby/warbler)
|
2377
2377
|
License: MIT license (http://caldersphere.rubyforge.org/warbler/LICENSE_txt.html)
|
2378
|
+
|
2379
|
+
nodejs 0.8.1 http://nodejs.org/
|
2380
|
+
License: MIT License (https://github.com/joyent/node/blob/master/LICENSE)
|
2381
|
+
|
2382
|
+
node_redis 0.7.1 http://search.npmjs.org/#/redis
|
2383
|
+
License: MIT License (https://github.com/mranney/node_redis#license---mit-license)
|
2384
|
+
|
2385
|
+
redis-url 0.1.0 http://search.npmjs.org/#/redis-url
|
2386
|
+
License: MIT License (https://github.com/ddollar/redis-url#license)
|
2387
|
+
|
2388
|
+
npm 1.1.30 http://npmjs.org/
|
2389
|
+
License: MIT License (https://github.com/isaacs/npm/blob/master/LICENSE)
|
2390
|
+
|
2391
|
+
commander.js 1.0.0 http://visionmedia.github.com/commander.js/
|
2392
|
+
License: MIT License (https://github.com/visionmedia/commander.js/#license)
|
2393
|
+
|
data/Gemfile.lock
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
PATH
|
2
2
|
remote: .
|
3
3
|
specs:
|
4
|
-
rhoconnect (3.3.1
|
4
|
+
rhoconnect (3.3.1)
|
5
5
|
bundler (~> 1.0)
|
6
6
|
json (~> 1.6.0)
|
7
7
|
rake (~> 0.9.2.2)
|
@@ -117,7 +117,7 @@ GEM
|
|
117
117
|
rspec-mocks (2.10.1)
|
118
118
|
ruby-hmac (0.4.0)
|
119
119
|
rubyzip (0.9.9)
|
120
|
-
selenium-webdriver (2.
|
120
|
+
selenium-webdriver (2.25.0)
|
121
121
|
childprocess (>= 0.2.5)
|
122
122
|
libwebsocket (~> 0.1.3)
|
123
123
|
multi_json (~> 1.0)
|
@@ -39,32 +39,7 @@ module Bench
|
|
39
39
|
end
|
40
40
|
users
|
41
41
|
end
|
42
|
-
|
43
|
-
private
|
44
|
-
|
45
|
-
PREFIX = ["Account", "Administrative", "Advertising", "Assistant", "Banking", "Business Systems",
|
46
|
-
"Computer", "Distribution", "IT", "Electronics", "Environmental", "Financial", "General", "Head",
|
47
|
-
"Laboratory", "Maintenance", "Medical", "Production", "Quality Assurance", "Software", "Technical",
|
48
|
-
"Chief", "Senior"] unless defined? PREFIX
|
49
|
-
SUFFIX = ["Clerk", "Analyst", "Manager", "Supervisor", "Plant Manager", "Mechanic", "Technician", "Engineer",
|
50
|
-
"Director", "Superintendent", "Specialist", "Technologist", "Estimator", "Scientist", "Foreman", "Nurse",
|
51
|
-
"Worker", "Helper", "Intern", "Sales", "Mechanic", "Planner", "Recruiter", "Officer", "Superintendent",
|
52
|
-
"Vice President", "Buyer", "Production Supervisor", "Chef", "Accountant", "Executive"] unless defined? SUFFIX
|
53
|
-
|
54
|
-
IMAGE_FILES = %w{
|
55
|
-
icon.ico loading-LandscapeLeft.png loading-PortraitUpsideDown.png
|
56
|
-
icon.png loading-LandscapeRight.png loading.png
|
57
|
-
loading-Landscape.png loading-Portrait.png loading@2x.png }
|
58
|
-
|
59
|
-
EXCLUDE_LIST = %w{ id mock_id img_file-rhoblob img_file_size filename }
|
60
|
-
|
61
|
-
def title
|
62
|
-
prefix = PREFIX[rand(PREFIX.length)]
|
63
|
-
suffix = SUFFIX[rand(SUFFIX.length)]
|
64
|
-
|
65
|
-
"#{prefix} #{suffix}"
|
66
|
-
end
|
67
|
-
|
42
|
+
|
68
43
|
def generate_fake_data(num, generate_blob)
|
69
44
|
res = {}
|
70
45
|
num.times do |n|
|
@@ -94,5 +69,30 @@ module Bench
|
|
94
69
|
end
|
95
70
|
res
|
96
71
|
end
|
72
|
+
|
73
|
+
private
|
74
|
+
|
75
|
+
PREFIX = ["Account", "Administrative", "Advertising", "Assistant", "Banking", "Business Systems",
|
76
|
+
"Computer", "Distribution", "IT", "Electronics", "Environmental", "Financial", "General", "Head",
|
77
|
+
"Laboratory", "Maintenance", "Medical", "Production", "Quality Assurance", "Software", "Technical",
|
78
|
+
"Chief", "Senior"] unless defined? PREFIX
|
79
|
+
SUFFIX = ["Clerk", "Analyst", "Manager", "Supervisor", "Plant Manager", "Mechanic", "Technician", "Engineer",
|
80
|
+
"Director", "Superintendent", "Specialist", "Technologist", "Estimator", "Scientist", "Foreman", "Nurse",
|
81
|
+
"Worker", "Helper", "Intern", "Sales", "Mechanic", "Planner", "Recruiter", "Officer", "Superintendent",
|
82
|
+
"Vice President", "Buyer", "Production Supervisor", "Chef", "Accountant", "Executive"] unless defined? SUFFIX
|
83
|
+
|
84
|
+
IMAGE_FILES = %w{
|
85
|
+
icon.ico loading-LandscapeLeft.png loading-PortraitUpsideDown.png
|
86
|
+
icon.png loading-LandscapeRight.png loading.png
|
87
|
+
loading-Landscape.png loading-Portrait.png loading@2x.png }
|
88
|
+
|
89
|
+
EXCLUDE_LIST = %w{ id mock_id img_file-rhoblob img_file_size filename }
|
90
|
+
|
91
|
+
def title
|
92
|
+
prefix = PREFIX[rand(PREFIX.length)]
|
93
|
+
suffix = SUFFIX[rand(SUFFIX.length)]
|
94
|
+
|
95
|
+
"#{prefix} #{suffix}"
|
96
|
+
end
|
97
97
|
end
|
98
98
|
end
|
data/bench/scripts/cud_script.rb
CHANGED
@@ -48,7 +48,7 @@ Bench.test do |config,session|
|
|
48
48
|
session.client_id = JSON.parse(session.last_result.body)['client']['client_id']
|
49
49
|
create_objs = @create_objects[session.thread_id][session.iteration]
|
50
50
|
session.post "create-object",
|
51
|
-
"#{config.host}/app/#{Rhoconnect::API_VERSION}/#{config.adapter_name}
|
51
|
+
"#{config.host}/app/#{Rhoconnect::API_VERSION}/#{config.adapter_name}",
|
52
52
|
{:content_type => :json, 'X-RhoConnect-CLIENT-ID' => session.client_id} do
|
53
53
|
{:create => create_objs}.to_json
|
54
54
|
end
|
@@ -69,18 +69,24 @@ Bench.test do |config,session|
|
|
69
69
|
token = JSON.parse(session.last_result.body)[1]['token']
|
70
70
|
session.last_result.verify_code(200)
|
71
71
|
end
|
72
|
-
|
73
|
-
|
74
|
-
|
75
|
-
|
72
|
+
|
73
|
+
# now , create 2 records and then, delete them
|
74
|
+
# we also generate 2 random records for CUD calls
|
75
|
+
expected_for_cud = Bench.generate_fake_data(2, false)
|
76
|
+
session.post "create-object",
|
77
|
+
"#{config.host}/app/#{Rhoconnect::API_VERSION}/RhoInternalBenchmarkAdapter",
|
78
|
+
{:content_type => :json, 'X-RhoConnect-CLIENT-ID' => session.client_id} do
|
79
|
+
{:create => expected_for_cud}.to_json
|
80
|
+
end
|
81
|
+
session.last_result.verify_code(200)
|
82
|
+
|
83
|
+
obj_to_delete = expected_for_cud.keys[0]
|
76
84
|
session.delete "delete_object",
|
77
85
|
"#{config.host}/app/#{Rhoconnect::API_VERSION}/RhoInternalBenchmarkAdapter/#{obj_to_delete}",
|
78
86
|
{'X-RhoConnect-CLIENT-ID' => session.client_id}
|
79
87
|
session.last_result.verify_code(200)
|
80
88
|
|
81
|
-
obj_to_delete =
|
82
|
-
@expected.delete(obj_to_delete)
|
83
|
-
@datasize = @datasize - 1
|
89
|
+
obj_to_delete = expected_for_cud.keys[1]
|
84
90
|
session.post "push_deletes",
|
85
91
|
"#{config.host}/app/#{Rhoconnect::API_VERSION}/RhoInternalBenchmarkAdapter/push_deletes",
|
86
92
|
{'X-RhoConnect-API-TOKEN' => config.token, :content_type => :json} do
|
data/doc/bulk-sync.txt
CHANGED
@@ -30,6 +30,17 @@ For example, your settings/settings.yml might have:
|
|
30
30
|
|
31
31
|
## Setup
|
32
32
|
|
33
|
+
### Setup DB Library
|
34
|
+
Bulk sync prepares database files inside of a job, therefore it needs access to sqlite3's ruby library. To enable this library, uncomment or add the following line to your RhoConnect app's Gemfile:
|
35
|
+
|
36
|
+
:::ruby
|
37
|
+
gem 'sqlite3', ">= 1.3.3", :platforms => [:ruby, :mswin, :mingw]
|
38
|
+
|
39
|
+
Then install the gem:
|
40
|
+
|
41
|
+
:::term
|
42
|
+
$ bundle install
|
43
|
+
|
33
44
|
### Enabling Bulk Sync in Rhodes
|
34
45
|
In the device rhodes application, setting `bulksync_state` to 0 in rhoconfig.txt will trigger bulk sync next time sync is performed:
|
35
46
|
|
data/doc/supported-platforms.txt
CHANGED
@@ -16,7 +16,7 @@ Supported Platforms
|
|
16
16
|
<tr>
|
17
17
|
<td class='cap'>Linux</td>
|
18
18
|
<td> CentOS / RHEL 5 & 6,<br/>Ubuntu 11,<br/>Amazon Linux</td>
|
19
|
-
<td> ruby-1.8.7-
|
19
|
+
<td> ruby-1.8.7-p370 </td>
|
20
20
|
<td> ree-1.8.7-2012.02 </td>
|
21
21
|
<td> ruby-1.9.2-p320 </td>
|
22
22
|
<td> ruby-1.9.3-p194 </td>
|
@@ -26,7 +26,7 @@ Supported Platforms
|
|
26
26
|
<tr>
|
27
27
|
<td class='cap'>Mac OS </td>
|
28
28
|
<td> Mac OS X 10.6/10.7 </td>
|
29
|
-
<td> ruby-1.8.7-
|
29
|
+
<td> ruby-1.8.7-p370 </td>
|
30
30
|
<td> ree-1.8.7-2012.02 </td>
|
31
31
|
<td> ruby-1.9.2-p320 </td>
|
32
32
|
<td> ruby-1.9.3-p194 </td>
|
@@ -36,7 +36,7 @@ Supported Platforms
|
|
36
36
|
<tr>
|
37
37
|
<td class='cap'>Windows</td>
|
38
38
|
<td> Windows 7 </td>
|
39
|
-
<td> ruby-1.8.7-
|
39
|
+
<td> ruby-1.8.7-p370 </td>
|
40
40
|
<td class='tbd'> TBD </td>
|
41
41
|
<td class='tbd'> TBD </td>
|
42
42
|
<td> ruby-1.9.3-p194 </td>
|
@@ -4,7 +4,6 @@ gem 'rhoconnect', '<%=gem_version%>'
|
|
4
4
|
|
5
5
|
# Helps with some of the limitations of green threads, not needed in ruby 1.9.x
|
6
6
|
gem 'SystemTimer', '~> 1.2.3', :platforms => :ruby_18
|
7
|
-
gem 'windows-pr', '1.2.1', :platforms => [:mswin, :mingw]
|
8
7
|
gem 'win32-process', :platforms => [:mswin, :mingw]
|
9
8
|
|
10
9
|
# use thin and eventmachine everywhere except JRuby
|
@@ -30,7 +29,8 @@ platforms :jruby do
|
|
30
29
|
gem 'warbler'
|
31
30
|
end
|
32
31
|
|
33
|
-
|
32
|
+
# uncomment the line below to use bulk sync: http://docs.rhomobile.com/rhoconnect/bulk-sync
|
33
|
+
# gem 'sqlite3', ">= 1.3.3", :platforms => [:ruby, :mswin, :mingw]
|
34
34
|
|
35
35
|
group :development do
|
36
36
|
gem 'rhomobile-debug', ">= 1.0.2"
|
@@ -1,6 +1,6 @@
|
|
1
1
|
Server.api4 :bulk_data, :post, "/rc/#{Rhoconnect::API_VERSION}/app/bulk_data", \
|
2
2
|
false, {:verb => :get, :url => ['/application/bulk_data', '/api/application/bulk_data']} do |params,user,server|
|
3
3
|
server.content_type :json
|
4
|
-
data = ClientSync.bulk_data(params[:partition].to_sym,server.current_client)
|
4
|
+
data = ClientSync.bulk_data(params[:partition].to_sym,server.current_client, params[:sources])
|
5
5
|
data.to_json
|
6
6
|
end
|
@@ -1,13 +1,15 @@
|
|
1
1
|
Server.api4 :list_client_docs, :get, "/rc/#{Rhoconnect::API_VERSION}/clients/:client_id/sources/:source_id/docnames", \
|
2
2
|
true, {:verb => :post, :url => ['/api/list_client_docs', '/api/client/list_client_docs']} do |params,user|
|
3
|
-
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
3
|
+
Rhoconnect::Stats::Record.update('clientdocs') do
|
4
|
+
c = Client.load(params[:client_id],{:source_name => params[:source_id]})
|
5
|
+
res = {}
|
6
|
+
[:cd,:cd_size,:create,:update,:delete,
|
7
|
+
:page,:delete_page,:create_links,:create_links_page,:page_token,
|
8
|
+
:create_errors,:update_errors,:delete_errors,:login_error,:logoff_error,
|
9
|
+
:search,:search_token,:search_errors].each do |doc|
|
10
|
+
db_key = c.docname(doc)
|
11
|
+
res.merge!(doc => db_key)
|
12
|
+
end
|
13
|
+
res.to_json
|
11
14
|
end
|
12
|
-
res.to_json
|
13
15
|
end
|
@@ -1,9 +1,9 @@
|
|
1
1
|
Server.api4 :get_license_info, :get, "/rc/#{Rhoconnect::API_VERSION}/system/license", \
|
2
2
|
true, {:verb => :post, :url => ['/api/get_license_info', '/api/admin/get_license_info']} do |params,user|
|
3
|
-
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
3
|
+
{:rhoconnect_version => Rhoconnect.license.rhoconnect_version,
|
4
|
+
:licensee => Rhoconnect.license.licensee,
|
5
|
+
:seats => Rhoconnect.license.seats,
|
6
|
+
:issued => Rhoconnect.license.issued,
|
7
|
+
:available => Rhoconnect.license.available }.to_json
|
8
8
|
end
|
9
9
|
|
@@ -10,7 +10,8 @@ module Rhoconnect
|
|
10
10
|
field :refresh_time, :integer
|
11
11
|
field :dbfile,:string
|
12
12
|
list :sources, :string
|
13
|
-
|
13
|
+
list :partition_sources, :string
|
14
|
+
validates_presence_of :app_id, :user_id, :sources, :partition_sources
|
14
15
|
|
15
16
|
def completed?
|
16
17
|
if state.to_sym == :completed
|
@@ -64,6 +65,7 @@ module Rhoconnect
|
|
64
65
|
fields[:id] = fields[:name]
|
65
66
|
fields[:state] ||= :inprogress
|
66
67
|
fields[:sources] ||= []
|
68
|
+
fields[:partition_sources] ||= []
|
67
69
|
super(fields)
|
68
70
|
end
|
69
71
|
|
@@ -262,12 +262,13 @@ module Rhoconnect
|
|
262
262
|
res
|
263
263
|
end
|
264
264
|
|
265
|
-
def bulk_data(partition,client)
|
265
|
+
def bulk_data(partition,client,sources=nil)
|
266
266
|
raise ArgumentError.new(UNKNOWN_CLIENT) unless client
|
267
267
|
name = BulkData.get_name(partition,client.user_id)
|
268
268
|
data = BulkData.load(name)
|
269
269
|
|
270
|
-
|
270
|
+
partition_sources = client.app.partition_sources(partition,client.user_id)
|
271
|
+
sources ||= partition_sources
|
271
272
|
return {:result => :nop} if sources.length <= 0
|
272
273
|
|
273
274
|
do_bd_sync = data.nil?
|
@@ -279,6 +280,7 @@ module Rhoconnect
|
|
279
280
|
data = BulkData.create(:name => name,
|
280
281
|
:app_id => client.app_id,
|
281
282
|
:user_id => client.user_id,
|
283
|
+
:partition_sources => partition_sources,
|
282
284
|
:sources => sources,
|
283
285
|
:refresh_time => Time.now.to_i + Rhoconnect.bulk_sync_poll_interval)
|
284
286
|
BulkData.enqueue("data_name" => name)
|
@@ -1,15 +1,16 @@
|
|
1
1
|
module GraphHelper
|
2
2
|
|
3
|
+
|
3
4
|
def source_timing(params)
|
4
5
|
#name,data,options
|
5
|
-
puts "display is #{params}"
|
6
6
|
@displayname = params['display_name']
|
7
7
|
names = []
|
8
|
-
begin
|
9
|
-
|
10
|
-
rescue Exception => e
|
11
|
-
|
12
|
-
end
|
8
|
+
# begin
|
9
|
+
# names = get_sources('all')
|
10
|
+
# rescue Exception => e
|
11
|
+
# puts "errror #{e.message}"
|
12
|
+
# end
|
13
|
+
names = [params['display_name']]
|
13
14
|
@sources = []
|
14
15
|
|
15
16
|
names.each do |name|
|
@@ -18,18 +19,21 @@ module GraphHelper
|
|
18
19
|
series = []
|
19
20
|
options = { :legend => { :show => true }, :title => name }
|
20
21
|
s['name'] = name
|
22
|
+
s['data'] = []
|
21
23
|
|
22
|
-
keys = get_user_count("source:*:#{name}")
|
23
|
-
|
24
|
+
@keys = get_user_count("source:*:#{name}")
|
25
|
+
@keyname = params['key'] || @keys.first
|
26
|
+
|
24
27
|
xmin = 9999999999999999
|
25
28
|
xmax = -1
|
26
29
|
ymin = 9999999999999999
|
27
30
|
ymax = -1
|
28
|
-
|
29
|
-
|
31
|
+
|
32
|
+
if @keyname
|
33
|
+
method = @keyname.gsub(/source:/,"").gsub(/:.*/,"")
|
30
34
|
series << {:showLabel => true, :label => method }
|
31
|
-
|
32
|
-
range = get_user_count(nil,
|
35
|
+
|
36
|
+
range = get_user_count(nil,@keyname,0,-1)
|
33
37
|
thisdata = []
|
34
38
|
range.each do |value|
|
35
39
|
count = value.split(',')[0]
|
@@ -46,98 +50,177 @@ module GraphHelper
|
|
46
50
|
data << thisdata
|
47
51
|
xmin = thisdata[0][0].to_i if thisdata[0] && thisdata[0][0].to_i < xmin
|
48
52
|
xmax = thisdata[-1][0].to_i if thisdata[-1] && thisdata[-1][0].to_i > xmax
|
49
|
-
|
53
|
+
|
50
54
|
|
51
|
-
|
52
|
-
|
53
|
-
|
54
|
-
|
55
|
-
|
56
|
-
|
57
|
-
s['data'] = data
|
58
|
-
options[:series] = series
|
59
|
-
options[:cursor] = {:zoom => true, :showTooltip => true}
|
55
|
+
options[:axes] = {
|
56
|
+
:yaxis => { :tickOptions => { :formatString =>'%.3f'}, :autoscale => true, :min => 0, :max => ymax + (ymax * 0.05), :label => 'Seconds', :labelRenderer => '$.jqplot.CanvasAxisLabelRenderer' },
|
57
|
+
:xaxis => { :autoscale => true, :renderer=>'$.jqplot.DateAxisRenderer',
|
58
|
+
:tickOptions => {:formatString => '%m/%d/%y'}}
|
59
|
+
}
|
60
60
|
|
61
|
-
|
61
|
+
s['data'] = data
|
62
|
+
options[:series] = series
|
63
|
+
options[:cursor] = {:zoom => true, :showTooltip => true}
|
62
64
|
|
65
|
+
s['options'] = options
|
66
|
+
end
|
67
|
+
|
63
68
|
@sources << s
|
64
69
|
end
|
65
70
|
@graph_t = 'source'
|
66
71
|
@data = [[[1,2],[3,4],[5,6]]].to_json
|
67
72
|
erb :jqplot, :layout => false
|
68
|
-
|
69
|
-
|
73
|
+
end
|
70
74
|
|
71
|
-
def http_timing(params)
|
72
|
-
@uri = 'timing/httptiming'
|
73
75
|
|
74
|
-
|
75
|
-
|
76
|
-
|
77
|
-
|
78
|
-
|
79
|
-
|
80
|
-
|
81
|
-
|
82
|
-
|
83
|
-
|
76
|
+
def http_timing_key(params)
|
77
|
+
@uri = 'timing/httptiming'
|
78
|
+
|
79
|
+
#name,data,options
|
80
|
+
@displayname = params['display_name']
|
81
|
+
#names = ["GET","POST"]
|
82
|
+
# begin
|
83
|
+
# names = get_sources('all')
|
84
|
+
# rescue Exception => e
|
85
|
+
# puts "errror #{e.message}"
|
86
|
+
# end
|
87
|
+
@sources = []
|
88
|
+
name = key = params['display_name']
|
89
|
+
|
90
|
+
s = {}
|
91
|
+
data = []
|
92
|
+
series = []
|
93
|
+
options = { :legend => { :show => true, :location => 'ne' }, :title => name }
|
94
|
+
s['name'] = name
|
95
|
+
|
96
|
+
xmin = 9999999999999999
|
97
|
+
xmax = -1
|
98
|
+
ymin = 9999999999999999
|
99
|
+
ymax = -1
|
100
|
+
|
101
|
+
method = key.gsub(/http:.*?:/,"")
|
102
|
+
#method.gsub!(/:.*/,"")
|
103
|
+
series << {:showLabel => true, :label => method}
|
104
|
+
range = get_user_count(nil,key,0,-1)
|
105
|
+
thisdata = []
|
106
|
+
range.each do |value|
|
107
|
+
count = value.split(',')[0]
|
108
|
+
value.gsub!(/.*,/,"")
|
109
|
+
thisdata << value.split(":").reverse
|
110
|
+
thisdata[-1][0] = thisdata[-1][0].to_i * 1000
|
111
|
+
thisdata[-1][1] = thisdata[-1][1].to_f
|
112
|
+
thisdata[-1][1] /= count.to_f
|
84
113
|
|
85
|
-
|
86
|
-
|
87
|
-
data = []
|
88
|
-
series = []
|
89
|
-
options = { :legend => { :show => true }, :title => name }
|
90
|
-
s['name'] = name
|
114
|
+
ymin = thisdata[-1][1].to_f if thisdata[-1][1] && thisdata[-1][1].to_f < ymin
|
115
|
+
ymax = thisdata[-1][1].to_f if thisdata[-1][1] && thisdata[-1][1].to_f > ymax
|
91
116
|
|
92
|
-
|
93
|
-
|
117
|
+
end
|
118
|
+
data << thisdata
|
119
|
+
xmin = thisdata[0][0].to_i if thisdata[0] && thisdata[0][0].to_i < xmin
|
120
|
+
xmax = thisdata[-1][0].to_i if thisdata[-1] && thisdata[-1][0].to_i > xmax
|
94
121
|
|
95
|
-
|
96
|
-
|
97
|
-
|
98
|
-
|
99
|
-
|
100
|
-
|
101
|
-
|
102
|
-
|
103
|
-
|
104
|
-
|
105
|
-
|
106
|
-
|
107
|
-
|
108
|
-
|
109
|
-
|
110
|
-
|
111
|
-
|
112
|
-
|
122
|
+
|
123
|
+
options[:axes] = {
|
124
|
+
:yaxis => { :tickOptions => { :formatString =>'%.3f'}, :autoscale => true, :min => 0, :max => ymax + (ymax * 0.05), :label => 'Seconds', :labelRenderer => '$.jqplot.CanvasAxisLabelRenderer' },
|
125
|
+
:xaxis => { :autoscale => true, :renderer=>'$.jqplot.DateAxisRenderer',
|
126
|
+
:tickOptions => {:formatString => '%m/%d/%y'}}
|
127
|
+
}
|
128
|
+
|
129
|
+
s['data'] = data
|
130
|
+
options[:series] = series
|
131
|
+
options[:cursor] = {:zoom => true, :showTooltip => true}
|
132
|
+
s['options'] = options
|
133
|
+
|
134
|
+
@sources << s
|
135
|
+
|
136
|
+
@graph_t = 'http'
|
137
|
+
@data = [[[1,2],[3,4],[5,6]]].to_json
|
138
|
+
erb :jqplot, :layout => false
|
139
|
+
end
|
140
|
+
|
141
|
+
def http_timing(params)
|
142
|
+
@uri = 'timing/httptiming'
|
113
143
|
|
114
|
-
|
115
|
-
|
144
|
+
#name,data,options
|
145
|
+
|
146
|
+
@displayname = params['display_name']
|
147
|
+
names = ["GET","POST"]
|
148
|
+
|
149
|
+
@sources = []
|
150
|
+
names = [params['display_name']]
|
116
151
|
|
117
|
-
|
118
|
-
|
119
|
-
|
120
|
-
|
121
|
-
|
152
|
+
names.each do |name|
|
153
|
+
s = {}
|
154
|
+
data = []
|
155
|
+
series = []
|
156
|
+
options = { :legend => { :show => true, :location => 'ne' }, :title => name }
|
157
|
+
s['name'] = name
|
122
158
|
|
123
|
-
|
124
|
-
|
125
|
-
|
126
|
-
|
127
|
-
|
159
|
+
name = "*" if name == "ALL"
|
160
|
+
keys = get_user_count("http:*:#{name}")
|
161
|
+
xmin = 9999999999999999
|
162
|
+
xmax = -1
|
163
|
+
ymin = 9999999999999999
|
164
|
+
ymax = -1
|
165
|
+
keys.each_with_index do |key,index|
|
166
|
+
method = key.gsub(/http:.*?:/,"")
|
167
|
+
method.gsub!(/:.*/,"") unless name == "*"
|
168
|
+
series << {:showLabel => true, :label => method}
|
128
169
|
|
129
|
-
|
130
|
-
|
131
|
-
|
170
|
+
range = get_user_count(nil,key,0,-1)
|
171
|
+
thisdata = []
|
172
|
+
range.each do |value|
|
173
|
+
count = value.split(',')[0]
|
174
|
+
value.gsub!(/.*,/,"")
|
175
|
+
thisdata << value.split(":").reverse
|
176
|
+
thisdata[-1][0] = thisdata[-1][0].to_i * 1000
|
177
|
+
thisdata[-1][1] = thisdata[-1][1].to_f
|
178
|
+
thisdata[-1][1] /= count.to_f
|
132
179
|
|
133
|
-
|
180
|
+
ymin = thisdata[-1][1].to_f if thisdata[-1][1] && thisdata[-1][1].to_f < ymin
|
181
|
+
ymax = thisdata[-1][1].to_f if thisdata[-1][1] && thisdata[-1][1].to_f > ymax
|
134
182
|
|
135
|
-
|
183
|
+
end
|
184
|
+
data << thisdata
|
185
|
+
xmin = thisdata[0][0].to_i if thisdata[0] && thisdata[0][0].to_i < xmin
|
186
|
+
xmax = thisdata[-1][0].to_i if thisdata[-1] && thisdata[-1][0].to_i > xmax
|
136
187
|
end
|
137
|
-
|
138
|
-
|
139
|
-
|
188
|
+
|
189
|
+
options[:axes] = {
|
190
|
+
:yaxis => { :tickOptions => { :formatString =>'%.3f'}, :autoscale => true, :min => 0, :max => ymax + (ymax * 0.05), :label => 'Seconds', :labelRenderer => '$.jqplot.CanvasAxisLabelRenderer' },
|
191
|
+
:xaxis => { :autoscale => true, :renderer=>'$.jqplot.DateAxisRenderer',
|
192
|
+
:tickOptions => {:formatString => '%m/%d/%y'}}
|
193
|
+
}
|
194
|
+
|
195
|
+
s['data'] = data
|
196
|
+
options[:series] = series
|
197
|
+
options[:cursor] = {:zoom => true, :showTooltip => true}
|
198
|
+
s['options'] = options
|
199
|
+
|
200
|
+
@sources << s
|
140
201
|
end
|
202
|
+
|
203
|
+
@graph_t = 'http'
|
204
|
+
@data = [[[1,2],[3,4],[5,6]]].to_json
|
205
|
+
erb :jqplot, :layout => false
|
206
|
+
end
|
207
|
+
|
208
|
+
def get_http_routes()
|
209
|
+
keys = get_user_count("http:*:*")
|
210
|
+
method = key.gsub(/http:.*?:/,"")
|
211
|
+
#sources = get_sources('all')
|
212
|
+
|
213
|
+
#loop through arrays and remove any regex matches
|
214
|
+
# keysf = keys.inject([]) do |keys_final, element|
|
215
|
+
# found = true
|
216
|
+
# sources.each do |s|
|
217
|
+
# found = false if element.match(s)
|
218
|
+
# end
|
219
|
+
# keys_final << element.strip if found
|
220
|
+
# keys_final
|
221
|
+
# end
|
222
|
+
|
223
|
+
end
|
141
224
|
|
142
225
|
def count_graph(uri,title,name,metric)
|
143
226
|
start = 0
|
@@ -178,13 +261,13 @@ module GraphHelper
|
|
178
261
|
end
|
179
262
|
|
180
263
|
def get_user_count(name=nil,metric_p=nil,start=nil,finish=nil)
|
181
|
-
|
264
|
+
begin
|
182
265
|
if Rhoconnect.stats == true
|
183
266
|
names = name
|
184
267
|
if names
|
185
268
|
Rhoconnect::Stats::Record.keys(names)
|
186
269
|
else
|
187
|
-
metric = metric_p
|
270
|
+
metric = metric_p.strip
|
188
271
|
rtype = Rhoconnect::Stats::Record.rtype(metric)
|
189
272
|
if rtype == 'zset'
|
190
273
|
# returns [] if no results
|
@@ -198,10 +281,9 @@ module GraphHelper
|
|
198
281
|
else
|
199
282
|
raise ApiException.new(500, "Stats not enabled")
|
200
283
|
end
|
201
|
-
|
202
|
-
puts "error #{e.message} -- #{metric}"
|
284
|
+
rescue Exception => e
|
203
285
|
usercount = ["0:#{Time.now.to_i}"]
|
204
|
-
|
286
|
+
end
|
205
287
|
end
|
206
288
|
|
207
289
|
def get_sources(partition_type)
|