opentelemetry-instrumentation-rack 0.8.0 → 0.9.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
    CHANGED
    
    | @@ -1,7 +1,7 @@ | |
| 1 1 | 
             
            ---
         | 
| 2 2 | 
             
            SHA256:
         | 
| 3 | 
            -
              metadata.gz:  | 
| 4 | 
            -
              data.tar.gz:  | 
| 3 | 
            +
              metadata.gz: da15eb1a7360a4c6a0189f07aebf122466941c4ddd163563889875ac323beb95
         | 
| 4 | 
            +
              data.tar.gz: 12cd308af1eb73f7c9677f3822d9c3b683205115d0ee13878763ea0aaf6e5233
         | 
| 5 5 | 
             
            SHA512:
         | 
| 6 | 
            -
              metadata.gz:  | 
| 7 | 
            -
              data.tar.gz:  | 
| 6 | 
            +
              metadata.gz: aa1477e77df5e4607c51a0efba92bcf70faa77d2e06eb96e60a4ee7caae4385b8024e04bf1de2c1373880f11946b5d5d87e0d692af51a26bdd4d4e37e91a494b
         | 
| 7 | 
            +
              data.tar.gz: 7cc00ac3bc8d68e124e9c61c1f7805995f208fd5003cb8259252252373239485daf2234e1af89951441c20ce919f6c91424fcf9abafee045ff89f929fa95206d
         | 
    
        data/CHANGELOG.md
    CHANGED
    
    | @@ -1,5 +1,12 @@ | |
| 1 1 | 
             
            # Release History: opentelemetry-instrumentation-rack
         | 
| 2 2 |  | 
| 3 | 
            +
            ### v0.9.0 / 2020-11-27
         | 
| 4 | 
            +
             | 
| 5 | 
            +
            * BREAKING CHANGE: Add timeout for force_flush and shutdown 
         | 
| 6 | 
            +
             | 
| 7 | 
            +
            * ADDED: Instrument rails 
         | 
| 8 | 
            +
            * ADDED: Add timeout for force_flush and shutdown 
         | 
| 9 | 
            +
             | 
| 3 10 | 
             
            ### v0.8.0 / 2020-10-27
         | 
| 4 11 |  | 
| 5 12 | 
             
            * BREAKING CHANGE: Move context/span methods to Trace module 
         | 
| @@ -10,6 +10,40 @@ module OpenTelemetry | |
| 10 10 | 
             
              module Instrumentation
         | 
| 11 11 | 
             
                # Contains the OpenTelemetry instrumentation for the Rack gem
         | 
| 12 12 | 
             
                module Rack
         | 
| 13 | 
            +
                  extend self
         | 
| 14 | 
            +
             | 
| 15 | 
            +
                  CURRENT_SPAN_KEY = Context.create_key('current-span')
         | 
| 16 | 
            +
             | 
| 17 | 
            +
                  private_constant :CURRENT_SPAN_KEY
         | 
| 18 | 
            +
             | 
| 19 | 
            +
                  # Returns the current span from the current or provided context
         | 
| 20 | 
            +
                  #
         | 
| 21 | 
            +
                  # @param [optional Context] context The context to lookup the current
         | 
| 22 | 
            +
                  #   {Span} from. Defaults to Context.current
         | 
| 23 | 
            +
                  def current_span(context = nil)
         | 
| 24 | 
            +
                    context ||= Context.current
         | 
| 25 | 
            +
                    context.value(CURRENT_SPAN_KEY) || Span::INVALID
         | 
| 26 | 
            +
                  end
         | 
| 27 | 
            +
             | 
| 28 | 
            +
                  # Returns a context containing the span, derived from the optional parent
         | 
| 29 | 
            +
                  # context, or the current context if one was not provided.
         | 
| 30 | 
            +
                  #
         | 
| 31 | 
            +
                  # @param [optional Context] context The context to use as the parent for
         | 
| 32 | 
            +
                  #   the returned context
         | 
| 33 | 
            +
                  def context_with_span(span, parent_context: Context.current)
         | 
| 34 | 
            +
                    parent_context.set_value(CURRENT_SPAN_KEY, span)
         | 
| 35 | 
            +
                  end
         | 
| 36 | 
            +
             | 
| 37 | 
            +
                  # Activates/deactivates the Span within the current Context, which makes the "current span"
         | 
| 38 | 
            +
                  # available implicitly.
         | 
| 39 | 
            +
                  #
         | 
| 40 | 
            +
                  # On exit, the Span that was active before calling this method will be reactivated.
         | 
| 41 | 
            +
                  #
         | 
| 42 | 
            +
                  # @param [Span] span the span to activate
         | 
| 43 | 
            +
                  # @yield [span, context] yields span and a context containing the span to the block.
         | 
| 44 | 
            +
                  def with_span(span)
         | 
| 45 | 
            +
                    Context.with_value(CURRENT_SPAN_KEY, span) { |c, s| yield s, c }
         | 
| 46 | 
            +
                  end
         | 
| 13 47 | 
             
                end
         | 
| 14 48 | 
             
              end
         | 
| 15 49 | 
             
            end
         | 
| @@ -51,7 +51,7 @@ module OpenTelemetry | |
| 51 51 | 
             
                        @app = app
         | 
| 52 52 | 
             
                      end
         | 
| 53 53 |  | 
| 54 | 
            -
                      def call(env)
         | 
| 54 | 
            +
                      def call(env) # rubocop:disable Metrics/AbcSize
         | 
| 55 55 | 
             
                        original_env = env.dup
         | 
