instana 0.15.0 → 1.0.1
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/Troubleshooting.md +32 -0
 - data/lib/instana/agent.rb +1 -1
 - data/lib/instana/instrumentation/excon.rb +3 -2
 - data/lib/instana/instrumentation/net-http.rb +3 -2
 - data/lib/instana/instrumentation/rack.rb +4 -4
 - data/lib/instana/logger.rb +10 -4
 - data/lib/instana/opentracing/carrier.rb +4 -0
 - data/lib/instana/opentracing/tracer.rb +18 -0
 - data/lib/instana/setup.rb +3 -0
 - data/lib/instana/tracer.rb +107 -68
 - data/lib/instana/tracing/processor.rb +5 -6
 - data/lib/instana/tracing/span.rb +322 -2
 - data/lib/instana/tracing/span_context.rb +31 -0
 - data/lib/instana/tracing/trace.rb +51 -190
 - data/lib/instana/util.rb +77 -0
 - data/lib/instana/version.rb +1 -1
 - data/lib/opentracing.rb +6 -0
 - metadata +8 -3
 
    
        data/lib/instana/util.rb
    CHANGED
    
    | 
         @@ -21,6 +21,24 @@ module Instana 
     | 
|
| 
       21 
21 
     | 
    
         
             
                    end
         
     | 
| 
       22 
22 
     | 
    
         
             
                  end
         
     | 
| 
       23 
23 
     | 
    
         | 
| 
      
 24 
     | 
    
         
            +
                  # Calls on target_class to 'extend' cls
         
     | 
| 
      
 25 
     | 
    
         
            +
                  #
         
     | 
| 
      
 26 
     | 
    
         
            +
                  # @param target_cls [Object] the class/module to do the 'extending'
         
     | 
| 
      
 27 
     | 
    
         
            +
                  # @param cls [Object] the class/module to be 'extended'
         
     | 
| 
      
 28 
     | 
    
         
            +
                  #
         
     | 
| 
      
 29 
     | 
    
         
            +
                  def send_extend(target_cls, cls)
         
     | 
| 
      
 30 
     | 
    
         
            +
                    target_cls.send(:extend, cls) if defined?(target_cls)
         
     | 
| 
      
 31 
     | 
    
         
            +
                  end
         
     | 
| 
      
 32 
     | 
    
         
            +
             
     | 
| 
      
 33 
     | 
    
         
            +
                  # Calls on <target_cls> to include <cls> into itself.
         
     | 
| 
      
 34 
     | 
    
         
            +
                  #
         
     | 
| 
      
 35 
     | 
    
         
            +
                  # @param target_cls [Object] the class/module to do the 'including'
         
     | 
| 
      
 36 
     | 
    
         
            +
                  # @param cls [Object] the class/module to be 'included'
         
     | 
| 
      
 37 
     | 
    
         
            +
                  #
         
     | 
| 
      
 38 
     | 
    
         
            +
                  def send_include(target_cls, cls)
         
     | 
| 
      
 39 
     | 
    
         
            +
                    target_cls.send(:include, cls) if defined?(target_cls)
         
     | 
| 
      
 40 
     | 
    
         
            +
                  end
         
     | 
| 
      
 41 
     | 
    
         
            +
             
     | 
| 
       24 
42 
     | 
    
         
             
                  # Take two hashes, and make sure candidate does not have
         
     | 
| 
       25 
43 
     | 
    
         
             
                  # any of the same values as `last`.  We only report
         
     | 
| 
       26 
44 
     | 
    
         
             
                  # when values change.
         
     | 
| 
         @@ -145,6 +163,65 @@ module Instana 
     | 
|
| 
       145 
163 
     | 
    
         
             
                    process[:report_pid] = nil
         
     | 
| 
       146 
164 
     | 
    
         
             
                    process
         
     | 
| 
       147 
165 
     | 
    
         
             
                  end
         
     | 
| 
      
 166 
     | 
    
         
            +
             
     | 
| 
      
 167 
     | 
    
         
            +
                  # Get the current time in milliseconds
         
     | 
| 
      
 168 
     | 
    
         
            +
                  #
         
     | 
| 
      
 169 
     | 
    
         
            +
                  # @return [Integer] the current time in milliseconds
         
     | 
| 
      
 170 
     | 
    
         
            +
                  #
         
     | 
| 
      
 171 
     | 
    
         
            +
                  def ts_now
         
     | 
| 
      
 172 
     | 
    
         
            +
                    (Time.now.to_f * 1000).floor
         
     | 
| 
      
 173 
     | 
    
         
            +
                  end
         
     | 
| 
      
 174 
     | 
    
         
            +
             
     | 
| 
      
 175 
     | 
    
         
            +
                  # Convert a Time value to milliseconds
         
     | 
| 
      
 176 
     | 
    
         
            +
                  #
         
     | 
| 
      
 177 
     | 
    
         
            +
                  # @param time [Time]
         
     | 
| 
      
 178 
     | 
    
         
            +
                  #
         
     | 
