optics-agent 0.2.0 → 0.2.1
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 +8 -8
- data/lib/optics-agent/agent.rb +15 -3
- data/lib/optics-agent/reporting/report_job.rb +0 -5
- data/lib/optics-agent/reporting/schema_job.rb +0 -4
- metadata +1 -15
checksums.yaml
CHANGED
@@ -1,15 +1,15 @@
|
|
1
1
|
---
|
2
2
|
!binary "U0hBMQ==":
|
3
3
|
metadata.gz: !binary |-
|
4
|
-
|
4
|
+
NzExZTA5Mzc0OGMyNGVhZjkyYjk1ZjViMzlmMmVkMmVhYjNmODI0OA==
|
5
5
|
data.tar.gz: !binary |-
|
6
|
-
|
6
|
+
OGFkMjdjNmJkNTI2M2U2N2NjMzYyMDAxNTdmNWJlOTA4NWNiNDJmZg==
|
7
7
|
SHA512:
|
8
8
|
metadata.gz: !binary |-
|
9
|
-
|
10
|
-
|
11
|
-
|
9
|
+
NjExNTA5NzE5NTMwOGZlZTMwMWYxMjZkZDJiM2IwY2Y0MDI0NGM0Mjc4NWVh
|
10
|
+
ZTNmZWU3ODQwODI3YjU3YWFiNmM5NTE4ODBlYjQ3MWViZDlmZmRlYTQ1ZTM3
|
11
|
+
ZGUxYTczMjVmMzZlZmY0NDUxZWUwNWQ1NzgxNjJkZjEyMWFhYTM=
|
12
12
|
data.tar.gz: !binary |-
|
13
|
-
|
14
|
-
|
15
|
-
|
13
|
+
MmJmN2NhYTg2ZGRlNjFmYjRmMDFhYWYyZGQyMGUxMDIxZjZkZDE0MjdhZTg5
|
14
|
+
NGZkZmRkZmQ4OTIyNjdlODM0ZGI4OWViNGM2OWE4OWM0MmJiYzcxMzFhMzE2
|
15
|
+
NjY1NjdiMGJiNDc5NTE5Yjg4MjdiZTQ5MTIwZjAwY2U0ZGQ0NDM=
|
data/lib/optics-agent/agent.rb
CHANGED
@@ -19,19 +19,31 @@ module OpticsAgent
|
|
19
19
|
def initialize
|
20
20
|
@query_queue = []
|
21
21
|
@semaphone = Mutex.new
|
22
|
+
|
23
|
+
# TODO: make these configurable
|
24
|
+
@schema_report_delay = 10
|
25
|
+
@report_interval = 60
|
22
26
|
end
|
23
27
|
|
24
28
|
def instrument_schema(schema)
|
25
29
|
@schema = schema
|
26
30
|
schema.middleware << graphql_middleware
|
27
31
|
|
28
|
-
|
29
|
-
|
32
|
+
Thread.new do
|
33
|
+
sleep @schema_report_delay
|
34
|
+
SchemaJob.new.perform(self)
|
35
|
+
end
|
36
|
+
|
30
37
|
schedule_report
|
31
38
|
end
|
32
39
|
|
33
40
|
def schedule_report
|
34
|
-
|
41
|
+
Thread.new do
|
42
|
+
while true
|
43
|
+
sleep @report_interval
|
44
|
+
ReportJob.new.perform(self)
|
45
|
+
end
|
46
|
+
end
|
35
47
|
end
|
36
48
|
|
37
49
|
def add_query(query, rack_env, start_time, end_time)
|
@@ -1,10 +1,7 @@
|
|
1
|
-
require 'sucker_punch'
|
2
1
|
require 'optics-agent/reporting/report'
|
3
2
|
|
4
3
|
module OpticsAgent::Reporting
|
5
4
|
class ReportJob
|
6
|
-
include SuckerPunch::Job
|
7
|
-
|
8
5
|
def perform(agent)
|
9
6
|
report = OpticsAgent::Reporting::Report.new
|
10
7
|
agent.clear_query_queue.each do |item|
|
@@ -17,8 +14,6 @@ module OpticsAgent::Reporting
|
|
17
14
|
|
18
15
|
report.decorate_from_schema(agent.schema)
|
19
16
|
report.send
|
20
|
-
|
21
|
-
agent.schedule_report
|
22
17
|
end
|
23
18
|
end
|
24
19
|
end
|
@@ -1,12 +1,8 @@
|
|
1
|
-
require 'sucker_punch'
|
2
1
|
require 'optics-agent/reporting/schema'
|
3
2
|
|
4
3
|
module OpticsAgent::Reporting
|
5
4
|
class SchemaJob
|
6
|
-
include SuckerPunch::Job
|
7
|
-
|
8
5
|
def perform(agent)
|
9
|
-
puts 'performing schema job'
|
10
6
|
schema = OpticsAgent::Reporting::Schema.new agent.schema
|
11
7
|
schema.send
|
12
8
|
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: optics-agent
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.2.
|
4
|
+
version: 0.2.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- ! 'Tom Coleman '
|
@@ -38,20 +38,6 @@ dependencies:
|
|
38
38
|
- - ~>
|
39
39
|
- !ruby/object:Gem::Version
|
40
40
|
version: 3.1.0
|
41
|
-
- !ruby/object:Gem::Dependency
|
42
|
-
name: sucker_punch
|
43
|
-
requirement: !ruby/object:Gem::Requirement
|
44
|
-
requirements:
|
45
|
-
- - ~>
|
46
|
-
- !ruby/object:Gem::Version
|
47
|
-
version: 2.0.2
|
48
|
-
type: :runtime
|
49
|
-
prerelease: false
|
50
|
-
version_requirements: !ruby/object:Gem::Requirement
|
51
|
-
requirements:
|
52
|
-
- - ~>
|
53
|
-
- !ruby/object:Gem::Version
|
54
|
-
version: 2.0.2
|
55
41
|
- !ruby/object:Gem::Dependency
|
56
42
|
name: rake
|
57
43
|
requirement: !ruby/object:Gem::Requirement
|