process_metrics_activerecord 0.1.12 → 0.1.13
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:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: a45c4536ead5ebfc9850944735a80d0137409d4d
|
4
|
+
data.tar.gz: 1683dcc9bf8dab3d1fb1b6c5de156711c080a253
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 5f0a078abfc8a83f67366c8fbf0e62e28a2cc4c4d41db70739a0899fb4b85966a9a37b43fd56b152bd07141148baf916596f3841bbc02181ce6f2293107b1849
|
7
|
+
data.tar.gz: b3deb5764d1f3bd936e9472c16e41220e6440ef3f393771c16a6f33d0e95c6b63378942278d0ca50c80a85951ef3de720740f6bef73a0d6ceba6c69e63344f4a
|
@@ -30,24 +30,27 @@ module ProcessMetrics
|
|
30
30
|
::ActiveRecord::Base.connection_pool.with_connection do
|
31
31
|
metric_attributes = metric.attributes.with_indifferent_access
|
32
32
|
|
33
|
-
|
34
|
-
if
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
33
|
+
ar_parent_metric = Metric.find_or_create_by_parent_uuid metric_attributes[:parent_uuid] if metric_attributes[:parent_uuid]
|
34
|
+
if ar_parent_metric
|
35
|
+
parsed_started_at = Time.parse(metric_attributes[:started_at])
|
36
|
+
parsed_finished_at = Time.parse(metric_attributes[:finished_at])
|
37
|
+
|
38
|
+
ar_parent_metric.started_at ||= parsed_started_at
|
39
|
+
ar_parent_metric.finished_at ||= parsed_finished_at
|
40
|
+
|
41
|
+
ar_parent_metric.started_at = parsed_started_at if parsed_started_at < ar_parent_metric.started_at
|
42
|
+
ar_parent_metric.finished_at = parsed_finished_at if parsed_finished_at > ar_parent_metric.finished_at
|
43
|
+
ar_parent_metric.save
|
41
44
|
end
|
42
45
|
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
|
46
|
+
ar_metric = Metric.new
|
47
|
+
ar_metric.uuid = metric_attributes[:uuid]
|
48
|
+
ar_metric.parent_uuid = metric_attributes[:parent_uuid]
|
49
|
+
ar_metric.name = metric_attributes[:name]
|
50
|
+
ar_metric.data = metric_attributes[:data]
|
51
|
+
ar_metric.started_at = metric_attributes[:started_at]
|
52
|
+
ar_metric.finished_at = metric_attributes[:finished_at]
|
53
|
+
ar_metric.save!
|
51
54
|
end
|
52
55
|
rescue
|
53
56
|
ProcessMetrics.config.logger.error $!.message
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: process_metrics_activerecord
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.13
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Lucas Uyezu
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2014-04-
|
11
|
+
date: 2014-04-04 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: activerecord
|