| 
      
 179 
     | 
    
         
            +
                  def time_to_ms(time = Time.now)
         
     | 
| 
      
 180 
     | 
    
         
            +
                    (time.to_f * 1000).floor
         
     | 
| 
      
 181 
     | 
    
         
            +
                  end
         
     | 
| 
      
 182 
     | 
    
         
            +
             
     | 
| 
      
 183 
     | 
    
         
            +
                  # Generate a random 64bit ID
         
     | 
| 
      
 184 
     | 
    
         
            +
                  #
         
     | 
| 
      
 185 
     | 
    
         
            +
                  # @return [Integer] a random 64bit integer
         
     | 
| 
      
 186 
     | 
    
         
            +
                  #
         
     | 
| 
      
 187 
     | 
    
         
            +
                  def generate_id
         
     | 
| 
      
 188 
     | 
    
         
            +
                    # Max value is 9223372036854775807 (signed long in Java)
         
     | 
| 
      
 189 
     | 
    
         
            +
                    rand(-2**63..2**63-1)
         
     | 
| 
      
 190 
     | 
    
         
            +
                  end
         
     | 
| 
      
 191 
     | 
    
         
            +
             
     | 
| 
      
 192 
     | 
    
         
            +
                  # Convert an ID to a value appropriate to pass in a header.
         
     | 
| 
      
 193 
     | 
    
         
            +
                  #
         
     | 
| 
      
 194 
     | 
    
         
            +
                  # @param id [Integer] the id to be converted
         
     | 
| 
      
 195 
     | 
    
         
            +
                  #
         
     | 
| 
      
 196 
     | 
    
         
            +
                  # @return [String]
         
     | 
| 
      
 197 
     | 
    
         
            +
                  #
         
     | 
| 
      
 198 
     | 
    
         
            +
                  def id_to_header(id)
         
     | 
| 
      
 199 
     | 
    
         
            +
                    unless id.is_a?(Integer) || id.is_a?(String)
         
     | 
| 
      
 200 
     | 
    
         
            +
                      Instana.logger.debug "id_to_header received a #{id.class}: returning empty string"
         
     | 
| 
      
 201 
     | 
    
         
            +
                      return String.new
         
     | 
| 
      
 202 
     | 
    
         
            +
                    end
         
     | 
| 
      
 203 
     | 
    
         
            +
                    [id.to_i].pack('q>').unpack('H*')[0]
         
     | 
| 
      
 204 
     | 
    
         
            +
                  rescue => e
         
     | 
| 
      
 205 
     | 
    
         
            +
                    Instana.logger.error "#{__method__}:#{File.basename(__FILE__)}:#{__LINE__}: #{e.message}"
         
     | 
| 
      
 206 
     | 
    
         
            +
                    Instana.logger.debug e.backtrace.join("\r\n")
         
     | 
| 
      
 207 
     | 
    
         
            +
                  end
         
     | 
| 
      
 208 
     | 
    
         
            +
             
     | 
| 
      
 209 
     | 
    
         
            +
                  # Convert a received header value into a valid ID
         
     | 
| 
      
 210 
     | 
    
         
            +
                  #
         
     | 
| 
      
 211 
     | 
    
         
            +
                  # @param header_id [String] the header value to be converted
         
     | 
| 
      
 212 
     | 
    
         
            +
                  #
         
     | 
| 
      
 213 
     | 
    
         
            +
                  # @return [Integer]
         
     | 
| 
      
 214 
     | 
    
         
            +
                  #
         
     | 
| 
      
 215 
     | 
    
         
            +
                  def header_to_id(header_id)
         
     | 
| 
      
 216 
     | 
    
         
            +
                    if !header_id.is_a?(String)
         
     | 
| 
      
 217 
     | 
    
         
            +
                      Instana.logger.debug "header_to_id received a #{header_id.class}: returning 0"
         
     | 
| 
      
 218 
     | 
    
         
            +
                      return 0
         
     | 
| 
      
 219 
     | 
    
         
            +
                    end
         
     | 
| 
      
 220 
     | 
    
         
            +
                    [header_id].pack("H*").unpack("q>")[0]
         
     | 
| 
      
 221 
     | 
    
         
            +
                  rescue => e
         
     | 
| 
      
 222 
     | 
    
         
            +
                    Instana.logger.error "#{__method__}:#{File.basename(__FILE__)}:#{__LINE__}: #{e.message}"
         
     | 
| 
      
 223 
     | 
    
         
            +
                    Instana.logger.debug e.backtrace.join("\r\n")
         
     | 
| 
      
 224 
     | 
    
         
            +
                  end
         
     | 
| 
       148 
225 
     | 
    
         
             
                end
         
     | 
| 
       149 
226 
     | 
    
         
             
              end
         
     | 
| 
       150 
227 
     | 
    
         
             
            end
         
     | 
    
        data/lib/instana/version.rb
    CHANGED
    
    
    
        data/lib/opentracing.rb
    ADDED
    
    
    
        metadata
    CHANGED
    
    | 
         @@ -1,14 +1,14 @@ 
     | 
