process_metrics 0.1.6 → 0.1.7

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: 006dcf0c27ae6df3c52c2645fa6786a16ab29838
4
- data.tar.gz: 352109f0dfd38a74c0a5a0352cd07608164d1ab0
3
+ metadata.gz: acb69e8140574fb9fb22047aa33a99d84906474c
4
+ data.tar.gz: b0a1a95ddf0720eb8fd8fc8135ee4999b1f2801d
5
5
  SHA512:
6
- metadata.gz: 24b824da67a763a9e207af52501adf4452c476a00565400fe952d681215946bdb3d679f23308ccbbed1af42897769c66c43bc42fd6b73cc744da4b30a5b262b1
7
- data.tar.gz: 8f9891df61b28c70442c80b1e22bc4109f9decf3258444afd540b1c50df74340608f3b182b6d81530adc15e7a3ee2da2ee3dd6545b3903899cb9fe689631eca7
6
+ metadata.gz: d86382d809a208c3cde308290c72cec88d34217c084113274b8d123ad3e9ee0f9b1c40ac2300770038ff9ceca00ccdfe6c4c4aa5781a74c330bfe87ed14ba39e
7
+ data.tar.gz: 3fef137149674f5d6e3894fcc9d1f1c624d79e7d9b58fdd5861185c140d3505209b4d1a28ffb546d15bf5f74aff6ce3450a3b2688b111a4c7fc60f64a0feee02
@@ -20,20 +20,13 @@ module ProcessMetrics
20
20
  parent_uuid: @parent_uuid,
21
21
  name: @name,
22
22
  data: YAML::dump(@data),
23
- started_at: @started_at,
24
- finished_at: @finished_at
23
+ started_at: @started_at ? @started_at.strftime("%Y-%m-%d %H:%M:%S.%N") : nil,
24
+ finished_at: @finished_at ? @finished_at.strftime("%Y-%m-%d %H:%M:%S.%N") : nil
25
25
  }
26
26
  end
27
27
 
28
- def serialized_attributes
29
- {
30
- uuid: @uuid,
31
- parent_uuid: @parent_uuid,
32
- name: @name,
33
- data: YAML::dump(@data),
34
- started_at: @started_at.strftime("%Y-%m-%d %H:%M:%S.%N"),
35
- finished_at: @finished_at.strftime("%Y-%m-%d %H:%M:%S.%N")
36
- }
28
+ def finish
29
+ @finished_at = Time.now
37
30
  end
38
31
 
39
32
  def finish
@@ -49,19 +42,20 @@ module ProcessMetrics
49
42
  end
50
43
 
51
44
  def self.work(name, parent=nil, &block)
45
+
52
46
  metric = ProcessMetrics::Base.new name, parent
53
47
  result = nil
54
48
  begin
55
49
  result = block.call metric
56
50
  metric.finish
57
51
  ensure
58
- Thread.new(metric) { metric.save }
52
+ Thread.new(metric) { |_metric| _metric.save }
59
53
  end
60
54
  result
61
55
  end
62
56
 
63
57
  def to_s
64
- self.class.name + " " + serialized_attributes.to_s
58
+ self.class.name + " " + attributes.to_s
65
59
  end
66
60
  end
67
61
  end
@@ -1,3 +1,3 @@
1
1
  module ProcessMetrics
2
- VERSION = "0.1.6"
2
+ VERSION = "0.1.7"
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: process_metrics
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.6
4
+ version: 0.1.7
5
5
  platform: ruby
6
6
  authors:
7
7
  - Lucas Uyezu