elastic-apm 1.0.0.beta1 → 1.0.0.beta2
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.
Potentially problematic release.
This version of elastic-apm might be problematic. Click here for more details.
- checksums.yaml +4 -4
- data/CHANGELOG.md +11 -1
- data/README.md +19 -7
- data/docs/configuration.asciidoc +13 -3
- data/lib/elastic_apm/config.rb +4 -0
- data/lib/elastic_apm/http.rb +5 -0
- data/lib/elastic_apm/normalizers/active_record.rb +1 -1
- data/lib/elastic_apm/span/context.rb +1 -1
- data/lib/elastic_apm/spies/elasticsearch.rb +4 -1
- data/lib/elastic_apm/version.rb +1 -1
- metadata +2 -2
    
        checksums.yaml
    CHANGED
    
    | @@ -1,7 +1,7 @@ | |
| 1 1 | 
             
            ---
         | 
| 2 2 | 
             
            SHA256:
         | 
| 3 | 
            -
              metadata.gz:  | 
| 4 | 
            -
              data.tar.gz:  | 
| 3 | 
            +
              metadata.gz: 21a3aac2c28d8806a3f8703746bc0cfb81620680c4daba5393bc27f88b15b213
         | 
| 4 | 
            +
              data.tar.gz: 18faebc9de42ca039c12d5ce97791c51186d5bdabbf0276078a4906c415741dc
         | 
| 5 5 | 
             
            SHA512:
         | 
| 6 | 
            -
              metadata.gz:  | 
| 7 | 
            -
              data.tar.gz:  | 
| 6 | 
            +
              metadata.gz: 7fff60cded68fdac8b9b3dfdd0cbd88a2e7fc91007cfd80c78278281493c152ab0115e4145665e4b6bd3c946f4fd8956e5b4c4036a4bf14a6f7f1dd00024dce0
         | 
| 7 | 
            +
              data.tar.gz: 7d87ef00a486b5bcc7d84f1c98ade6a3eb997f042685f608de3c6421762706ce20309aa8e1b6a9ac3a87b23f7d21a555ef9a5f87270ead7c0bb04290e87ea7d6
         | 
    
        data/CHANGELOG.md
    CHANGED
    
    | @@ -4,7 +4,17 @@ All notable changes to this project will be documented in this file. | |
| 4 4 |  | 
| 5 5 | 
             
            This project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.html).
         | 
| 6 6 |  | 
| 7 | 
            -
            ## 1.0.0. | 
| 7 | 
            +
            ## 1.0.0.beta2 (2018-06-21)
         | 
| 8 | 
            +
             | 
| 9 | 
            +
            ### Added
         | 
| 10 | 
            +
             | 
