elastic-apm 2.8.1 → 2.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 +4 -4
- data/.ci/bin/check_paths_for_matches.py +80 -0
- data/.ci/jobs/apm-agent-ruby-mbp.yml +5 -0
- data/.ci/jobs/apm-agent-ruby.yml +4 -0
- data/.ci/jobs/defaults.yml +59 -0
- data/CHANGELOG.md +19 -2
- data/Jenkinsfile +65 -43
- data/docs/configuration.asciidoc +6 -3
- data/lib/elastic_apm/context_builder.rb +2 -0
- data/lib/elastic_apm/error_builder.rb +6 -3
- data/lib/elastic_apm/span.rb +1 -1
- data/lib/elastic_apm/stacktrace/frame.rb +3 -1
- data/lib/elastic_apm/transport/connection.rb +12 -3
- data/lib/elastic_apm/transport/connection/proxy_pipe.rb +8 -1
- data/lib/elastic_apm/transport/filters/secrets_filter.rb +3 -1
- data/lib/elastic_apm/transport/serializers/error_serializer.rb +10 -1
- data/lib/elastic_apm/version.rb +1 -1
- metadata +6 -2
    
        checksums.yaml
    CHANGED
    
    | @@ -1,7 +1,7 @@ | |
| 1 1 | 
             
            ---
         | 
| 2 2 | 
             
            SHA256:
         | 
| 3 | 
            -
              metadata.gz:  | 
| 4 | 
            -
              data.tar.gz:  | 
| 3 | 
            +
              metadata.gz: 7a73b88b204253aeff8ed4da74f11be5e6a1bdd77cf3848495f823d225569177
         | 
| 4 | 
            +
              data.tar.gz: 0e962b3216d0c8dc28666175e2db57bc2fe8826e52abe047f1be4b8903fe2a04
         | 
| 5 5 | 
             
            SHA512:
         | 
| 6 | 
            -
              metadata.gz:  | 
| 7 | 
            -
              data.tar.gz:  | 
| 6 | 
            +
              metadata.gz: e5302421b067475c581dde24caa1dce14c755017915b0e69420f8c281785aea06a244231a1f9946a6cd14ddc216f3c0fb303c5d3be78dc2ac49233c7f6371d90
         | 
| 7 | 
            +
              data.tar.gz: 700cb6b1445390110721447fdf3096e4dc25077c5e46c45b71818888b650af56460e9a94645cb51c45f37912a95e6244f58c9bdc4d89517fb3b7cf61d7bcd353
         | 
| @@ -0,0 +1,80 @@ | |
| 1 | 
            +
            #!/usr/bin/env python3
         | 
| 2 | 
            +
            """
         | 
| 3 | 
            +
            Small wrapper script for jenkins to see if a regex pattern matches any of the
         | 
| 4 | 
            +
            paths generated by diffing between two commits.
         | 
| 5 | 
            +
            """
         | 
| 6 | 
            +
            import argparse
         | 
| 7 | 
            +
            import os
         | 
| 8 | 
            +
            import re
         | 
| 9 | 
            +
            import subprocess
         | 
| 10 | 
            +
            import sys
         | 
| 11 | 
            +
             | 
| 12 | 
            +
            debug = "DEBUG" in os.environ
         | 
| 13 | 
            +
             | 
| 14 | 
            +
             | 
| 15 | 
            +
            def check_paths_for_matches(pattern, git_commit, git_previous_commit):
         | 
| 16 | 
            +
                """Check if any paths between GIT_PREVIOUS_COMMIT and GIT_COMMIT match our pattern.
         | 
| 17 | 
            +
             | 
| 18 | 
            +
                For merge commits only actual path changes are included rather than changes
         | 
| 19 | 
            +
                from all parents. If GIT_PREVIOUS_COMMIT is not populated, use just the
         | 
| 20 | 
            +
                paths that GIT_COMMIT represents. If GIT_PREVIOUS_COMMIT is not populated
         | 
| 21 | 
            +
                and GIT_COMMIT is a merge commit, use all path changes from each parent. If
         | 
| 22 | 
            +
                GIT_PREVIOUS_COMMIT is the same as GIT_COMMIT, that should generate no path
         | 
| 23 | 
            +
                changes.
         | 
| 24 | 
            +
                """
         | 
| 25 | 
            +
                # Handle case where GIT_PREVIOUS_COMMIT isn't set (e.g. the first build),
         | 
| 26 | 
            +
                if not git_previous_commit:
         | 
| 27 | 
            +
                    command = [
         | 
| 28 | 
            +
                        "git",
         | 
| 29 | 
            +
                        "diff-tree",
         | 
| 30 | 
            +
                        "-m",
         | 
| 31 | 
            +
                        "--no-commit-id",
         | 
| 32 | 
            +
                        "--name-only",
         | 
| 33 | 
            +
                        "-r",
         | 
| 34 | 
            +
                        git_commit,
         | 
| 35 | 
            +
                    ]
         | 
| 36 | 
            +
                else:
         | 
