apollo-tracing 1.4.0 → 1.5.0
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 +5 -5
- data/CHANGELOG.md +37 -1
- data/apollo-tracing.gemspec +1 -1
- data/lib/apollo_tracing.rb +1 -0
- data/lib/apollo_tracing/version.rb +1 -1
- data/spec/apollo_tracing_spec.rb +9 -0
- data/spec/fixtures/broken_schema.rb +28 -0
- metadata +6 -5
    
        checksums.yaml
    CHANGED
    
    | @@ -1,7 +1,7 @@ | |
| 1 1 | 
             
            ---
         | 
| 2 | 
            -
             | 
| 3 | 
            -
              metadata.gz:  | 
| 4 | 
            -
              data.tar.gz:  | 
| 2 | 
            +
            SHA256:
         | 
| 3 | 
            +
              metadata.gz: 5171bdac8a0d46dfdc045faa927383c098f65d510d92f51327c9dcf4a74e3a20
         | 
| 4 | 
            +
              data.tar.gz: 6aa9331609df986cc19ed96357e01397661234b6debd95dca7acbd5ab08ee816
         | 
| 5 5 | 
             
            SHA512:
         | 
| 6 | 
            -
              metadata.gz:  | 
| 7 | 
            -
              data.tar.gz:  | 
| 6 | 
            +
              metadata.gz: 8dce861b03485ccf93eceb19a7e0e5816aadae4d2ad187fccb86726844eaf389db509f28cff4d73168303b5b9ef494de3d64f3f6ffd032b092a85f9bd92e0dbf
         | 
| 7 | 
            +
              data.tar.gz: 270844d5c18139873b3dd4bb83db25030cf2a84aee46aba18b0c851eecbd8dc6c6ec904fff1549fbac22d0d6a3a5eb5135153b81de08e006b906115d4fd2bed3
         | 
    
        data/CHANGELOG.md
    CHANGED
    
    | @@ -8,14 +8,50 @@ one of the following labels: `Added`, `Changed`, `Deprecated`, | |
| 8 8 | 
             
            to manage the versions of this gem so
         | 
| 9 9 | 
             
            that you can set version constraints properly.
         | 
| 10 10 |  | 
| 11 | 
            -
            #### [Unreleased](https://github.com/uniiverse/apollo-tracing-ruby/compare/v1. | 
| 11 | 
            +
            #### [Unreleased](https://github.com/uniiverse/apollo-tracing-ruby/compare/v1.5.0...HEAD)
         | 
| 12 12 |  | 
| 13 13 | 
             
            * WIP
         | 
| 14 14 |  | 
| 15 | 
            +
            #### [v1.5.0](https://github.com/uniiverse/apollo-tracing-ruby/compare/v1.4.0...v1.5.0) – 2018-03-12
         | 
| 16 | 
            +
             | 
| 17 | 
            +
            * `Fixed`: Avoid trying to instrument failed query results. [#7](https://github.com/uniiverse/apollo-tracing-ruby/pull/7)
         | 
| 18 | 
            +
            * `Changed`: Drop support for `graphql` version `1.6`. [c88e6bb](https://github.com/uniiverse/apollo-tracing-ruby/commit/c88e6bb4de575665df15714e23a5cd23755b2cf1)
         | 
| 19 | 
            +
             | 
| 15 20 | 
             
            #### [v1.4.0](https://github.com/uniiverse/apollo-tracing-ruby/compare/v1.3.0...v1.4.0) – 2018-02-09
         | 
| 16 21 |  | 
| 17 22 | 
             
            * `Changed`: Apollo Engine Proxy version to [2018.02-2-g0b77ff3e3](https://www.apollographql.com/docs/engine/proxy-release-notes.html#2018.02-2-g0b77ff3e3) to fix using arrays as arguments. [#9](https://github.com/uniiverse/apollo-tracing-ruby/pull/9)
         | 
| 18 23 |  | 
| 24 | 
            +
            Please note, that if you use multiple origins:
         | 
| 25 | 
            +
             | 
| 26 | 
            +
            ```
         | 
| 27 | 
            +
            {
         | 
| 28 | 
            +
              "origins": [
         | 
| 29 | 
            +
                { "http": { "url": "http://localhost:3000/graphql/beta" } },
         | 
| 30 | 
            +
                { "http": { "url": "http://localhost:3000/graphql" } }
         | 
| 31 | 
            +
              ],
         | 
| 32 | 
            +
              "frontends": [
         | 
| 33 | 
            +
                { "host": "localhost", "port": 3001, "endpoint": "/graphql/beta" },
         | 
| 34 | 
            +
                { "host": "localhost", "port": 3001, "endpoint": "/graphql" }
         | 
| 35 | 
            +
              ]
         | 
| 36 | 
            +
              ...
         | 
| 37 | 
            +
            }
         | 
| 38 | 
            +
            ```
         | 
| 39 | 
            +
             | 
| 40 | 
            +
            Each origin should have a unique name now, was introduced in [2017.12-28-gcc16cbea7](https://www.apollographql.com/docs/engine/proxy-release-notes.html#2017.12-28-gcc16cbea7) Apollo Engine Proxy version:
         | 
| 41 | 
            +
             | 
| 42 | 
            +
            ```
         | 
| 43 | 
            +
            {
         | 
| 44 | 
            +
              "origins": [
         | 
| 45 | 
            +
                { "http": { "url": "http://localhost:3000/graphql/beta" }, "name": "graphql-beta" },
         | 
| 46 | 
            +
                { "http": { "url": "http://localhost:3000/graphql" }, "name": "graphql" }
         | 
| 47 | 
            +
              ],
         | 
| 48 | 
            +
              "frontends": [
         | 
| 49 | 
            +
                { "host": "localhost", "port": 3001, "endpoints": ["/graphql/beta", "/graphql"], "originName": "graphql" }
         | 
| 50 | 
            +
              ]
         | 
| 51 | 
            +
              ...
         | 
| 52 | 
            +
            }
         | 
| 53 | 
            +
            ```
         | 
| 54 | 
            +
             | 
| 19 55 | 
             
            #### [v1.3.0](https://github.com/uniiverse/apollo-tracing-ruby/compare/v1.2.1...v1.3.0) – 2017-11-09
         | 
| 20 56 |  | 
| 21 57 | 
             
            * `Changed`: Apollo Engine Proxy version to [2017.11-40-g9585bfc6](https://www.apollographql.com/docs/engine/proxy-release-notes.html#2017-11-40-g9585bfc6).
         | 
    
        data/apollo-tracing.gemspec
    CHANGED
    
    | @@ -28,7 +28,7 @@ Gem::Specification.new do |spec| | |
| 28 28 |  | 
| 29 29 | 
             
              spec.required_ruby_version = '>= 2.1.0' # keyword args
         | 
| 30 30 |  | 
| 31 | 
            -
              spec.add_runtime_dependency "graphql", ">= 1. | 
| 31 | 
            +
              spec.add_runtime_dependency "graphql", ">= 1.7.0", "< 2"
         | 
| 32 32 |  | 
| 33 33 | 
             
              spec.add_development_dependency "bundler", "~> 1.14"
         | 
| 34 34 | 
             
              spec.add_development_dependency "rake", "~> 10.0"
         | 
    
        data/lib/apollo_tracing.rb
    CHANGED
    
    | @@ -60,6 +60,7 @@ class ApolloTracing | |
| 60 60 |  | 
| 61 61 | 
             
              def after_query(query)
         | 
| 62 62 | 
             
                result = query.result
         | 
| 63 | 
            +
                return if result.nil? || result.to_h.nil?
         | 
| 63 64 | 
             
                end_time = Time.now.utc
         | 
| 64 65 | 
             
                duration_nanos = duration_nanos(start_time: query.context['apollo-tracing']['start_time'], end_time: end_time)
         | 
| 65 66 |  | 
    
        data/spec/apollo_tracing_spec.rb
    CHANGED
    
    | @@ -3,6 +3,7 @@ require "spec_helper" | |
| 3 3 | 
             
            require 'fixtures/user'
         | 
| 4 4 | 
             
            require 'fixtures/post'
         | 
| 5 5 | 
             
            require 'fixtures/schema'
         | 
| 6 | 
            +
            require 'fixtures/broken_schema'
         | 
| 6 7 |  | 
| 7 8 | 
             
            RSpec.describe ApolloTracing do
         | 
| 8 9 | 
             
              describe '.start_proxy' do
         | 
| @@ -29,6 +30,14 @@ RSpec.describe ApolloTracing do | |
| 29 30 | 
             
              end
         | 
| 30 31 |  | 
| 31 32 | 
             
              context 'introspection' do
         | 
| 33 | 
            +
                it 'supports a nil result for failures' do
         | 
| 34 | 
            +
                  query = 'query($user_id: ID!) { posts(user_id: $user_id) { id title user_id } }'
         | 
| 35 | 
            +
             | 
| 36 | 
            +
                  expect {
         | 
| 37 | 
            +
                    BrokenSchema.execute(query, variables: { 'user_id' => '1' })
         | 
| 38 | 
            +
                  }.to raise_error(NoMethodError, /undefined method `title' for/)
         | 
| 39 | 
            +
                end
         | 
| 40 | 
            +
             | 
| 32 41 | 
             
                it 'returns time in RFC 3339 format' do
         | 
| 33 42 | 
             
                  query = "query($user_id: ID!) { posts(user_id: $user_id) { id title user_id } }"
         | 
| 34 43 | 
             
                  now = Time.new(2017, 8, 25, 0, 0, 0, '+00:00')
         | 
| @@ -0,0 +1,28 @@ | |
| 1 | 
            +
            # frozen_string_literal: true
         | 
| 2 | 
            +
             | 
| 3 | 
            +
            require 'ostruct'
         | 
| 4 | 
            +
             | 
| 5 | 
            +
            BadPostType = GraphQL::ObjectType.define do
         | 
| 6 | 
            +
              name 'Foo'
         | 
| 7 | 
            +
              description 'See also PostType, for a working version of this'
         | 
| 8 | 
            +
             | 
| 9 | 
            +
              field :id, !types.String, hash_key: :id
         | 
| 10 | 
            +
              field :user_id, !types.String, hash_key: :user_id
         | 
| 11 | 
            +
              field :title, !types.String # This is the intended broken-ness: missing a hash_key setting
         | 
| 12 | 
            +
            end
         | 
| 13 | 
            +
             | 
| 14 | 
            +
            BrokenQueryType = GraphQL::ObjectType.define do
         | 
| 15 | 
            +
              name 'BrokenQuery'
         | 
| 16 | 
            +
              description 'See also QueryType, for a working version of this'
         | 
| 17 | 
            +
              field :posts, !types[!BadPostType] do
         | 
| 18 | 
            +
                argument :user_id, !types.ID
         | 
| 19 | 
            +
                resolve ->(_obj, _args, _ctx) {
         | 
| 20 | 
            +
                  [ { id: 'foo1', title: 'titel1', user_id: 'Sven'} ]
         | 
| 21 | 
            +
                }
         | 
| 22 | 
            +
              end
         | 
| 23 | 
            +
            end
         | 
| 24 | 
            +
             | 
| 25 | 
            +
            BrokenSchema = GraphQL::Schema.define do
         | 
| 26 | 
            +
              query BrokenQueryType
         | 
| 27 | 
            +
              use ApolloTracing.new
         | 
| 28 | 
            +
            end
         | 
    
        metadata
    CHANGED
    
    | @@ -1,7 +1,7 @@ | |
| 1 1 | 
             
            --- !ruby/object:Gem::Specification
         | 
| 2 2 | 
             
            name: apollo-tracing
         | 
| 3 3 | 
             
            version: !ruby/object:Gem::Version
         | 
| 4 | 
            -
              version: 1. | 
| 4 | 
            +
              version: 1.5.0
         | 
| 5 5 | 
             
            platform: ruby
         | 
| 6 6 | 
             
            authors:
         | 
| 7 7 | 
             
            - Reginald Suh
         | 
| @@ -9,7 +9,7 @@ authors: | |
| 9 9 | 
             
            autorequire: 
         | 
| 10 10 | 
             
            bindir: exe
         | 
| 11 11 | 
             
            cert_chain: []
         | 
| 12 | 
            -
            date: 2018- | 
| 12 | 
            +
            date: 2018-03-12 00:00:00.000000000 Z
         | 
| 13 13 | 
             
            dependencies:
         | 
| 14 14 | 
             
            - !ruby/object:Gem::Dependency
         | 
| 15 15 | 
             
              name: graphql
         | 
| @@ -17,7 +17,7 @@ dependencies: | |
| 17 17 | 
             
                requirements:
         | 
| 18 18 | 
             
                - - ">="
         | 
| 19 19 | 
             
                  - !ruby/object:Gem::Version
         | 
| 20 | 
            -
                    version: 1. | 
| 20 | 
            +
                    version: 1.7.0
         | 
| 21 21 | 
             
                - - "<"
         | 
| 22 22 | 
             
                  - !ruby/object:Gem::Version
         | 
| 23 23 | 
             
                    version: '2'
         | 
| @@ -27,7 +27,7 @@ dependencies: | |
| 27 27 | 
             
                requirements:
         | 
| 28 28 | 
             
                - - ">="
         | 
| 29 29 | 
             
                  - !ruby/object:Gem::Version
         | 
| 30 | 
            -
                    version: 1. | 
| 30 | 
            +
                    version: 1.7.0
         | 
| 31 31 | 
             
                - - "<"
         | 
| 32 32 | 
             
                  - !ruby/object:Gem::Version
         | 
| 33 33 | 
             
                    version: '2'
         | 
| @@ -117,6 +117,7 @@ files: | |
| 117 117 | 
             
            - lib/apollo_tracing/version.rb
         | 
| 118 118 | 
             
            - spec/apollo_tracing_spec.rb
         | 
| 119 119 | 
             
            - spec/fixtures/apollo-engine-proxy.json
         | 
| 120 | 
            +
            - spec/fixtures/broken_schema.rb
         | 
| 120 121 | 
             
            - spec/fixtures/post.rb
         | 
| 121 122 | 
             
            - spec/fixtures/schema.rb
         | 
| 122 123 | 
             
            - spec/fixtures/user.rb
         | 
| @@ -141,7 +142,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement | |
| 141 142 | 
             
                  version: '0'
         | 
| 142 143 | 
             
            requirements: []
         | 
| 143 144 | 
             
            rubyforge_project: 
         | 
| 144 | 
            -
            rubygems_version: 2.6 | 
| 145 | 
            +
            rubygems_version: 2.7.6
         | 
| 145 146 | 
             
            signing_key: 
         | 
| 146 147 | 
             
            specification_version: 4
         | 
| 147 148 | 
             
            summary: Ruby implementation of GraphQL trace data in the Apollo Tracing format.
         |