| 11 | 
            +
            - Added config.disable_send ([#156](https://github.com/elastic/apm-agent-ruby/pulls/156))
         | 
| 12 | 
            +
             | 
| 13 | 
            +
            ### Fixed
         | 
| 14 | 
            +
             | 
| 15 | 
            +
            - Fixed some Elasticsearch spans not validating JSON Schema ([#157](https://github.com/elastic/apm-agent-ruby/pulls/157))
         | 
| 16 | 
            +
             | 
| 17 | 
            +
            ## 1.0.0.beta1 (2018-06-14)
         | 
| 8 18 |  | 
| 9 19 | 
             
            ## 0.8.0 (2018-06-13)
         | 
| 10 20 |  | 
    
        data/README.md
    CHANGED
    
    | @@ -1,9 +1,23 @@ | |
| 1 1 | 
             
            # elastic-apm
         | 
| 2 | 
            -
            ## Elastic APM agent for ♦️Ruby | 
| 2 | 
            +
            ## Elastic APM agent for ♦️Ruby
         | 
| 3 3 |  | 
| 4 4 | 
             
            [](https://apm-ci.elastic.co/job/elastic+apm-agent-ruby+master/) [](https://rubygems.org/gems/elastic-apm)
         | 
| 5 5 |  | 
| 6 | 
            -
             | 
| 6 | 
            +
            The official Rubygem for [Elastic][] [APM][].
         | 
| 7 | 
            +
             | 
| 8 | 
            +
            **🚧 NB:** The current version of the agent is `1.0.0.beta1`. This means we're really close to `1.0.0`. The API is stable and the only remaining thing to do is testing. Thank you if you've already been testing the agent!
         | 
| 9 | 
            +
             | 
| 10 | 
            +
            To test the prerelease:
         | 
| 11 | 
            +
             | 
| 12 | 
            +
            ```sh
         | 
| 13 | 
            +
            gem install elastic-apm --pre
         | 
| 14 | 
            +
            ```
         | 
| 15 | 
            +
             | 
| 16 | 
            +
            or in your `Gemfile`:
         | 
| 17 | 
            +
             | 
| 18 | 
            +
            ```ruby
         | 
| 19 | 
            +
            gem 'elastic-apm', '~> 1.0.0.beta1'
         | 
| 20 | 
            +
            ```
         | 
| 7 21 |  | 
| 8 22 | 
             
            💡 We'd love to get feedback and information about you setup – please answer this [☑ short survey](https://goo.gl/forms/LQktvn4rkLWBNSWy1).
         | 
| 9 23 |  | 
| @@ -13,22 +27,20 @@ This is the official Rubygem for [Elastic][] [APM][]. | |
| 13 27 |  | 
| 14 28 | 
             
            [Full documentation at Elasti.co](https://www.elastic.co/guide/en/apm/agent/ruby/index.html).
         | 
| 15 29 |  | 
| 16 | 
            -
            <div>
         | 
| 17 30 | 
             
            <ul>
         | 
| 18 | 
            -
            <li><a href="https://www.elastic.co/guide/en/apm/agent/ruby/1.x/ | 
| 31 | 
            +
            <li><a href="https://www.elastic.co/guide/en/apm/agent/ruby/1.x/introduction.html">Introduction</a></li>
         | 
| 19 32 | 
             
            <li><a href="https://www.elastic.co/guide/en/apm/agent/ruby/1.x/getting-started-rails.html">Getting started with Rails</a></li>
         | 
| 20 33 | 
             
            <li><a href="https://www.elastic.co/guide/en/apm/agent/ruby/1.x/getting-started-rack.html">Getting started with Rack</a></li>
         | 
| 21 34 | 
             
            <li><a href="https://www.elastic.co/guide/en/apm/agent/ruby/1.x/configuration.html">Configuration</a></li>
         | 
| 22 | 
            -
            <li | 
| 35 | 
            +
            <li>
         | 
| 23 36 | 
             
            <a href="https://www.elastic.co/guide/en/apm/agent/ruby/1.x/advanced.html">Advanced Topics</a>
         | 
| 24 37 | 
             
            <ul>
         | 
| 25 38 | 
             
            <li><a href="https://www.elastic.co/guide/en/apm/agent/ruby/1.x/custom-instrumentation.html">Custom instrumentation</a></li>
         | 
| 26 | 
            -
            <li><a href="https://www.elastic.co/guide/en/apm/agent/ruby/1.x/ | 
| 39 | 
            +
            <li><a href="https://www.elastic.co/guide/en/apm/agent/ruby/1.x/spies.html">Spies — instrumented libraries</a></li>
         | 
| 27 40 | 
             
            </ul>
         | 
| 28 41 | 
             
            </li>
         | 
| 29 42 | 
             
            <li><a href="https://www.elastic.co/guide/en/apm/agent/ruby/1.x/api.html">Public API</a></li>
         | 
| 30 43 | 
             
            </ul>
         | 
| 31 | 
            -
            </div>
         | 
| 32 44 |  | 
| 33 45 | 
             
            ---
         | 
| 34 46 |  | 
    
        data/docs/configuration.asciidoc
    CHANGED
    
    | @@ -284,10 +284,10 @@ storage use in your Elasticsearch cluster. | |
| 284 284 | 
             
            [[config-span-frames-min-duration-ms]]
         | 
| 285 285 | 
             
            ==== `span_frames_min_duration`
         | 
| 286 286 |  | 
| 287 | 
            -
             | 
| 288 | 
            -
            | Environment                            | `Config`  | 
| 287 | 
            +
            |============
         | 
| 288 | 
            +
            | Environment                            | `Config` key               | Default
         | 
| 289 289 | 
             
            | `ELASTIC_APM_SPAN_FRAMES_MIN_DURATION` | `span_frames_min_duration` | `-1`
         | 
| 290 | 
            -
             | 
| 290 | 
            +
            |============
         | 
| 291 291 |  | 
| 292 292 | 
             
            In its default settings, the APM agent will collect a stack trace with every recorded span.
         | 
| 293 293 | 
             
            While this is very helpful to find the exact place in your code that causes the span,
         | 
| @@ -433,3 +433,13 @@ Eg. `ELASTIC_APM_IGNORE_URL_PATTERNS="a,b" # => [/a/, /b/]` | |
| 433 433 |  | 
| 434 434 | 
             
            Use this to filter error tracking for specific error constants.
         | 
| 435 435 |  | 
| 436 | 
            +
            [float]
         | 
| 437 | 
            +
            [[config-disable-send]]
         | 
| 438 | 
            +
            ==== `disable_send`
         | 
| 439 | 
            +
            |============
         | 
| 440 | 
            +
            | Environment | `Config` key   | Default
         | 
| 441 | 
            +
            | N/A         | `disable_send` | `false`
         | 
| 442 | 
            +
            |============
         | 
| 443 | 
            +
             | 
| 444 | 
            +
            Disables sending payloads to APM Server.
         | 
| 445 | 
            +
             | 
    
        data/lib/elastic_apm/config.rb
    CHANGED
    
    | @@ -25,6 +25,7 @@ module ElasticAPM | |
| 25 25 | 
             
                  transaction_max_spans: 500,
         | 
| 26 26 | 
             
                  filter_exception_types: [],
         | 
| 27 27 |  | 
| 28 | 
            +
                  disable_send: false,
         | 
| 28 29 | 
             
                  http_read_timeout: 120,
         | 
| 29 30 | 
             
                  http_open_timeout: 60,
         | 
| 30 31 | 
             
                  debug_transactions: false,
         | 
| @@ -93,6 +94,7 @@ module ElasticAPM | |
| 93 94 | 
             
                  'ELASTIC_APM_VERIFY_SERVER_CERT' => [:bool, 'verify_server_cert'],
         | 
| 94 95 | 
             
                  'ELASTIC_APM_TRANSACTION_MAX_SPANS' => [:int, 'transaction_max_spans'],
         | 
| 95 96 |  | 
| 97 | 
            +
                  'ELASTIC_APM_DISABLE_SEND' => [:bool, 'disable_send'],
         | 
| 96 98 | 
             
                  'ELASTIC_APM_DISABLED_SPIES' => [:list, 'disabled_spies']
         | 
| 97 99 | 
             
                }.freeze
         | 
| 98 100 |  | 
| @@ -135,6 +137,7 @@ module ElasticAPM | |
| 135 137 | 
             
                attr_accessor :verify_server_cert
         | 
| 136 138 | 
             
                attr_accessor :filter_exception_types
         | 
| 137 139 |  | 
| 140 | 
            +
                attr_accessor :disable_send
         | 
| 138 141 | 
             
                attr_accessor :http_read_timeout
         | 
| 139 142 | 
             
                attr_accessor :http_open_timeout
         | 
| 140 143 | 
             
                attr_accessor :debug_transactions
         | 
| @@ -164,6 +167,7 @@ module ElasticAPM | |
| 164 167 |  | 
| 165 168 | 
             
                alias :disable_environment_warning? :disable_environment_warning
         | 
| 166 169 | 
             
                alias :verify_server_cert? :verify_server_cert
         | 
| 170 | 
            +
                alias :disable_send? :disable_send
         | 
| 167 171 |  | 
| 168 172 | 
             
                def app=(app)
         | 
| 169 173 | 
             
                  case app_type?(app)
         | 
    
        data/lib/elastic_apm/http.rb
    CHANGED
    
    | @@ -40,6 +40,7 @@ module ElasticAPM | |
| 40 40 | 
             
                  request = prepare_request path, payload.to_json
         | 
| 41 41 | 
             
                  response = @adapter.perform request
         | 
| 42 42 |  | 
| 43 | 
            +
                  return nil if response == HttpAdapter::DISABLED
         | 
| 43 44 | 
             
                  return response if response.is_a?(Net::HTTPSuccess)
         | 
| 44 45 |  | 
| 45 46 | 
             
                  error 'POST returned an unsuccessful status code (%d)', response.code
         | 
| @@ -85,6 +86,8 @@ module ElasticAPM | |
| 85 86 |  | 
| 86 87 | 
             
              # @api private
         | 
| 87 88 | 
             
              class HttpAdapter
         | 
| 89 | 
            +
                DISABLED = 'disabled'.freeze
         | 
| 90 | 
            +
             | 
| 88 91 | 
             
                def initialize(conf)
         | 
| 89 92 | 
             
                  @config = conf
         | 
| 90 93 | 
             
                end
         | 
| @@ -96,6 +99,8 @@ module ElasticAPM | |
| 96 99 | 
             
                end
         | 
| 97 100 |  | 
| 98 101 | 
             
                def perform(req)
         | 
| 102 | 
            +
                  return DISABLED if @config.disable_send?
         | 
| 103 | 
            +
             | 
| 99 104 | 
             
                  http.start do |http|
         | 
| 100 105 | 
             
                    http.request req
         | 
| 101 106 | 
             
                  end
         | 
| @@ -20,7 +20,7 @@ module ElasticAPM | |
| 20 20 | 
             
                      return :skip if %w[SCHEMA CACHE].include?(payload[:name])
         | 
| 21 21 |  | 
| 22 22 | 
             
                      name = summarize(payload[:sql]) || payload[:name]
         | 
| 23 | 
            -
                      context = Span::Context.new(statement: payload[:sql] | 
| 23 | 
            +
                      context = Span::Context.new(statement: payload[:sql], type: 'sql')
         | 
| 24 24 | 
             
                      [name, @type, context]
         | 
| 25 25 | 
             
                    end
         | 
| 26 26 |  | 
| @@ -8,13 +8,15 @@ module ElasticAPM | |
| 8 8 | 
             
                  NAME_FORMAT = '%s %s'.freeze
         | 
| 9 9 | 
             
                  TYPE = 'db.elasticsearch'.freeze
         | 
| 10 10 |  | 
| 11 | 
            +
                  # rubocop:disable Metrics/MethodLength
         | 
| 11 12 | 
             
                  def install
         | 
| 12 13 | 
             
                    ::Elasticsearch::Transport::Client.class_eval do
         | 
| 13 14 | 
             
                      alias perform_request_without_apm perform_request
         | 
| 14 15 |  | 
| 15 16 | 
             
                      def perform_request(method, path, *args, &block)
         | 
| 16 17 | 
             
                        name = format(NAME_FORMAT, method, path)
         | 
| 17 | 
            -
                         | 
| 18 | 
            +
                        statement = args[0].is_a?(String) ? args[0] : args[0].to_json
         | 
| 19 | 
            +
                        context = Span::Context.new(statement: statement)
         | 
| 18 20 |  | 
| 19 21 | 
             
                        ElasticAPM.span name, TYPE, context: context do
         | 
| 20 22 | 
             
                          perform_request_without_apm(method, path, *args, &block)
         | 
| @@ -22,6 +24,7 @@ module ElasticAPM | |
| 22 24 | 
             
                      end
         | 
| 23 25 | 
             
                    end
         | 
| 24 26 | 
             
                  end
         | 
| 27 | 
            +
                  # rubocop:enable Metrics/MethodLength
         | 
| 25 28 | 
             
                end
         | 
| 26 29 |  | 
| 27 30 | 
             
                register(
         | 
    
        data/lib/elastic_apm/version.rb
    CHANGED
    
    
    
        metadata
    CHANGED
    
    | @@ -1,14 +1,14 @@ | |
| 1 1 | 
             
            --- !ruby/object:Gem::Specification
         | 
| 2 2 | 
             
            name: elastic-apm
         | 
| 3 3 | 
             
            version: !ruby/object:Gem::Version
         | 
| 4 | 
            -
              version: 1.0.0. | 
| 4 | 
            +
              version: 1.0.0.beta2
         | 
| 5 5 | 
             
            platform: ruby
         | 
| 6 6 | 
             
            authors:
         | 
| 7 7 | 
             
            - Mikkel Malmberg
         | 
| 8 8 | 
             
            autorequire: 
         | 
| 9 9 | 
             
            bindir: bin
         | 
| 10 10 | 
             
            cert_chain: []
         | 
| 11 | 
            -
            date: 2018-06- | 
| 11 | 
            +
            date: 2018-06-21 00:00:00.000000000 Z
         | 
| 12 12 | 
             
            dependencies:
         | 
| 13 13 | 
             
            - !ruby/object:Gem::Dependency
         | 
| 14 14 | 
             
              name: concurrent-ruby
         |