optics-agent 0.5.3 → 0.5.4

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: c0a16e6bcb59a19202e8fd8d27ee54144553f047
4
- data.tar.gz: 3afbe9155a7e006478d9f83d5e21878205f8deac
3
+ metadata.gz: 065cdcba6db6b8457fad1490b92d308e28391eef
4
+ data.tar.gz: d8ab5426156a69f208a48aba2a6c1ca32920d06a
5
5
  SHA512:
6
- metadata.gz: b329520e3efac3a5b884c5bba531cdf53fd246065092a7a2be252aef290d5fac15c8e6c10fc1d193237149d826ef8fb7d44d7966d518cfc552a6c56b9446d566
7
- data.tar.gz: 34372adda6e7e5a346ebdd9b19e41fc068c9b26b5b93fe783f003b5effce7fdfd0891fbbd081b6ab996f7276844ab8e94e51f18d590d776b63eece8b379507b5
6
+ metadata.gz: de45eae022f04a626a22b7bda8a38a1889f6e8879e85389b4ef802755adcb45a7a7d0502455720a3ce7a186fbd56d44bb126e9dc9b13475e04f7ebf88a8c5bc7
7
+ data.tar.gz: 7705bfd5c7b424d86452145acec4a3145d7a86fef118e2765f36e29ebae7c7f6e63a5fe9351f38fc84265206e19e602982c3936186b702e6b39c5cff5705b42c
@@ -27,7 +27,7 @@ If you don't want to instrument this query, pass `context: {optics_agent: :skip}
27
27
  query_context = query.context[:optics_agent]
28
28
  end
29
29
 
30
- query_context.with_document(query.query_string)
30
+ query_context.with_document(query.document.to_query_string)
31
31
  end
32
32
 
33
33
  def after_query(query)
@@ -95,7 +95,7 @@ module OpticsAgent::Reporting
95
95
  type = schema.types[type_stat.name]
96
96
  throw "Type #{type_stat.name} not found!" unless type
97
97
 
98
- field = type.fields[field_stat.name]
98
+ field = type.get_field(field_stat.name)
99
99
  throw "Field #{type_stat.name}.#{field_stat.name} not found!" unless field
100
100
 
101
101
  field_stat.returnType = field.type.to_s
@@ -12,7 +12,8 @@ module OpticsAgent::Reporting
12
12
  report.decorate_from_schema(agent.schema)
13
13
  report.send_with(agent)
14
14
  rescue Exception => e
15
- agent.debug "report failed #{e}"
15
+ agent.debug "stats report failed #{e}"
16
+ agent.debug e.backtrace
16
17
  end
17
18
  end
18
19
  end
@@ -31,7 +31,7 @@ module OpticsAgent::Reporting
31
31
  type = schema.types[type_name]
32
32
  next unless type.is_a? GraphQL::ObjectType
33
33
 
34
- fields = type.fields.values.map do |field|
34
+ fields = type.all_fields.map do |field|
35
35
  Field.new({
36
36
  name: field.name,
37
37
  # XXX: does this actually work for all types?
data/spec/schema_spec.rb CHANGED
@@ -5,10 +5,15 @@ include OpticsAgent::Reporting
5
5
 
6
6
  describe Schema do
7
7
  it "can collect the correct types from a schema" do
8
+ address_interface = GraphQL::InterfaceType.define do
9
+ name 'Address'
10
+ field :streetOne, types.String
11
+ end
8
12
  person_type = GraphQL::ObjectType.define do
9
13
  name 'Person'
10
14
  field :firstName, types.String
11
15
  field :lastName, types.String
16
+ interfaces [address_interface]
12
17
  end
13
18
  query_type = GraphQL::ObjectType.define do
14
19
  name 'Query'
@@ -17,6 +22,9 @@ describe Schema do
17
22
 
18
23
  schema = GraphQL::Schema.define do
19
24
  query query_type
25
+ resolve_type ->(object, context) do
26
+ # noop
27
+ end
20
28
  end
21
29
 
22
30
  schema_report = Schema.new(schema).message
@@ -25,7 +33,7 @@ describe Schema do
25
33
  expect(type.map &:name).to match_array(['Person', 'Query'])
26
34
 
27
35
  person_type = type.find { |t| t.name == 'Person' }
28
- expect(person_type.field.map &:name).to match_array(['firstName', 'lastName'])
36
+ expect(person_type.field.map &:name).to match_array(['firstName', 'lastName', 'streetOne'])
29
37
 
30
38
  firstName_field = person_type.field.find { |f| f.name === 'firstName' }
31
39
  expect(firstName_field.returnType).to eq('String')
metadata CHANGED
@@ -1,10 +1,10 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: optics-agent
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.5.3
4
+ version: 0.5.4
5
5
  platform: ruby
6
6
  authors:
7
- - 'Tom Coleman '
7
+ - Meteor Development Group
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
@@ -109,7 +109,7 @@ dependencies:
109
109
  - !ruby/object:Gem::Version
110
110
  version: '3.5'
111
111
  description: An Agent for Apollo Optics, http://optics.apollodata.com
112
- email: tom@meteor.com
112
+ email: vendor+optics@meteor.com
113
113
  executables: []
114
114
  extensions: []
115
115
  extra_rdoc_files: []