|
| 
       1 
1 
     | 
    
         
             
            --- !ruby/object:Gem::Specification
         
     | 
| 
       2 
2 
     | 
    
         
             
            name: instana
         
     | 
| 
       3 
3 
     | 
    
         
             
            version: !ruby/object:Gem::Version
         
     | 
| 
       4 
     | 
    
         
            -
              version: 0. 
     | 
| 
      
 4 
     | 
    
         
            +
              version: 1.0.1
         
     | 
| 
       5 
5 
     | 
    
         
             
            platform: ruby
         
     | 
| 
       6 
6 
     | 
    
         
             
            authors:
         
     | 
| 
       7 
7 
     | 
    
         
             
            - Peter Giacomo Lombardo
         
     | 
| 
       8 
8 
     | 
    
         
             
            autorequire: 
         
     | 
| 
       9 
9 
     | 
    
         
             
            bindir: exe
         
     | 
| 
       10 
10 
     | 
    
         
             
            cert_chain: []
         
     | 
| 
       11 
     | 
    
         
            -
            date:  
     | 
| 
      
 11 
     | 
    
         
            +
            date: 2017-01-10 00:00:00.000000000 Z
         
     | 
| 
       12 
12 
     | 
    
         
             
            dependencies:
         
     | 
| 
       13 
13 
     | 
    
         
             
            - !ruby/object:Gem::Dependency
         
     | 
| 
       14 
14 
     | 
    
         
             
              name: bundler
         
     | 
| 
         @@ -124,6 +124,7 @@ files: 
     | 
|
| 
       124 
124 
     | 
    
         
             
            - README.md
         
     | 
| 
       125 
125 
     | 
    
         
             
            - Rakefile
         
     | 
| 
       126 
126 
     | 
    
         
             
            - Tracing.md
         
     | 
| 
      
 127 
     | 
    
         
            +
            - Troubleshooting.md
         
     | 
| 
       127 
128 
     | 
    
         
             
            - bin/console
         
     | 
| 
       128 
129 
     | 
    
         
             
            - bin/setup
         
     | 
| 
       129 
130 
     | 
    
         
             
            - examples/tracing.rb
         
     | 
| 
         @@ -149,15 +150,19 @@ files: 
     | 
|
| 
       149 
150 
     | 
    
         
             
            - lib/instana/instrumentation/rack.rb
         
     | 
| 
       150 
151 
     | 
    
         
             
            - lib/instana/instrumentation/rest-client.rb
         
     | 
| 
       151 
152 
     | 
    
         
             
            - lib/instana/logger.rb
         
     | 
| 
      
 153 
     | 
    
         
            +
            - lib/instana/opentracing/carrier.rb
         
     | 
| 
      
 154 
     | 
    
         
            +
            - lib/instana/opentracing/tracer.rb
         
     | 
| 
       152 
155 
     | 
    
         
             
            - lib/instana/rack.rb
         
     | 
| 
       153 
156 
     | 
    
         
             
            - lib/instana/setup.rb
         
     | 
| 
       154 
157 
     | 
    
         
             
            - lib/instana/thread_local.rb
         
     | 
| 
       155 
158 
     | 
    
         
             
            - lib/instana/tracer.rb
         
     | 
| 
       156 
159 
     | 
    
         
             
            - lib/instana/tracing/processor.rb
         
     | 
| 
       157 
160 
     | 
    
         
             
            - lib/instana/tracing/span.rb
         
     | 
| 
      
 161 
     | 
    
         
            +
            - lib/instana/tracing/span_context.rb
         
     | 
| 
       158 
162 
     | 
    
         
             
            - lib/instana/tracing/trace.rb
         
     | 
| 
       159 
163 
     | 
    
         
             
            - lib/instana/util.rb
         
     | 
| 
       160 
164 
     | 
    
         
             
            - lib/instana/version.rb
         
     | 
| 
      
 165 
     | 
    
         
            +
            - lib/opentracing.rb
         
     | 
| 
       161 
166 
     | 
    
         
             
            homepage: https://www.instana.com/
         
     | 
| 
       162 
167 
     | 
    
         
             
            licenses: []
         
     | 
| 
       163 
168 
     | 
    
         
             
            metadata: {}
         
     | 
| 
         @@ -177,7 +182,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement 
     | 
|
| 
       177 
182 
     | 
    
         
             
                  version: '0'
         
     | 
| 
       178 
183 
     | 
    
         
             
            requirements: []
         
     | 
| 
       179 
184 
     | 
    
         
             
            rubyforge_project: 
         
     | 
| 
       180 
     | 
    
         
            -
            rubygems_version: 2.5. 
     | 
| 
      
 185 
     | 
    
         
            +
            rubygems_version: 2.5.2
         
     | 
| 
       181 
186 
     | 
    
         
             
            signing_key: 
         
     | 
| 
       182 
187 
     | 
    
         
             
            specification_version: 4
         
     | 
| 
       183 
188 
     | 
    
         
             
            summary: Ruby sensor for Instana
         
     |