optics-agent 0.2.0 → 0.2.1

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,15 +1,15 @@
1
1
  ---
2
2
  !binary "U0hBMQ==":
3
3
  metadata.gz: !binary |-
4
- OTY4ZDA5OTJkNWJjMmE3NWIwOTAyNTJlNGJjNWQzM2RlNWViNDA3MA==
4
+ NzExZTA5Mzc0OGMyNGVhZjkyYjk1ZjViMzlmMmVkMmVhYjNmODI0OA==
5
5
  data.tar.gz: !binary |-
6
- OGI1YmVmMzE3ZDY1MDUzMjNmOWZmZTg2YTA5MzlmOWMzNDZkMzFiNw==
6
+ OGFkMjdjNmJkNTI2M2U2N2NjMzYyMDAxNTdmNWJlOTA4NWNiNDJmZg==
7
7
  SHA512:
8
8
  metadata.gz: !binary |-
9
- YjA0ODUzYjA2ZjJkZWI5ZDc4MDJlMDk5NDA3ZmU5NWRjMDQ5YTA4ZjAzY2Y4
10
- NzgwNTU4M2YzMjk2MzM5YTk1M2M4NzM2YjIyZjI2NzE5ZDBkM2YyYTc5OWY3
11
- YjIyNWFhOWRhNzI5ZGJjMjdkN2I3Yjc2NDVlZThlZDBiZGQ4YTY=
9
+ NjExNTA5NzE5NTMwOGZlZTMwMWYxMjZkZDJiM2IwY2Y0MDI0NGM0Mjc4NWVh
10
+ ZTNmZWU3ODQwODI3YjU3YWFiNmM5NTE4ODBlYjQ3MWViZDlmZmRlYTQ1ZTM3
11
+ ZGUxYTczMjVmMzZlZmY0NDUxZWUwNWQ1NzgxNjJkZjEyMWFhYTM=
12
12
  data.tar.gz: !binary |-
13
- MWQxMDVjZWZkMjM2YjIyNGI0MzhhNGI0NWE4NmFlYzc0ZmRhMzNhZDVjYWZk
14
- Y2U2ODA1NjlkMmIxNDU4MmE5NzM0ZGE0NTNhZWIyNDc4NzQ3MTFlNDhiOGZj
15
- M2I0NzhiZmZjNmE0NjQ5OWRjYjEyNmQyYzFlOGUyZGM3ZjQ1Mjg=
13
+ MmJmN2NhYTg2ZGRlNjFmYjRmMDFhYWYyZGQyMGUxMDIxZjZkZDE0MjdhZTg5
14
+ NGZkZmRkZmQ4OTIyNjdlODM0ZGI4OWViNGM2OWE4OWM0MmJiYzcxMzFhMzE2
15
+ NjY1NjdiMGJiNDc5NTE5Yjg4MjdiZTQ5MTIwZjAwY2U0ZGQ0NDM=
@@ -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
- puts 'scheduling schema job'
29
- SchemaJob.perform_in(10, self)
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
- ReportJob.perform_in(60, self)
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.0
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