| 56 56 | 
             
                        extracted_context = OpenTelemetry.propagation.http.extract(env)
         | 
| 57 57 | 
             
                        frontend_context = create_frontend_span(env, extracted_context)
         | 
| @@ -63,8 +63,10 @@ module OpenTelemetry | |
| 63 63 | 
             
                          tracer.in_span(request_span_name,
         | 
| 64 64 | 
             
                                         attributes: request_span_attributes(env: env),
         | 
| 65 65 | 
             
                                         kind: request_span_kind) do |request_span|
         | 
| 66 | 
            -
                             | 
| 67 | 
            -
                               | 
| 66 | 
            +
                            OpenTelemetry::Instrumentation::Rack.with_span(request_span) do
         | 
| 67 | 
            +
                              @app.call(env).tap do |status, headers, response|
         | 
| 68 | 
            +
                                set_attributes_after_request(request_span, status, headers, response)
         | 
| 69 | 
            +
                              end
         | 
| 68 70 | 
             
                            end
         | 
| 69 71 | 
             
                          end
         | 
| 70 72 | 
             
                        end
         | 
| @@ -103,7 +105,8 @@ module OpenTelemetry | |
| 103 105 | 
             
                          'http.method' => env['REQUEST_METHOD'],
         | 
| 104 106 | 
             
                          'http.host' => env['HTTP_HOST'] || 'unknown',
         | 
| 105 107 | 
             
                          'http.scheme' => env['rack.url_scheme'],
         | 
| 106 | 
            -
                          'http.target' => fullpath(env)
         | 
| 108 | 
            +
                          'http.target' => fullpath(env),
         | 
| 109 | 
            +
                          'http.user_agent' => env['HTTP_USER_AGENT']
         | 
| 107 110 | 
             
                        }.merge(allowed_request_headers(env))
         | 
| 108 111 | 
             
                      end
         | 
| 109 112 |  | 
    
        metadata
    CHANGED
    
    | @@ -1,14 +1,14 @@ | |
| 1 1 | 
             
            --- !ruby/object:Gem::Specification
         | 
| 2 2 | 
             
            name: opentelemetry-instrumentation-rack
         | 
| 3 3 | 
             
            version: !ruby/object:Gem::Version
         | 
| 4 | 
            -
              version: 0. | 
| 4 | 
            +
              version: 0.9.0
         | 
| 5 5 | 
             
            platform: ruby
         | 
| 6 6 | 
             
            authors:
         | 
| 7 7 | 
             
            - OpenTelemetry Authors
         | 
| 8 8 | 
             
            autorequire: 
         | 
| 9 9 | 
             
            bindir: bin
         | 
| 10 10 | 
             
            cert_chain: []
         | 
| 11 | 
            -
            date: 2020- | 
| 11 | 
            +
            date: 2020-11-28 00:00:00.000000000 Z
         | 
| 12 12 | 
             
            dependencies:
         | 
| 13 13 | 
             
            - !ruby/object:Gem::Dependency
         | 
| 14 14 | 
             
              name: opentelemetry-api
         | 
| @@ -16,14 +16,14 @@ dependencies: | |
| 16 16 | 
             
                requirements:
         | 
| 17 17 | 
             
                - - "~>"
         | 
| 18 18 | 
             
                  - !ruby/object:Gem::Version
         | 
| 19 | 
            -
                    version: 0. | 
| 19 | 
            +
                    version: 0.9.0
         | 
| 20 20 | 
             
              type: :runtime
         | 
| 21 21 | 
             
              prerelease: false
         | 
| 22 22 | 
             
              version_requirements: !ruby/object:Gem::Requirement
         | 
| 23 23 | 
             
                requirements:
         | 
| 24 24 | 
             
                - - "~>"
         | 
| 25 25 | 
             
                  - !ruby/object:Gem::Version
         | 
| 26 | 
            -
                    version: 0. | 
| 26 | 
            +
                    version: 0.9.0
         | 
| 27 27 | 
             
            - !ruby/object:Gem::Dependency
         | 
| 28 28 | 
             
              name: appraisal
         | 
| 29 29 | 
             
              requirement: !ruby/object:Gem::Requirement
         | 
| @@ -214,10 +214,10 @@ homepage: https://github.com/open-telemetry/opentelemetry-ruby | |
| 214 214 | 
             
            licenses:
         | 
| 215 215 | 
             
            - Apache-2.0
         | 
| 216 216 | 
             
            metadata:
         | 
| 217 | 
            -
              changelog_uri: https://open-telemetry.github.io/opentelemetry-ruby/opentelemetry-instrumentation-rack/v0. | 
| 217 | 
            +
              changelog_uri: https://open-telemetry.github.io/opentelemetry-ruby/opentelemetry-instrumentation-rack/v0.9.0/file.CHANGELOG.html
         | 
| 218 218 | 
             
              source_code_uri: https://github.com/open-telemetry/opentelemetry-ruby/tree/master/instrumentation/rack
         | 
| 219 219 | 
             
              bug_tracker_uri: https://github.com/open-telemetry/opentelemetry-ruby/issues
         | 
| 220 | 
            -
              documentation_uri: https://open-telemetry.github.io/opentelemetry-ruby/opentelemetry-instrumentation-rack/v0. | 
| 220 | 
            +
              documentation_uri: https://open-telemetry.github.io/opentelemetry-ruby/opentelemetry-instrumentation-rack/v0.9.0
         | 
| 221 221 | 
             
            post_install_message: 
         | 
| 222 222 | 
             
            rdoc_options: []
         | 
| 223 223 | 
             
            require_paths:
         |