| 37 | 
            +
                    command = ["git", "diff", "--name-only", git_previous_commit, git_commit]
         | 
| 38 | 
            +
             | 
| 39 | 
            +
                # Run the command and populate paths.
         | 
| 40 | 
            +
                completed_process = subprocess.run(
         | 
| 41 | 
            +
                    command, check=True, stdout=subprocess.PIPE, stderr=subprocess.STDOUT
         | 
| 42 | 
            +
                )
         | 
| 43 | 
            +
                paths = completed_process.stdout.decode().strip().split("\n")
         | 
| 44 | 
            +
             | 
| 45 | 
            +
                # Look for any matches of pattern -> path.
         | 
| 46 | 
            +
                possible_matches = [(path, pattern.match(path)) for path in paths]
         | 
| 47 | 
            +
                if any([match for path, match in possible_matches]):
         | 
| 48 | 
            +
                    if debug:
         | 
| 49 | 
            +
                        print("matching change(s) found for {}".format(git_commit))
         | 
| 50 | 
            +
                        for path, match in possible_matches:
         | 
| 51 | 
            +
                            if match:
         | 
| 52 | 
            +
                                print(path)
         | 
| 53 | 
            +
                    sys.stdout.write("match")
         | 
| 54 | 
            +
                    sys.stdout.flush()
         | 
| 55 | 
            +
                    exit(0)
         | 
| 56 | 
            +
                else:
         | 
| 57 | 
            +
                    if debug:
         | 
| 58 | 
            +
                        print("no matching change(s) found for {}".format(git_commit))
         | 
| 59 | 
            +
                    exit(1)
         | 
| 60 | 
            +
             | 
| 61 | 
            +
             | 
| 62 | 
            +
            if __name__ == "__main__":
         | 
| 63 | 
            +
                # Change our working directory so we're in $WORKSPACE.
         | 
| 64 | 
            +
                os.chdir(os.path.dirname(os.path.abspath(__file__)))
         | 
| 65 | 
            +
             | 
| 66 | 
            +
                # Define and parse arguments.
         | 
| 67 | 
            +
                parser = argparse.ArgumentParser()
         | 
| 68 | 
            +
                parser.add_argument("--pattern", help="A regular expression pattern.")
         | 
| 69 | 
            +
                parser.add_argument(
         | 
| 70 | 
            +
                    "--git-commit", help="The contents of the GIT_COMMIT environmental variable."
         | 
| 71 | 
            +
                )
         | 
| 72 | 
            +
                parser.add_argument(
         | 
| 73 | 
            +
                    "--git-previous-commit",
         | 
| 74 | 
            +
                    nargs="?",
         | 
| 75 | 
            +
                    help="The contents of the GIT_PREVIOUS_COMMIT environmental variable.",
         | 
| 76 | 
            +
                )
         | 
| 77 | 
            +
                args = parser.parse_args()
         | 
| 78 | 
            +
             | 
| 79 | 
            +
                compiled_pattern = re.compile(args.pattern)
         | 
| 80 | 
            +
                check_paths_for_matches(compiled_pattern, args.git_commit, args.git_previous_commit)
         | 
| @@ -0,0 +1,59 @@ | |
| 1 | 
            +
            ---
         | 
| 2 | 
            +
             | 
| 3 | 
            +
            ##### GLOBAL METADATA
         | 
| 4 | 
            +
             | 
| 5 | 
            +
            - meta:
         | 
| 6 | 
            +
                cluster: apm-ci
         | 
| 7 | 
            +
             | 
| 8 | 
            +
            ##### JOB DEFAULTS
         | 
| 9 | 
            +
             | 
| 10 | 
            +
            - job:
         | 
| 11 | 
            +
                view: APM-CI
         | 
| 12 | 
            +
                project-type: multibranch
         | 
| 13 | 
            +
                logrotate:
         | 
| 14 | 
            +
                  daysToKeep: 30
         | 
| 15 | 
            +
                  numToKeep: 100
         | 
| 16 | 
            +
                number-to-keep: '5'
         | 
| 17 | 
            +
                days-to-keep: '1'
         | 
| 18 | 
            +
                concurrent: true
         | 
| 19 | 
            +
                node: linux
         | 
| 20 | 
            +
                script-path: Jenkinsfile
         | 
| 21 | 
            +
                scm:
         | 
| 22 | 
            +
                - github:
         | 
| 23 | 
            +
                    branch-discovery: all
         | 
| 24 | 
            +
                    discover-pr-forks-strategy: merge-current
         | 
| 25 | 
            +
                    discover-pr-forks-trust: permission
         | 
| 26 | 
            +
                    discover-pr-origin: merge-current
         | 
| 27 | 
            +
                    discover-tags: true
         | 
| 28 | 
            +
                    repo: apm-agent-ruby
         | 
| 29 | 
            +
                    repo-owner: elastic
         | 
| 30 | 
            +
                    credentials-id: 2a9602aa-ab9f-4e52-baf3-b71ca88469c7-UserAndToken
         | 
