bipbip 0.5.13 → 0.5.14

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 290a0ee2638d2bbcc58de86a92d71b580f79150f
4
- data.tar.gz: 6e17c85ccf63b06131e441039558f59cc9156eab
3
+ metadata.gz: 297ab31c33a70036e4877f4b5b44d47acdbc9a32
4
+ data.tar.gz: f48f374bb3cd80e87ab5ece81c99ced7b7c2211a
5
5
  SHA512:
6
- metadata.gz: 024f1c30cfe0a47870956ac792dd5caee74a4da6a1dd7b90a462d39073bc4431f79ffd4ba620162e9fe19096039fb3bdd08f6d2955a025cefef951580bfad5b4
7
- data.tar.gz: b3b3c2f989cc14bc5e105d8bb8ade3d74fa80c5c3b40e452d61c1976f86331631c0a285ebea055947159adeb842227f49fffe855ddf0440fb63857f43e3112af
6
+ metadata.gz: 4acccd584041353c38d5e234836474d9fcc44b218b2582fc06ee0d5b6ade33d0f78cf11a14a67e1470988ad4fcbdd18b211f3f0f561a12bf04a0300b8e8560b0
7
+ data.tar.gz: e971c88b6ab120a8f20be1d44759f71b1fab52c4f039a14bc315891e24a82b674fa42f5ae339a1a2b52bd823e6ac0e5d1c741d1bad0cda1258a81e7895c84030
@@ -62,7 +62,7 @@ module Bipbip
62
62
  data['replication_lag'] = replication_lag
63
63
  end
64
64
 
65
- data['slow_queries'] = fetch_slow_queries
65
+ data['slow_queries'] = calculate_slow_queries
66
66
 
67
67
  data
68
68
  end
@@ -103,8 +103,16 @@ module Bipbip
103
103
  old
104
104
  end
105
105
 
106
- def fetch_slow_queries
107
- query = {'millis' => {'$gte' => slow_query_threshold}, 'ts' => {'$gte' => slow_query_last_check}}
106
+ def calculate_slow_queries
107
+ timestamp_last_check = slow_query_last_check
108
+
109
+ slow_queries = fetch_slow_queries_count(slow_query_threshold, timestamp_last_check)
110
+
111
+ (slow_queries/(Time.now - timestamp_last_check)).to_i
112
+ end
113
+
114
+ def fetch_slow_queries_count(millis_min, ts_min)
115
+ query = {'millis' => {'$gte' => millis_min}, 'ts' => {'$gte' => ts_min}}
108
116
  database_names_ignore = ['admin', 'system']
109
117
 
110
118
  database_list = (mongodb_client.database_names - database_names_ignore).map { |name| mongodb_database(name) }
@@ -1,3 +1,3 @@
1
1
  module Bipbip
2
- VERSION = '0.5.13'
2
+ VERSION = '0.5.14'
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: bipbip
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.5.13
4
+ version: 0.5.14
5
5
  platform: ruby
6
6
  authors:
7
7
  - Cargo Media
@@ -10,7 +10,7 @@ authors:
10
10
  autorequire:
11
11
  bindir: bin
12
12
  cert_chain: []
13
- date: 2015-01-16 00:00:00.000000000 Z
13
+ date: 2015-01-21 00:00:00.000000000 Z
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
16
16
  name: copperegg
@@ -272,3 +272,4 @@ signing_key:
272
272
  specification_version: 4
273
273
  summary: Gather services data and store in CopperEgg
274
274
  test_files: []
275
+ has_rdoc: