opentelemetry-instrumentation-graphql 0.31.1 → 0.31.2
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/CHANGELOG.md +5 -0
- data/lib/opentelemetry/instrumentation/graphql/instrumentation.rb +13 -0
- data/lib/opentelemetry/instrumentation/graphql/patches/dataloader.rb +23 -0
- data/lib/opentelemetry/instrumentation/graphql/tracers/graphql_trace.rb +4 -0
- data/lib/opentelemetry/instrumentation/graphql/version.rb +1 -1
- metadata +5 -4
    
        checksums.yaml
    CHANGED
    
    | @@ -1,7 +1,7 @@ | |
| 1 1 | 
             
            ---
         | 
| 2 2 | 
             
            SHA256:
         | 
| 3 | 
            -
              metadata.gz:  | 
| 4 | 
            -
              data.tar.gz:  | 
| 3 | 
            +
              metadata.gz: fc3089ebd46f04ed68628b754f5416fff8367b3745eb040339b58f8fc8b0cb61
         | 
| 4 | 
            +
              data.tar.gz: 4a89d9b32c7cfe68b54f41c2b3847a57058fcfc754082243882c4f2c7355dea4
         | 
| 5 5 | 
             
            SHA512:
         | 
| 6 | 
            -
              metadata.gz:  | 
| 7 | 
            -
              data.tar.gz:  | 
| 6 | 
            +
              metadata.gz: 3843bfe4e68c6c99e7c9c77f42f08bc3546ce6f347ac221d10b6bfe69d3a5a325565bd964efd236db1a4e4e5c2cce3430bdfb4a32863fcdec3c7dc02d5819efc
         | 
| 7 | 
            +
              data.tar.gz: cd85e203ccf20dde225534c3959a426abd7be2ee12fac0dc33a8961b6925821ad3dd14aebd13286ccc769f81a36d48cae947a338f34c69361271b5c9b4f9f84d
         | 
    
        data/CHANGELOG.md
    CHANGED
    
    | @@ -1,5 +1,10 @@ | |
| 1 1 | 
             
            # Release History: opentelemetry-instrumentation-graphql
         | 
| 2 2 |  | 
| 3 | 
            +
            ### v0.31.2 / 2025-10-28
         | 
| 4 | 
            +
             | 
| 5 | 
            +
            * FIXED: Patch dataloader to propagate context to new fiber
         | 
| 6 | 
            +
            * FIXED: Does not trace resolve type unless enable
         | 
| 7 | 
            +
             | 
| 3 8 | 
             
            ### v0.31.1 / 2025-10-22
         | 
| 4 9 |  | 
| 5 10 | 
             
            * FIXED: Update opentelemetry-instrumentation-base dependency
         | 
| @@ -27,6 +27,8 @@ module OpenTelemetry | |
| 27 27 | 
             
                        require_relative 'tracers/graphql_trace'
         | 
| 28 28 | 
             
                        install_new_tracer(config)
         | 
| 29 29 | 
             
                      end
         | 
| 30 | 
            +
             | 
| 31 | 
            +
                      patch
         | 
| 30 32 | 
             
                    end
         | 
| 31 33 |  | 
| 32 34 | 
             
                    present do
         | 
| @@ -41,6 +43,10 @@ module OpenTelemetry | |
| 41 43 | 
             
                      Gem::Requirement.new('>= 2.0.19').satisfied_by?(gem_version)
         | 
| 42 44 | 
             
                    end
         | 
| 43 45 |  | 
| 46 | 
            +
                    def dataloader_has_spawn_fiber?
         | 
| 47 | 
            +
                      Gem::Requirement.new('>= 2.1.8').satisfied_by?(gem_version)
         | 
| 48 | 
            +
                    end
         | 
| 49 | 
            +
             | 
| 44 50 | 
             
                    ## Supported configuration keys for the install config hash:
         | 
| 45 51 | 
             
                    #
         | 
| 46 52 | 
             
                    # The enable_platform_field key expects a boolean value,
         | 
| @@ -96,6 +102,13 @@ module OpenTelemetry | |
| 96 102 | 
             
                        end
         | 
| 97 103 | 
             
                      end
         | 
| 98 104 | 
             
                    end
         | 
| 105 | 
            +
             | 
| 106 | 
            +
                    def patch
         | 
| 107 | 
            +
                      return unless dataloader_has_spawn_fiber?
         | 
| 108 | 
            +
             | 
| 109 | 
            +
                      require_relative 'patches/dataloader'
         | 
| 110 | 
            +
                      ::GraphQL::Dataloader.prepend(Patches::Dataloader)
         | 
| 111 | 
            +
                    end
         | 
| 99 112 | 
             
                  end
         | 
| 100 113 | 
             
                end
         | 
| 101 114 | 
             
              end
         | 
| @@ -0,0 +1,23 @@ | |
| 1 | 
            +
            # frozen_string_literal: true
         | 
| 2 | 
            +
             | 
| 3 | 
            +
            # Copyright The OpenTelemetry Authors
         | 
| 4 | 
            +
            #
         | 
| 5 | 
            +
            # SPDX-License-Identifier: Apache-2.0
         | 
| 6 | 
            +
             | 
| 7 | 
            +
            module OpenTelemetry
         | 
| 8 | 
            +
              module Instrumentation
         | 
| 9 | 
            +
                module GraphQL
         | 
| 10 | 
            +
                  module Patches
         | 