| 31 | 
            +
                    ssh-checkout:
         | 
| 32 | 
            +
                      credentials: f6c7695a-671e-4f4f-a331-acdce44ff9ba
         | 
| 33 | 
            +
                    build-strategies:
         | 
| 34 | 
            +
                    - tags:
         | 
| 35 | 
            +
                        ignore-tags-older-than: -1
         | 
| 36 | 
            +
                        ignore-tags-newer-than: -1
         | 
| 37 | 
            +
                    - regular-branches: true
         | 
| 38 | 
            +
                    - change-request:
         | 
| 39 | 
            +
                        ignore-target-only-changes: false
         | 
| 40 | 
            +
                    clean:
         | 
| 41 | 
            +
                      after: true
         | 
| 42 | 
            +
                      before: true
         | 
| 43 | 
            +
                    prune: true
         | 
| 44 | 
            +
                    shallow-clone: true
         | 
| 45 | 
            +
                    depth: 3
         | 
| 46 | 
            +
                    do-not-fetch-tags: true
         | 
| 47 | 
            +
                    submodule:
         | 
| 48 | 
            +
                      disable: false
         | 
| 49 | 
            +
                      recursive: true
         | 
| 50 | 
            +
                      parent-credentials: true
         | 
| 51 | 
            +
                      timeout: 100
         | 
| 52 | 
            +
                    timeout: '15'
         | 
| 53 | 
            +
                    use-author: true
         | 
| 54 | 
            +
                    wipe-workspace: 'True'
         | 
| 55 | 
            +
                periodic-folder-trigger: 1d
         | 
| 56 | 
            +
                prune-dead-branches: true
         | 
| 57 | 
            +
                publishers:
         | 
| 58 | 
            +
                - email:
         | 
| 59 | 
            +
                    recipients: infra-root+build@elastic.co
         | 
    
        data/CHANGELOG.md
    CHANGED
    
    | @@ -4,6 +4,23 @@ 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 | 
            +
            ## 2.9.0 (2019-06-25)
         | 
| 8 | 
            +
             | 
| 9 | 
            +
            ### Security
         | 
| 10 | 
            +
             | 
| 11 | 
            +
            - **NB:** If you are using a custom CA cert via `server_ca_cert`, versions of the agent prior to 2.9.0 may not have validated the certificate of APM Server correctly.
         | 
| 12 | 
            +
             | 
| 13 | 
            +
            ### Added
         | 
| 14 | 
            +
             | 
