kubernetes-deploy 0.8.2 → 0.8.3

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.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: d9ad1fea429ff09ad76f943268e282f118187bcf
4
- data.tar.gz: 2f97506d2a4c07a2c21702dbfbc9586785efa303
3
+ metadata.gz: 05fd6f9e6d7f1ed75f28c9bf9c25508be5a8ce84
4
+ data.tar.gz: 8712e70aab07e4ce005feff75c4bad5441242508
5
5
  SHA512:
6
- metadata.gz: 5057c2c5ffcb7ddc6891cabc150e4f27028c8d75ecbcd5e46a56ffe87f7d61d731597e26d4bd23a989dc07fbf11bdea75efda55c61d08357d2a9f538eaf74553
7
- data.tar.gz: 913bed4cd01a854b2a2b39cde61582e409be306a9309f4708d8d46eb9c03f6ddf2e1f7bad1f0a54900d742333abc85d1f5395813ff4a51902c521887d2018150
6
+ metadata.gz: c426af3a8c735dbf2c4543fb11ed84c7ae177a047790b4e53bf725124bd01ba1d77d0923da9123fb491bd6f1e982e7c99de287799b622e4bfc16e1a1e379fdc6
7
+ data.tar.gz: 2f18a43c9929f2148ed9b614f46d7af115fec162235368301c9e3600bdd953c8f82c601bfa8e8d1687a8aa864746a103ddedecb4687df77b4a464404326733fa
@@ -187,18 +187,7 @@ module KubernetesDeploy
187
187
 
188
188
  def report_status_to_statsd(watch_time)
189
189
  unless @statsd_report_done
190
- status = if deploy_failed?
191
- "failure"
192
- elsif deploy_timed_out?
193
- "timeout"
194
- elsif deploy_succeeded?
195
- "success"
196
- else
197
- "unknown"
198
- end
199
- tags = %W(namespace:#{namespace} resource:#{id} type:#{type} sha:#{ENV['REVISION']} status:#{status})
200
- ::StatsD.measure('resource.duration', watch_time * 1000, tags: tags)
201
- ::StatsD.increment('resource.status', 1, tags: tags)
190
+ ::StatsD.measure('resource.duration', watch_time, tags: statsd_tags)
202
191
  @statsd_report_done = true
203
192
  end
204
193
  end
@@ -272,5 +261,18 @@ module KubernetesDeploy
272
261
  ensure
273
262
  file.close if file
274
263
  end
264
+
265
+ def statsd_tags
266
+ status = if deploy_failed?
267
+ "failure"
268
+ elsif deploy_timed_out?
269
+ "timeout"
270
+ elsif deploy_succeeded?
271
+ "success"
272
+ else
273
+ "unknown"
274
+ end
275
+ %W(context:#{context} namespace:#{namespace} resource:#{id} type:#{type} sha:#{ENV['REVISION']} status:#{status})
276
+ end
275
277
  end
276
278
  end
@@ -105,9 +105,9 @@ module KubernetesDeploy
105
105
 
106
106
  if deploy_has_priority_resources?(resources)
107
107
  @logger.phase_heading("Predeploying priority resources")
108
- ::StatsD.measure('duration.priority_resources', tags: statsd_tags) do
109
- predeploy_priority_resources(resources)
110
- end
108
+ start_priority_resource = Time.now.utc
109
+ predeploy_priority_resources(resources)
110
+ ::StatsD.measure('priority_resources.duration', statsd_duration(start_priority_resource), tags: statsd_tags)
111
111
  end
112
112
 
113
113
  @logger.phase_heading("Deploying all resources")
@@ -116,9 +116,9 @@ module KubernetesDeploy
116
116
  end
117
117
 
118
118
  if verify_result
119
- ::StatsD.measure('duration.normal_resources', tags: statsd_tags) do
120
- deploy_resources(resources, prune: prune, verify: true)
121
- end
119
+ start_normal_resource = Time.now.utc
120
+ deploy_resources(resources, prune: prune, verify: true)
121
+ ::StatsD.measure('normal_resources.duration', statsd_duration(start_normal_resource), tags: statsd_tags)
122
122
  record_statuses(resources)
123
123
  success = resources.all?(&:deploy_succeeded?)
124
124
  else
@@ -136,7 +136,8 @@ module KubernetesDeploy
136
136
  success = false
137
137
  ensure
138
138
  @logger.print_summary(success)
139
- ::StatsD.measure('duration.total', (Time.now.utc - start) * 1000.0, tags: statsd_tags)
139
+ status = success ? "success" : "failed"
140
+ ::StatsD.measure('all_resources.duration', statsd_duration(start), tags: statsd_tags << "status:#{status}")
140
141
  success
141
142
  end
142
143
 
@@ -441,7 +442,11 @@ module KubernetesDeploy
441
442
  end
442
443
 
443
444
  def statsd_tags
444
- %W(namespace:#{@namespace} sha:#{@current_sha})
445
+ %W(namespace:#{@namespace} sha:#{@current_sha} context:#{@context})
446
+ end
447
+
448
+ def statsd_duration(start_time)
449
+ (Time.now.utc - start_time).round(1)
445
450
  end
446
451
  end
447
452
  end
@@ -1,3 +1,3 @@
1
1
  module KubernetesDeploy
2
- VERSION = "0.8.2"
2
+ VERSION = "0.8.3"
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: kubernetes-deploy
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.8.2
4
+ version: 0.8.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Katrina Verey