process_metrics_activerecord 0.1.5 → 0.1.6
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:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: e4276bab9f12429d2f256791974ef74a8c4c518a
|
4
|
+
data.tar.gz: cecb286b02dd9d8cdd164ba94add33f20373e959
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: f91bd003a3b5d8c966d3ab79160729824b1d821e66112eb2d8ec363f64c3a6ca10381006454fa8398d82edadb214d3d9bdbd6c8d5abfbfd7179f0d4ad9997d30
|
7
|
+
data.tar.gz: b355c407da83ee572b56c5fc8dc838c91126462fc1e40a30f68c0b0768eb6cf42c19fa46dbeaa1716b5b16dfd23a47a4a64035d365be146ccf922a460c6885de
|
@@ -15,13 +15,26 @@ module ProcessMetrics
|
|
15
15
|
|
16
16
|
def self.setup!
|
17
17
|
::ActiveRecord::Base.connection_pool.with_connection do
|
18
|
-
ProcessMetrics::Persistence::ActiveRecord::Migration.new.
|
18
|
+
ProcessMetrics::Persistence::ActiveRecord::Migration.new.up
|
19
19
|
end
|
20
20
|
end
|
21
21
|
|
22
|
-
def self.
|
22
|
+
def self.drop!
|
23
23
|
::ActiveRecord::Base.connection_pool.with_connection do
|
24
|
-
|
24
|
+
ProcessMetrics::Persistence::ActiveRecord::Migration.new.down
|
25
|
+
end
|
26
|
+
end
|
27
|
+
|
28
|
+
def self.save metric
|
29
|
+
begin
|
30
|
+
::ActiveRecord::Base.connection_pool.with_connection do
|
31
|
+
Metric.create! metric.attributes
|
32
|
+
end
|
33
|
+
rescue
|
34
|
+
ProcessMetrics.config.logger.error $!.message
|
35
|
+
$!.backtrace.each do |backtrace_line|
|
36
|
+
ProcessMetrics.config.logger.error backtrace_line
|
37
|
+
end
|
25
38
|
end
|
26
39
|
end
|
27
40
|
end
|
@@ -2,7 +2,7 @@ module ProcessMetrics
|
|
2
2
|
module Persistence
|
3
3
|
module ActiveRecord
|
4
4
|
class Migration < ::ActiveRecord::Migration
|
5
|
-
def
|
5
|
+
def up
|
6
6
|
table_name = ProcessMetrics::Persistence::ActiveRecord::Metric.table_name
|
7
7
|
create_table(table_name, id: false) do |t|
|
8
8
|
t.string :uuid, :parent_uuid, limit: 36
|
@@ -15,6 +15,11 @@ module ProcessMetrics
|
|
15
15
|
add_index table_name.to_sym, :uuid
|
16
16
|
add_index table_name.to_sym, :parent_uuid
|
17
17
|
end
|
18
|
+
|
19
|
+
def down
|
20
|
+
table_name = ProcessMetrics::Persistence::ActiveRecord::Metric.table_name
|
21
|
+
drop_table(table_name)
|
22
|
+
end
|
18
23
|
end
|
19
24
|
end
|
20
25
|
end
|
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.6
|
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-03-
|
11
|
+
date: 2014-03-21 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: activerecord
|