| 15 | 
            +
            - Add `transaction.type` to errors ([#434](https://github.com/elastic/apm-agent-ruby/pull/434))
         | 
| 16 | 
            +
            - Add cookies to `request.cookies` ([#448](https://github.com/elastic/apm-agent-ruby/pull/448))
         | 
| 17 | 
            +
             | 
| 18 | 
            +
            ### Fixed
         | 
| 19 | 
            +
             | 
| 20 | 
            +
            - Fix support for older versions of Http.rb ([#438](https://github.com/elastic/apm-agent-ruby/pull/434))
         | 
| 21 | 
            +
            - Strip `Cookie` and `Set-Cookie` from headers ([#448](https://github.com/elastic/apm-agent-ruby/pull/448))
         | 
| 22 | 
            +
            - Fix disabling SSL verification ([#449](https://github.com/elastic/apm-agent-ruby/pull/449))
         | 
| 23 | 
            +
             | 
| 7 24 | 
             
            ## 2.8.1 (2019-05-29)
         | 
| 8 25 |  | 
| 9 26 | 
             
            ### Fixed
         | 
| @@ -59,7 +76,7 @@ This project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.html | |
| 59 76 |  | 
| 60 77 | 
             
            Both APIs are backwards compatible with fallbacks and deprecation warnings, scheduled for removal in next major release.
         | 
| 61 78 |  | 
| 62 | 
            -
            ### Added | 
| 79 | 
            +
            ### Added
         | 
| 63 80 |  | 
| 64 81 | 
             
            - Configuration options to use an HTTP proxy ([#352](https://github.com/elastic/apm-agent-ruby/pull/352))
         | 
| 65 82 |  | 
| @@ -120,7 +137,7 @@ Both APIs are backwards compatible with fallbacks and deprecation warnings, sche | |
| 120 137 | 
             
            ### Added
         | 
| 121 138 |  | 
| 122 139 | 
             
            - Support for [OpenTracing](https://opentracing.io) ([#273](https://github.com/elastic/apm-agent-ruby/pull/273))
         | 
| 123 | 
            -
            - Add  | 
| 140 | 
            +
            - Add capture\_\* options ([#279](https://github.com/elastic/apm-agent-ruby/pull/279))
         | 
| 124 141 | 
             
            - Evaluate the config file as ERB ([#288](https://github.com/elastic/apm-agent-ruby/pull/288))
         | 
| 125 142 |  | 
| 126 143 | 
             
            ### Changed
         | 
    
        data/Jenkinsfile
    CHANGED
    
    | @@ -13,13 +13,16 @@ it is need as field to store the results of the tests. | |
| 13 13 | 
             
            pipeline {
         | 
| 14 14 | 
             
              agent any
         | 
| 15 15 | 
             
              environment {
         | 
| 16 | 
            -
                 | 
| 16 | 
            +
                REPO = 'apm-agent-ruby'
         | 
| 17 | 
            +
                BASE_DIR = "src/github.com/elastic/${env.REPO}"
         | 
| 17 18 | 
             
                PIPELINE_LOG_LEVEL='INFO'
         | 
| 18 19 | 
             
                NOTIFY_TO = credentials('notify-to')
         | 
| 19 20 | 
             
                JOB_GCS_BUCKET = credentials('gcs-bucket')
         | 
| 20 21 | 
             
                CODECOV_SECRET = 'secret/apm-team/ci/apm-agent-ruby-codecov'
         | 
| 21 22 | 
             
                DOCKER_REGISTRY = 'docker.elastic.co'
         | 
| 22 23 | 
             
                DOCKER_SECRET = 'secret/apm-team/ci/docker-registry/prod'
         | 
| 24 | 
            +
                GITHUB_CHECK_ITS_NAME = 'Integration Tests'
         | 
| 25 | 
            +
                ITS_PIPELINE = 'apm-integration-tests-selector-mbp/master'
         | 
| 23 26 | 
             
              }
         | 
| 24 27 | 
             
              options {
         | 
| 25 28 | 
             
                timeout(time: 2, unit: 'HOURS')
         | 
| @@ -59,22 +62,24 @@ pipeline { | |
| 59 62 | 
             
                  agent { label 'linux && immutable' }
         | 
| 60 63 | 
             
                  options { skipDefaultCheckout() }
         | 
| 61 64 | 
             
                  steps {
         | 
| 62 | 
            -
                     | 
| 63 | 
            -
             | 
| 64 | 
            -
             | 
| 65 | 
            -
                       | 
| 66 | 
            -
                         | 
| 67 | 
            -
                           | 
| 68 | 
            -
             | 
| 69 | 
            -
             | 
| 70 | 
            -
             | 
| 71 | 
            -
             | 
| 72 | 
            -
             | 
| 73 | 
            -
             | 
| 74 | 
            -
             | 
| 75 | 
            -
             | 
| 76 | 
            -
             | 
| 77 | 
            -
             | 
| 65 | 
            +
                    withGithubNotify(context: 'Tests', tab: 'tests') {
         | 
| 66 | 
            +
                      deleteDir()
         | 
| 67 | 
            +
                      unstash "source"
         | 
| 68 | 
            +
                      dir("${BASE_DIR}"){
         | 
| 69 | 
            +
                        script {
         | 
| 70 | 
            +
                          rubyTasksGen = new RubyParallelTaskGenerator(
         | 
| 71 | 
            +
                            xKey: 'RUBY_VERSION',
         | 
| 72 | 
            +
                            yKey: 'FRAMEWORK',
         | 
| 73 | 
            +
                            xFile: "./spec/.jenkins_ruby.yml",
         | 
| 74 | 
            +
                            yFile: "./spec/.jenkins_framework.yml",
         | 
| 75 | 
            +
                            exclusionFile: "./spec/.jenkins_exclude.yml",
         | 
| 76 | 
            +
                            tag: "Ruby",
         | 
| 77 | 
            +
                            name: "Ruby",
         | 
| 78 | 
            +
                            steps: this
         | 
| 79 | 
            +
                            )
         | 
| 80 | 
            +
                            def mapPatallelTasks = rubyTasksGen.generateParallelTests()
         | 
| 81 | 
            +
                            parallel(mapPatallelTasks)
         | 
| 82 | 
            +
                          }
         | 
| 78 83 | 
             
                        }
         | 
| 79 84 | 
             
                      }
         | 
| 80 85 | 
             
                    }
         | 
| @@ -113,16 +118,18 @@ pipeline { | |
| 113 118 | 
             
                      stage('Run Benchmarks') {
         | 
| 114 119 | 
             
                        agent { label 'linux && immutable' }
         | 
| 115 120 | 
             
                        steps {
         | 
| 116 | 
            -
                           | 
| 117 | 
            -
             | 
| 118 | 
            -
             | 
| 119 | 
            -
                             | 
| 120 | 
            -
                               | 
| 121 | 
            -
             | 
| 122 | 
            -
             | 
| 123 | 
            -
                                 | 
| 121 | 
            +
                          withGithubNotify(context: 'Run Benchmarks') {
         | 
| 122 | 
            +
                            deleteDir()
         | 
| 123 | 
            +
                            unstash 'source'
         | 
| 124 | 
            +
                            dir("${BASE_DIR}"){
         | 
| 125 | 
            +
                              script {
         | 
| 126 | 
            +
                                def versions = readYaml(file: "./spec/.jenkins_ruby.yml")
         | 
| 127 | 
            +
                                def benchmarkTask = [:]
         | 
| 128 | 
            +
                                versions['RUBY_VERSION'].each{ v ->
         | 
| 129 | 
            +
                                  benchmarkTask[v] = runBenchmark(v)
         | 
| 130 | 
            +
                                }
         | 
| 131 | 
            +
                                parallel(benchmarkTask)
         | 
| 124 132 | 
             
                              }
         | 
| 125 | 
            -
                              parallel(benchmarkTask)
         | 
| 126 133 | 
             
                            }
         | 
| 127 134 | 
             
                          }
         | 
| 128 135 | 
             
                        }
         | 
| @@ -154,6 +161,28 @@ pipeline { | |
| 154 161 | 
             
                      buildDocs(docsDir: "${BASE_DIR}/docs", archive: true)
         | 
| 155 162 | 
             
                    }
         | 
| 156 163 | 
             
                  }
         | 
| 164 | 
            +
                  stage('Integration Tests') {
         | 
| 165 | 
            +
                    agent none
         | 
| 166 | 
            +
                    when {
         | 
| 167 | 
            +
                      beforeAgent true
         | 
| 168 | 
            +
                      allOf {
         | 
| 169 | 
            +
                        anyOf {
         | 
| 170 | 
            +
                          environment name: 'GIT_BUILD_CAUSE', value: 'pr'
         | 
| 171 | 
            +
                          expression { return !params.Run_As_Master_Branch }
         | 
| 172 | 
            +
                        }
         | 
| 173 | 
            +
                      }
         | 
| 174 | 
            +
                    }
         | 
| 175 | 
            +
                    steps {
         | 
| 176 | 
            +
                      log(level: 'INFO', text: 'Launching Async ITs')
         | 
| 177 | 
            +
                      build(job: env.ITS_PIPELINE, propagate: false, wait: false,
         | 
| 178 | 
            +
                            parameters: [string(name: 'AGENT_INTEGRATION_TEST', value: 'Ruby'),
         | 
| 179 | 
            +
                                         string(name: 'BUILD_OPTS', value: "--ruby-agent-version ${env.GIT_BASE_COMMIT} --ruby-agent-version-state ${env.GIT_BUILD_CAUSE} --ruby-agent-repo ${env.CHANGE_FORK}/${env.REPO}"),
         | 
| 180 | 
            +
                                         string(name: 'GITHUB_CHECK_NAME', value: env.GITHUB_CHECK_ITS_NAME),
         | 
| 181 | 
            +
                                         string(name: 'GITHUB_CHECK_REPO', value: env.REPO),
         | 
| 182 | 
            +
                                         string(name: 'GITHUB_CHECK_SHA1', value: env.GIT_BASE_COMMIT)])
         | 
| 183 | 
            +
                      githubNotify(context: "${env.GITHUB_CHECK_ITS_NAME}", description: "${env.GITHUB_CHECK_ITS_NAME} ...", status: 'PENDING', targetUrl: "${env.JENKINS_URL}search/?q=${env.ITS_PIPELINE.replaceAll('/','+')}")
         | 
| 184 | 
            +
                    }
         | 
| 185 | 
            +
                  }
         | 
| 157 186 | 
             
                }
         | 
| 158 187 | 
             
                post {
         | 
| 159 188 | 
             
                  always{
         | 
| @@ -164,24 +193,17 @@ pipeline { | |
| 164 193 | 
             
                        def processor = new ResultsProcessor()
         | 
| 165 194 | 
             
                        processor.processResults(mapResults)
         | 
| 166 195 | 
             
                        archiveArtifacts allowEmptyArchive: true, artifacts: 'results.json,results.html', defaultExcludes: false
         | 
| 196 | 
            +
                        catchError(buildResult: 'SUCCESS') {
         | 
| 197 | 
            +
                          def datafile = readFile(file: "results.json")
         | 
| 198 | 
            +
                          def json = getVaultSecret(secret: 'secret/apm-team/ci/apm-server-benchmark-cloud')
         | 
| 199 | 
            +
                          sendDataToElasticsearch(es: json.data.url, data: datafile, restCall: '/jenkins-builds-test-results/_doc/')
         | 
| 200 | 
            +
                        }
         | 
| 167 201 | 
             
                      }
         | 
| 168 202 | 
             
                    }
         | 
| 169 | 
            -
                   | 
| 170 | 
            -
                  success {
         | 
| 171 | 
            -
                    echoColor(text: '[SUCCESS]', colorfg: 'green', colorbg: 'default')
         | 
| 172 | 
            -
                  }
         | 
| 173 | 
            -
                  aborted {
         | 
| 174 | 
            -
                    echoColor(text: '[ABORTED]', colorfg: 'magenta', colorbg: 'default')
         | 
| 175 | 
            -
                  }
         | 
| 176 | 
            -
                  failure {
         | 
| 177 | 
            -
                    echoColor(text: '[FAILURE]', colorfg: 'red', colorbg: 'default')
         | 
| 178 | 
            -
                    step([$class: 'Mailer', notifyEveryUnstableBuild: true, recipients: "${NOTIFY_TO}", sendToIndividuals: false])
         | 
| 179 | 
            -
                  }
         | 
| 180 | 
            -
                  unstable {
         | 
| 181 | 
            -
                    echoColor(text: '[UNSTABLE]', colorfg: 'yellow', colorbg: 'default')
         | 
| 182 | 
            -
                  }
         | 
| 203 | 
            +
                  notifyBuildResult()
         | 
| 183 204 | 
             
                }
         | 
| 184 205 | 
             
              }
         | 
| 206 | 
            +
            }
         | 
| 185 207 |  | 
| 186 208 | 
             
            /**
         | 
| 187 209 | 
             
            Parallel task generator for the integration tests.
         | 
| @@ -213,7 +235,7 @@ class RubyParallelTaskGenerator extends DefaultParallelTaskGenerator { | |
| 213 235 | 
             
                      steps.junit(allowEmptyResults: false,
         | 
| 214 236 | 
             
                        keepLongStdio: true,
         | 
| 215 237 | 
             
                        testResults: "**/spec/ruby-agent-junit.xml")
         | 
| 216 | 
            -
                      steps.codecov(repo:  | 
| 238 | 
            +
                      steps.codecov(repo: "${steps.env.REPO}", basedir: "${steps.env.BASE_DIR}",
         | 
| 217 239 | 
             
                        secret: "${steps.env.CODECOV_SECRET}")
         | 
| 218 240 | 
             
                    }
         | 
| 219 241 | 
             
                  }
         | 
| @@ -267,8 +289,8 @@ def runBenchmark(version){ | |
| 267 289 | 
             
                        throw e
         | 
| 268 290 | 
             
                      } finally {
         | 
| 269 291 | 
             
                        archiveArtifacts(
         | 
| 270 | 
            -
                          allowEmptyArchive: true, | 
| 271 | 
            -
                          artifacts: "**/benchmark-${transformedVersion}.raw,**/benchmark-${transformedVersion}.error", | 
| 292 | 
            +
                          allowEmptyArchive: true,
         | 
| 293 | 
            +
                          artifacts: "**/benchmark-${transformedVersion}.raw,**/benchmark-${transformedVersion}.error",
         | 
| 272 294 | 
             
                          onlyIfSuccessful: false)
         | 
| 273 295 | 
             
                        sendBenchmarks(file: "benchmark-${transformedVersion}.bulk",
         | 
| 274 296 | 
             
                          index: "benchmark-ruby", archive: true)
         | 
    
        data/docs/configuration.asciidoc
    CHANGED
    
    | @@ -292,11 +292,14 @@ Get an array of enabled spies with `ElasticAPM.agent.config.enabled_spies`. | |
| 292 292 | 
             
            The name of the environment this service is deployed in,
         | 
| 293 293 | 
             
            e.g. "production" or "staging".
         | 
| 294 294 |  | 
| 295 | 
            +
            Environments allow you to easily filter data on a global level in the APM UI.
         | 
| 296 | 
            +
            It's important to be consistent when naming environments across agents.
         | 
| 297 | 
            +
            See {kibana-ref}/filters.html#environment-selector[environment selector] in the Kibana UI for more information.
         | 
| 298 | 
            +
             | 
| 295 299 | 
             
            Defaults to `ENV['RAILS_ENV'] || ENV['RACK_ENV']`.
         | 
| 296 300 |  | 
| 297 | 
            -
            NOTE:  | 
| 298 | 
            -
             | 
| 299 | 
            -
            `service_name`.
         | 
| 301 | 
            +
            NOTE: This feature is fully supported in the APM UI in Kibana versions >= 7.2.
         | 
| 302 | 
            +
            You must use the query bar to filter for a specific environment in versions prior to 7.2.
         | 
| 300 303 |  | 
| 301 304 | 
             
            [float]
         | 
| 302 305 | 
             
            [[config-filter-exception-types]]
         | 
| @@ -52,12 +52,15 @@ module ElasticAPM | |
| 52 52 | 
             
                  error.culprit = stacktrace.frames.first.function
         | 
| 53 53 | 
             
                end
         | 
| 54 54 |  | 
| 55 | 
            -
                # rubocop:disable Metrics/AbcSize
         | 
| 55 | 
            +
                # rubocop:disable Metrics/MethodLength, Metrics/AbcSize
         | 
| 56 56 | 
             
                def add_current_transaction_fields(error, transaction)
         | 
| 57 57 | 
             
                  return unless transaction
         | 
| 58 58 |  | 
| 59 59 | 
             
                  error.transaction_id = transaction.id
         | 
| 60 | 
            -
                  error.transaction = { | 
| 60 | 
            +
                  error.transaction = {
         | 
| 61 | 
            +
                    sampled: transaction.sampled?,
         | 
| 62 | 
            +
                    type: transaction.type
         | 
| 63 | 
            +
                  }
         | 
| 61 64 | 
             
                  error.trace_id = transaction.trace_id
         | 
| 62 65 | 
             
                  error.parent_id = ElasticAPM.current_span&.id || transaction.id
         | 
| 63 66 |  | 
| @@ -66,6 +69,6 @@ module ElasticAPM | |
| 66 69 | 
             
                  Util.reverse_merge!(error.context.tags, transaction.context.tags)
         | 
| 67 70 | 
             
                  Util.reverse_merge!(error.context.custom, transaction.context.custom)
         | 
| 68 71 | 
             
                end
         | 
| 69 | 
            -
                # rubocop:enable Metrics/AbcSize
         | 
| 72 | 
            +
                # rubocop:enable Metrics/MethodLength, Metrics/AbcSize
         | 
| 70 73 | 
             
              end
         | 
| 71 74 | 
             
            end
         | 
    
        data/lib/elastic_apm/span.rb
    CHANGED
    
    | @@ -53,6 +53,7 @@ module ElasticAPM | |
| 53 53 | 
             
                  stop end_time
         | 
| 54 54 |  | 
| 55 55 | 
             
                  build_stacktrace! if should_build_stacktrace?
         | 
| 56 | 
            +
                  self.original_backtrace = nil # release original
         | 
| 56 57 |  | 
| 57 58 | 
             
                  self
         | 
| 58 59 | 
             
                end
         | 
| @@ -82,7 +83,6 @@ module ElasticAPM | |
| 82 83 |  | 
| 83 84 | 
             
                def build_stacktrace!
         | 
| 84 85 | 
             
                  @stacktrace = @stacktrace_builder.build(original_backtrace, type: :span)
         | 
| 85 | 
            -
                  self.original_backtrace = nil # release original
         | 
| 86 86 | 
             
                end
         | 
| 87 87 |  | 
| 88 88 | 
             
                def should_build_stacktrace?
         | 
| @@ -32,6 +32,8 @@ module ElasticAPM | |
| 32 32 | 
             
                    to = lineno + padding - 1
         | 
| 33 33 | 
             
                    file_lines = read_lines(abs_path, from..to)
         | 
| 34 34 |  | 
| 35 | 
            +
                    return unless file_lines
         | 
| 36 | 
            +
             | 
| 35 37 | 
             
                    self.context_line = file_lines[padding]
         | 
| 36 38 | 
             
                    self.pre_context  = file_lines.first(padding)
         | 
| 37 39 | 
             
                    self.post_context = file_lines.last(padding)
         | 
| @@ -43,7 +45,7 @@ module ElasticAPM | |
| 43 45 | 
             
                  def read_lines(path, range)
         | 
| 44 46 | 
             
                    File.readlines(path)[range]
         | 
| 45 47 | 
             
                  rescue Errno::ENOENT
         | 
| 46 | 
            -
                     | 
| 48 | 
            +
                    nil
         | 
| 47 49 | 
             
                  end
         | 
| 48 50 | 
             
                end
         | 
| 49 51 | 
             
              end
         | 
| @@ -130,11 +130,20 @@ module ElasticAPM | |
| 130 130 | 
             
                    ].join(' ')
         | 
| 131 131 | 
             
                  end
         | 
| 132 132 |  | 
| 133 | 
            -
                  def build_ssl_context
         | 
| 134 | 
            -
                    return unless @config.use_ssl? | 
| 133 | 
            +
                  def build_ssl_context # rubocop:disable Metrics/MethodLength
         | 
| 134 | 
            +
                    return unless @config.use_ssl?
         | 
| 135 135 |  | 
| 136 136 | 
             
                    OpenSSL::SSL::SSLContext.new.tap do |context|
         | 
| 137 | 
            -
                       | 
| 137 | 
            +
                      if @config.server_ca_cert
         | 
| 138 | 
            +
                        context.ca_file = @config.server_ca_cert
         | 
| 139 | 
            +
                      end
         | 
| 140 | 
            +
             | 
| 141 | 
            +
                      context.verify_mode =
         | 
| 142 | 
            +
                        if @config.verify_server_cert
         | 
| 143 | 
            +
                          OpenSSL::SSL::VERIFY_PEER
         | 
| 144 | 
            +
                        else
         | 
| 145 | 
            +
                          OpenSSL::SSL::VERIFY_NONE
         | 
| 146 | 
            +
                        end
         | 
| 138 147 | 
             
                    end
         | 
| 139 148 | 
             
                  end
         | 
| 140 149 | 
             
                end
         | 
| @@ -9,8 +9,15 @@ module ElasticAPM | |
| 9 9 | 
             
                  # @api private
         | 
| 10 10 | 
             
                  class ProxyPipe
         | 
| 11 11 | 
             
                    def initialize(enc = nil, compress: true)
         | 
| 12 | 
            -
                       | 
| 12 | 
            +
                      rd, wr = IO.pipe(enc)
         | 
| 13 | 
            +
             | 
| 14 | 
            +
                      @read = rd
         | 
| 13 15 | 
             
                      @write = Write.new(wr, compress: compress)
         | 
| 16 | 
            +
             | 
| 17 | 
            +
                      # Http.rb<4 calls rewind on the request bodies, but IO::Pipe raises
         | 
| 18 | 
            +
                      # ~mikker
         | 
| 19 | 
            +
                      return if HTTP::VERSION.to_i >= 4
         | 
| 20 | 
            +
                      def rd.rewind; end
         | 
| 14 21 | 
             
                    end
         | 
| 15 22 |  | 
| 16 23 | 
             
                    attr_reader :read, :write
         | 
| @@ -14,7 +14,8 @@ module ElasticAPM | |
| 14 14 | 
             
                      /secret/i,
         | 
| 15 15 | 
             
                      /token/i,
         | 
| 16 16 | 
             
                      /api[-._]?key/i,
         | 
| 17 | 
            -
                      /session[-._]?id/i
         | 
| 17 | 
            +
                      /session[-._]?id/i,
         | 
| 18 | 
            +
                      /(set[-_])?cookie/i
         | 
| 18 19 | 
             
                    ].freeze
         | 
| 19 20 |  | 
| 20 21 | 
             
                    VALUE_FILTERS = [
         | 
| @@ -30,6 +31,7 @@ module ElasticAPM | |
| 30 31 | 
             
                    def call(payload)
         | 
| 31 32 | 
             
                      strip_from! payload.dig(:transaction, :context, :request, :headers)
         | 
| 32 33 | 
             
                      strip_from! payload.dig(:transaction, :context, :request, :env)
         | 
| 34 | 
            +
                      strip_from! payload.dig(:transaction, :context, :request, :cookies)
         | 
| 33 35 | 
             
                      strip_from! payload.dig(:transaction, :context, :response, :headers)
         | 
| 34 36 | 
             
                      strip_from! payload.dig(:error, :context, :request, :headers)
         | 
| 35 37 | 
             
                      strip_from! payload.dig(:error, :context, :response, :headers)
         | 
| @@ -14,7 +14,7 @@ module ElasticAPM | |
| 14 14 | 
             
                      base = {
         | 
| 15 15 | 
             
                        id: error.id,
         | 
| 16 16 | 
             
                        transaction_id: error.transaction_id,
         | 
| 17 | 
            -
                        transaction: error.transaction,
         | 
| 17 | 
            +
                        transaction: build_transaction(error.transaction),
         | 
| 18 18 | 
             
                        trace_id: error.trace_id,
         | 
| 19 19 | 
             
                        parent_id: error.parent_id,
         | 
| 20 20 |  | 
| @@ -61,6 +61,15 @@ module ElasticAPM | |
| 61 61 | 
             
                        stacktrace: log.stacktrace.to_a
         | 
| 62 62 | 
             
                      }
         | 
| 63 63 | 
             
                    end
         | 
| 64 | 
            +
             | 
| 65 | 
            +
                    def build_transaction(transaction)
         | 
| 66 | 
            +
                      return unless transaction
         | 
| 67 | 
            +
             | 
| 68 | 
            +
                      {
         | 
| 69 | 
            +
                        sampled: transaction[:sampled],
         | 
| 70 | 
            +
                        type: keyword_field(transaction[:type])
         | 
| 71 | 
            +
                      }
         | 
| 72 | 
            +
                    end
         | 
| 64 73 | 
             
                  end
         | 
| 65 74 | 
             
                end
         | 
| 66 75 | 
             
              end
         | 
    
        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: 2. | 
| 4 | 
            +
              version: 2.9.0
         | 
| 5 5 | 
             
            platform: ruby
         | 
| 6 6 | 
             
            authors:
         | 
| 7 7 | 
             
            - Mikkel Malmberg
         | 
| 8 8 | 
             
            autorequire: 
         | 
| 9 9 | 
             
            bindir: bin
         | 
| 10 10 | 
             
            cert_chain: []
         | 
| 11 | 
            -
            date: 2019- | 
| 11 | 
            +
            date: 2019-06-25 00:00:00.000000000 Z
         | 
| 12 12 | 
             
            dependencies:
         | 
| 13 13 | 
             
            - !ruby/object:Gem::Dependency
         | 
| 14 14 | 
             
              name: concurrent-ruby
         | 
| @@ -45,6 +45,10 @@ executables: [] | |
| 45 45 | 
             
            extensions: []
         | 
| 46 46 | 
             
            extra_rdoc_files: []
         | 
| 47 47 | 
             
            files:
         | 
| 48 | 
            +
            - ".ci/bin/check_paths_for_matches.py"
         | 
| 49 | 
            +
            - ".ci/jobs/apm-agent-ruby-mbp.yml"
         | 
| 50 | 
            +
            - ".ci/jobs/apm-agent-ruby.yml"
         | 
| 51 | 
            +
            - ".ci/jobs/defaults.yml"
         | 
| 48 52 | 
             
            - ".gitignore"
         | 
| 49 53 | 
             
            - ".hound.yml"
         | 
| 50 54 | 
             
            - ".rspec"
         |