cf_light_api 2.3.0 → 2.4.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (3) hide show
  1. checksums.yaml +4 -4
  2. data/lib/cf_light_api/worker.rb +18 -6
  3. metadata +2 -2
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: d48a0a566e7cbb841e1b577f71058c3d4b1a25ef
4
- data.tar.gz: 9362b13d934a01239131c2ef93e63f2b9ec84111
3
+ metadata.gz: cf01cf65d36b35346fbfcda8d96c1bad61b851f2
4
+ data.tar.gz: 150c7d313e8ee5f728a3506273433618588f0dd3
5
5
  SHA512:
6
- metadata.gz: 786bc3faae369178e518d5762455c9f0eaa372fcd78ef448638cce2e2b54f906dce9ddc9ad6ed5820c27791816c82e922e9d0e7e8ed363acb86d83d3e5048371
7
- data.tar.gz: 809390e230760ed3a8c3264a36c2d1ddc600fb365ff6c5879c936be139a53e8170633fd6ab70f79a147469c098b0449c410039a0547567553560cf318f6e0de5
6
+ metadata.gz: 5f16c20c9af5525c5a3f9e981a85bd7f8d605d226962a45ea14d84c02c3c255a7e1400aa7cc269a42afb897e38a8cda84dd1905556df34b7cc04ee9f92874362
7
+ data.tar.gz: c80c5061a40673969d69f67861445cd06b0c9778fcc5745423ea57498c3da0feb7a8c9dc873127953027382b610ae9a4f03016f70666c7a3fc95aa9e7df4f821
@@ -108,6 +108,15 @@ class CFLightAPIWorker
108
108
  end
109
109
  end
110
110
 
111
+ def send_org_quota_data_to_graphite(org_name, quota)
112
+ graphite_base_key = "cf_orgs.#{ENV['CF_ENV_NAME']}.#{org_name}"
113
+ @logger.info " Exporting org quota statistics to Graphite, path '#{graphite_base_key}'"
114
+
115
+ quota.keys.each do |key|
116
+ @graphite.metrics "#{graphite_base_key}.quota.#{key}" => quota[key]
117
+ end
118
+ end
119
+
111
120
  def put_in_redis(key, data)
112
121
  REDIS.set key, data.to_json
113
122
  end
@@ -155,15 +164,18 @@ class CFLightAPIWorker
155
164
  formatted_orgs = @orgs.map do |org|
156
165
  quota = @quotas.find{|a_quota| a_quota['metadata']['guid'] == org['entity']['quota_definition_guid']}
157
166
 
167
+ quota = {
168
+ :total_services => quota['entity']['total_services'],
169
+ :total_routes => quota['entity']['total_routes'],
170
+ :memory_limit => quota['entity']['memory_limit'] * 1024 * 1024
171
+ }
172
+
173
+ send_org_quota_data_to_graphite(org['entity']['name'], quota) if @graphite
174
+
158
175
  {
159
176
  :guid => org['metadata']['guid'],
160
177
  :name => org['entity']['name'],
161
- :quota => {
162
- :name => quota['entity']['name'],
163
- :total_services => quota['entity']['total_services'],
164
- :total_routes => quota['entity']['total_routes'],
165
- :memory_limit => quota['entity']['memory_limit'] * 1024 * 1024
166
- }
178
+ :quota => quota
167
179
  }
168
180
  end
169
181
 
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: cf_light_api
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.3.0
4
+ version: 2.4.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Springer Platform Engineering
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2017-01-11 00:00:00.000000000 Z
11
+ date: 2017-01-16 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: cfoundry