optic-rails 1.3.2 → 1.3.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 +4 -4
- data/lib/optic/rails.rb +28 -17
- data/lib/optic/rails/railtie.rb +2 -2
- data/lib/optic/rails/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 8f787a6d3e1f1ff640839f94a3d37af5983d4649e8027e38deb49eead5c06957
|
4
|
+
data.tar.gz: c163087d65a95951548d14f0aa7bb091e828672e45d4aa4a91190dcfd48298e9
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 7e39ff209e85dc27916dba16ed61a757cbd551ab91d448e36a08fd6b2ba02009098e4ec2126622d478496a7c64f05b8d2568a3ad0ad4fed35f5639debc6be956
|
7
|
+
data.tar.gz: 2d9ec9f9bf07ecece630d508b92d16f7c111d58406a59964c775e264d553fc736e5dcce50ef067546edb85b5efac4f7e60cdb2a36fa468a9f1a47bac86c857e4
|
data/lib/optic/rails.rb
CHANGED
@@ -5,33 +5,44 @@ require "optic/rails/railtie"
|
|
5
5
|
module Optic
|
6
6
|
module Rails
|
7
7
|
class << self
|
8
|
-
def entities
|
8
|
+
def entities(logger)
|
9
9
|
with_connection do
|
10
10
|
{
|
11
11
|
schema_version: ActiveRecord::Migrator.current_version,
|
12
12
|
entities: active_record_klasses.map do |klass|
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
13
|
+
begin
|
14
|
+
logger.debug "Inspecting entity #{klass}"
|
15
|
+
{
|
16
|
+
name: klass.name,
|
17
|
+
table_name: klass.table_name,
|
18
|
+
entity_attribute_names: klass.attribute_names,
|
19
|
+
table_exists: klass.table_exists?,
|
20
|
+
associations: klass.reflect_on_all_associations.map do |reflection|
|
21
|
+
begin
|
22
|
+
logger.debug "Inspecting association #{klass}/#{reflection.name}"
|
23
|
+
{
|
24
|
+
name: reflection.name,
|
25
|
+
macro: reflection.macro,
|
26
|
+
options: reflection.options.map { |k, v| [k, v.to_s] }.to_h,
|
27
|
+
klass_name: reflection.options[:polymorphic] ? nil : reflection.klass.name,
|
28
|
+
}
|
29
|
+
rescue
|
30
|
+
nil
|
31
|
+
end
|
32
|
+
end.compact
|
33
|
+
}
|
34
|
+
rescue
|
35
|
+
nil
|
36
|
+
end
|
37
|
+
end.compact
|
28
38
|
}
|
29
39
|
end
|
30
40
|
end
|
31
41
|
|
32
|
-
def metrics(instructions)
|
42
|
+
def metrics(logger, instructions)
|
33
43
|
with_connection do |connection|
|
34
44
|
instructions.map do |instruction|
|
45
|
+
logger.debug "Gathering metrics for metric_configuration_id = #{instruction['metric_configuration_id']}"
|
35
46
|
name = instruction["entity"]
|
36
47
|
entity = entity_for_entity_name name
|
37
48
|
|
data/lib/optic/rails/railtie.rb
CHANGED
@@ -66,9 +66,9 @@ module Optic
|
|
66
66
|
|
67
67
|
case command
|
68
68
|
when "request_schema"
|
69
|
-
client.perform "schema", message: Optic::Rails.entities
|
69
|
+
client.perform "schema", message: Optic::Rails.entities(logger)
|
70
70
|
when "request_metrics"
|
71
|
-
client.perform "metrics", message: Optic::Rails.metrics(message["instructions"])
|
71
|
+
client.perform "metrics", message: Optic::Rails.metrics(logger, message["instructions"])
|
72
72
|
else
|
73
73
|
logger.warn "Optic agent got unknown command: #{command}"
|
74
74
|
end
|
data/lib/optic/rails/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: optic-rails
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.3.
|
4
|
+
version: 1.3.3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Anton Vaynshtok
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2018-07-
|
11
|
+
date: 2018-07-13 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: action_cable_client
|