| 11 | 
            +
                    # Patches GraphQL::Dataloader to propagate context to new fiber
         | 
| 12 | 
            +
                    module Dataloader
         | 
| 13 | 
            +
                      def spawn_fiber(&block)
         | 
| 14 | 
            +
                        ctx = OpenTelemetry::Context.current
         | 
| 15 | 
            +
                        super do
         | 
| 16 | 
            +
                          OpenTelemetry::Context.with_current(ctx, &block)
         | 
| 17 | 
            +
                        end
         | 
| 18 | 
            +
                      end
         | 
| 19 | 
            +
                    end
         | 
| 20 | 
            +
                  end
         | 
| 21 | 
            +
                end
         | 
| 22 | 
            +
              end
         | 
| 23 | 
            +
            end
         | 
| @@ -148,12 +148,16 @@ module OpenTelemetry | |
| 148 148 |  | 
| 149 149 | 
             
                      def resolve_type(query:, type:, object:, &)
         | 
| 150 150 | 
             
                        platform_key = @_otel_resolve_type_key_cache[type]
         | 
| 151 | 
            +
                        return super unless platform_key
         | 
| 152 | 
            +
             | 
| 151 153 | 
             
                        attributes = @_otel_type_attrs_cache[type]
         | 
| 152 154 | 
             
                        tracer.in_span(platform_key, attributes: attributes) { super }
         | 
| 153 155 | 
             
                      end
         | 
| 154 156 |  | 
| 155 157 | 
             
                      def resolve_type_lazy(query:, type:, object:, &)
         | 
| 156 158 | 
             
                        platform_key = @_otel_resolve_type_key_cache[type]
         | 
| 159 | 
            +
                        return super unless platform_key
         | 
| 160 | 
            +
             | 
| 157 161 | 
             
                        attributes = @_otel_lazy_type_attrs_cache[type]
         | 
| 158 162 | 
             
                        tracer.in_span(platform_key, attributes: attributes) { super }
         | 
| 159 163 | 
             
                      end
         | 
    
        metadata
    CHANGED
    
    | @@ -1,14 +1,14 @@ | |
| 1 1 | 
             
            --- !ruby/object:Gem::Specification
         | 
| 2 2 | 
             
            name: opentelemetry-instrumentation-graphql
         | 
| 3 3 | 
             
            version: !ruby/object:Gem::Version
         | 
| 4 | 
            -
              version: 0.31. | 
| 4 | 
            +
              version: 0.31.2
         | 
| 5 5 | 
             
            platform: ruby
         | 
| 6 6 | 
             
            authors:
         | 
| 7 7 | 
             
            - OpenTelemetry Authors
         | 
| 8 8 | 
             
            autorequire:
         | 
| 9 9 | 
             
            bindir: bin
         | 
| 10 10 | 
             
            cert_chain: []
         | 
| 11 | 
            -
            date: 2025-10- | 
| 11 | 
            +
            date: 2025-10-28 00:00:00.000000000 Z
         | 
| 12 12 | 
             
            dependencies:
         | 
| 13 13 | 
             
            - !ruby/object:Gem::Dependency
         | 
| 14 14 | 
             
              name: opentelemetry-instrumentation-base
         | 
| @@ -39,6 +39,7 @@ files: | |
| 39 39 | 
             
            - lib/opentelemetry/instrumentation.rb
         | 
| 40 40 | 
             
            - lib/opentelemetry/instrumentation/graphql.rb
         | 
| 41 41 | 
             
            - lib/opentelemetry/instrumentation/graphql/instrumentation.rb
         | 
| 42 | 
            +
            - lib/opentelemetry/instrumentation/graphql/patches/dataloader.rb
         | 
| 42 43 | 
             
            - lib/opentelemetry/instrumentation/graphql/tracers/graphql_trace.rb
         | 
| 43 44 | 
             
            - lib/opentelemetry/instrumentation/graphql/tracers/graphql_tracer.rb
         | 
| 44 45 | 
             
            - lib/opentelemetry/instrumentation/graphql/version.rb
         | 
| @@ -46,10 +47,10 @@ homepage: https://github.com/open-telemetry/opentelemetry-ruby-contrib | |
| 46 47 | 
             
            licenses:
         | 
| 47 48 | 
             
            - Apache-2.0
         | 
| 48 49 | 
             
            metadata:
         | 
| 49 | 
            -
              changelog_uri: https://rubydoc.info/gems/opentelemetry-instrumentation-graphql/0.31. | 
| 50 | 
            +
              changelog_uri: https://rubydoc.info/gems/opentelemetry-instrumentation-graphql/0.31.2/file/CHANGELOG.md
         | 
| 50 51 | 
             
              source_code_uri: https://github.com/open-telemetry/opentelemetry-ruby-contrib/tree/main/instrumentation/graphql
         | 
| 51 52 | 
             
              bug_tracker_uri: https://github.com/open-telemetry/opentelemetry-ruby-contrib/issues
         | 
| 52 | 
            -
              documentation_uri: https://rubydoc.info/gems/opentelemetry-instrumentation-graphql/0.31. | 
| 53 | 
            +
              documentation_uri: https://rubydoc.info/gems/opentelemetry-instrumentation-graphql/0.31.2
         | 
| 53 54 | 
             
            post_install_message:
         | 
| 54 55 | 
             
            rdoc_options: []
         | 
| 55 56 | 
             
            require_paths:
         |