ddtrace 0.47.0 → 0.48.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (100) hide show
  1. checksums.yaml +5 -5
  2. data/.circleci/config.yml +4 -2
  3. data/.circleci/images/primary/Dockerfile-2.0.0 +11 -1
  4. data/.circleci/images/primary/Dockerfile-2.1.10 +11 -1
  5. data/.circleci/images/primary/Dockerfile-2.2.10 +11 -1
  6. data/.circleci/images/primary/Dockerfile-2.3.8 +10 -0
  7. data/.circleci/images/primary/Dockerfile-2.4.6 +10 -0
  8. data/.circleci/images/primary/Dockerfile-2.5.6 +10 -0
  9. data/.circleci/images/primary/Dockerfile-2.6.4 +10 -0
  10. data/.circleci/images/primary/Dockerfile-2.7.0 +10 -0
  11. data/.circleci/images/primary/Dockerfile-jruby-9.2-latest +10 -0
  12. data/.gitlab-ci.yml +18 -18
  13. data/.rubocop.yml +19 -0
  14. data/.rubocop_todo.yml +44 -3
  15. data/Appraisals +55 -1
  16. data/CHANGELOG.md +47 -1
  17. data/Gemfile +10 -0
  18. data/Rakefile +9 -0
  19. data/bin/ddtracerb +15 -0
  20. data/ddtrace.gemspec +4 -2
  21. data/docs/GettingStarted.md +36 -53
  22. data/docs/ProfilingDevelopment.md +88 -0
  23. data/integration/README.md +1 -2
  24. data/integration/apps/rack/Dockerfile +3 -0
  25. data/integration/apps/rack/script/build-images +1 -1
  26. data/integration/apps/rack/script/ci +1 -1
  27. data/integration/apps/rails-five/script/build-images +1 -1
  28. data/integration/apps/rails-five/script/ci +1 -1
  29. data/integration/apps/ruby/script/build-images +1 -1
  30. data/integration/apps/ruby/script/ci +1 -1
  31. data/integration/images/include/http-health-check +1 -1
  32. data/integration/images/wrk/scripts/entrypoint.sh +1 -1
  33. data/integration/script/build-images +1 -1
  34. data/lib/ddtrace.rb +1 -0
  35. data/lib/ddtrace/configuration.rb +39 -13
  36. data/lib/ddtrace/configuration/components.rb +85 -3
  37. data/lib/ddtrace/configuration/settings.rb +31 -0
  38. data/lib/ddtrace/contrib/active_record/configuration/makara_resolver.rb +30 -0
  39. data/lib/ddtrace/contrib/active_record/configuration/resolver.rb +9 -3
  40. data/lib/ddtrace/contrib/resque/configuration/settings.rb +17 -1
  41. data/lib/ddtrace/contrib/resque/patcher.rb +4 -4
  42. data/lib/ddtrace/contrib/resque/resque_job.rb +22 -1
  43. data/lib/ddtrace/contrib/shoryuken/configuration/settings.rb +1 -0
  44. data/lib/ddtrace/contrib/shoryuken/tracer.rb +7 -3
  45. data/lib/ddtrace/diagnostics/environment_logger.rb +1 -1
  46. data/lib/ddtrace/error.rb +2 -0
  47. data/lib/ddtrace/ext/profiling.rb +52 -0
  48. data/lib/ddtrace/ext/transport.rb +1 -0
  49. data/lib/ddtrace/metrics.rb +4 -0
  50. data/lib/ddtrace/profiling.rb +54 -0
  51. data/lib/ddtrace/profiling/backtrace_location.rb +32 -0
  52. data/lib/ddtrace/profiling/buffer.rb +41 -0
  53. data/lib/ddtrace/profiling/collectors/stack.rb +253 -0
  54. data/lib/ddtrace/profiling/encoding/profile.rb +31 -0
  55. data/lib/ddtrace/profiling/event.rb +13 -0
  56. data/lib/ddtrace/profiling/events/stack.rb +102 -0
  57. data/lib/ddtrace/profiling/exporter.rb +23 -0
  58. data/lib/ddtrace/profiling/ext/cpu.rb +54 -0
  59. data/lib/ddtrace/profiling/ext/cthread.rb +134 -0
  60. data/lib/ddtrace/profiling/ext/forking.rb +97 -0
  61. data/lib/ddtrace/profiling/flush.rb +41 -0
  62. data/lib/ddtrace/profiling/pprof/builder.rb +121 -0
  63. data/lib/ddtrace/profiling/pprof/converter.rb +85 -0
  64. data/lib/ddtrace/profiling/pprof/message_set.rb +12 -0
  65. data/lib/ddtrace/profiling/pprof/payload.rb +18 -0
  66. data/lib/ddtrace/profiling/pprof/pprof.proto +212 -0
  67. data/lib/ddtrace/profiling/pprof/pprof_pb.rb +81 -0
  68. data/lib/ddtrace/profiling/pprof/stack_sample.rb +90 -0
  69. data/lib/ddtrace/profiling/pprof/string_table.rb +10 -0
  70. data/lib/ddtrace/profiling/pprof/template.rb +114 -0
  71. data/lib/ddtrace/profiling/preload.rb +3 -0
  72. data/lib/ddtrace/profiling/profiler.rb +28 -0
  73. data/lib/ddtrace/profiling/recorder.rb +87 -0
  74. data/lib/ddtrace/profiling/scheduler.rb +84 -0
  75. data/lib/ddtrace/profiling/tasks/setup.rb +77 -0
  76. data/lib/ddtrace/profiling/transport/client.rb +12 -0
  77. data/lib/ddtrace/profiling/transport/http.rb +122 -0
  78. data/lib/ddtrace/profiling/transport/http/api.rb +43 -0
  79. data/lib/ddtrace/profiling/transport/http/api/endpoint.rb +90 -0
  80. data/lib/ddtrace/profiling/transport/http/api/instance.rb +36 -0
  81. data/lib/ddtrace/profiling/transport/http/api/spec.rb +40 -0
  82. data/lib/ddtrace/profiling/transport/http/builder.rb +28 -0
  83. data/lib/ddtrace/profiling/transport/http/client.rb +33 -0
  84. data/lib/ddtrace/profiling/transport/http/response.rb +21 -0
  85. data/lib/ddtrace/profiling/transport/io.rb +30 -0
  86. data/lib/ddtrace/profiling/transport/io/client.rb +27 -0
  87. data/lib/ddtrace/profiling/transport/io/response.rb +16 -0
  88. data/lib/ddtrace/profiling/transport/parcel.rb +17 -0
  89. data/lib/ddtrace/profiling/transport/request.rb +15 -0
  90. data/lib/ddtrace/profiling/transport/response.rb +8 -0
  91. data/lib/ddtrace/runtime/container.rb +11 -3
  92. data/lib/ddtrace/sampling/rule_sampler.rb +3 -9
  93. data/lib/ddtrace/tasks/exec.rb +48 -0
  94. data/lib/ddtrace/tasks/help.rb +14 -0
  95. data/lib/ddtrace/tracer.rb +21 -0
  96. data/lib/ddtrace/transport/io/client.rb +15 -8
  97. data/lib/ddtrace/transport/parcel.rb +4 -0
  98. data/lib/ddtrace/version.rb +3 -1
  99. data/lib/ddtrace/workers/runtime_metrics.rb +14 -1
  100. metadata +70 -9
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
- SHA1:
3
- metadata.gz: 9cf1ef2c94e28df64fe5d26a43c3cfb1c31cc9be
4
- data.tar.gz: a7daf78f76f691e785946f0e3f2763b424cd6127
2
+ SHA256:
3
+ metadata.gz: 9418700e29312fa4efc67e04b7ff901950a5ee0d942cc7fe06a49adbf694f08a
4
+ data.tar.gz: 348acc764a300c51c3e99b02001b0dc238775c6afd7b07fd3ee4c31758e1e906
5
5
  SHA512:
6
- metadata.gz: 3d4f7408c4ef0b587c3a078cb29b5165a43cbb03bb204b72d04a989de1567cd0ff9ae8c7c0649f6269a531a4041c156970fc0470c7f124b208f7a98435c942e8
7
- data.tar.gz: a8e0484124bc54ef8c69e3af13f6f06e8b0070223a6316922e38d2df2d97004d306f3d205babfdfe876dad6f76c69ccfba77ffc5de58c7bb6fc441856f85df60
6
+ metadata.gz: f1cdbcdef68b68901a5737c3bfae8797709448a6db0b92ee2f1a7e59c64c6610bf327b1d847bd2cd0d18e651807d9c6cead347516f258f7f62169ca71315d7e1
7
+ data.tar.gz: 4c9e69ff9418143fff7734c2fd7ae2973d230a58e5173e8a1a6e128733a5bdb3fda11874f63b87840fc7e60098c94c746dce7d527726166345e4ca1e4a4b95a2
data/.circleci/config.yml CHANGED
@@ -390,8 +390,10 @@ jobs:
390
390
  echo PRE=$PRE
391
391
  sed lib/ddtrace/version.rb -i -e "s/^\([\t ]*PRE\) *=*/\1 = \'${PRE}\' #/g"
392
392
  - run:
393
- name: Upload prereleas Gem and rebuild index
394
- command: S3_DIR=prerelease bundle exec rake release:gem
393
+ name: Upload prerelease Gem and rebuild index
394
+ # This was bumped from prerelease to prerelease-v2 to avoid the issue documented in
395
+ # https://github.com/DataDog/dd-trace-rb/pull/1358
396
+ command: S3_DIR=prerelease-v2 bundle exec rake release:gem
395
397
  - store_artifacts:
396
398
  path: pkg/
397
399
  destination: gem
@@ -15,7 +15,7 @@ ENV DEBIAN_FRONTEND=noninteractive
15
15
  RUN set -ex; \
16
16
  apt-get update; \
17
17
  mkdir -p /usr/share/man/man1; \
18
- apt-get install -y --no-install-recommends \
18
+ apt-get install --force-yes --no-install-recommends \
19
19
  git mercurial xvfb \
20
20
  locales sudo openssh-client ca-certificates tar gzip parallel \
21
21
  net-tools netcat unzip zip bzip2 gnupg curl wget \
@@ -62,6 +62,16 @@ RUN DOCKERIZE_URL="https://circle-downloads.s3.amazonaws.com/circleci-images/cac
62
62
  && rm -rf /tmp/dockerize-linux-amd64.tar.gz \
63
63
  && dockerize --version
64
64
 
65
+ # Install Protobuf compiler
66
+ RUN export PROTOC_URL="https://github.com/protocolbuffers/protobuf/releases/download/v3.6.1/protoc-3.6.1-linux-x86_64.zip" \
67
+ && echo Protoc URL: $PROTOC_URL \
68
+ && curl --silent --show-error --location --fail --retry 3 --output /tmp/protoc.zip "${PROTOC_URL}" \
69
+ && ls -lha /tmp/protoc.zip \
70
+ && unzip /tmp/protoc.zip -d /tmp/protoc \
71
+ && mv /tmp/protoc/bin/* /usr/bin \
72
+ && rm -rf /tmp/protoc /tmp/protoc.zip \
73
+ && protoc --version
74
+
65
75
  # Install RubyGems
66
76
  RUN gem update --system 2.7.9
67
77
  RUN gem install bundler -v '1.17.3'
@@ -15,7 +15,7 @@ ENV DEBIAN_FRONTEND=noninteractive
15
15
  RUN set -ex; \
16
16
  apt-get update; \
17
17
  mkdir -p /usr/share/man/man1; \
18
- apt-get install -y --no-install-recommends \
18
+ apt-get install --force-yes --no-install-recommends \
19
19
  git mercurial xvfb \
20
20
  locales sudo openssh-client ca-certificates tar gzip parallel \
21
21
  net-tools netcat unzip zip bzip2 gnupg curl wget \
@@ -62,6 +62,16 @@ RUN DOCKERIZE_URL="https://circle-downloads.s3.amazonaws.com/circleci-images/cac
62
62
  && rm -rf /tmp/dockerize-linux-amd64.tar.gz \
63
63
  && dockerize --version
64
64
 
65
+ # Install Protobuf compiler
66
+ RUN export PROTOC_URL="https://github.com/protocolbuffers/protobuf/releases/download/v3.6.1/protoc-3.6.1-linux-x86_64.zip" \
67
+ && echo Protoc URL: $PROTOC_URL \
68
+ && curl --silent --show-error --location --fail --retry 3 --output /tmp/protoc.zip "${PROTOC_URL}" \
69
+ && ls -lha /tmp/protoc.zip \
70
+ && unzip /tmp/protoc.zip -d /tmp/protoc \
71
+ && mv /tmp/protoc/bin/* /usr/bin \
72
+ && rm -rf /tmp/protoc /tmp/protoc.zip \
73
+ && protoc --version
74
+
65
75
  # Install RubyGems
66
76
  RUN gem update --system 2.7.9
67
77
  RUN gem install bundler -v '1.17.3'
@@ -15,7 +15,7 @@ ENV DEBIAN_FRONTEND=noninteractive
15
15
  RUN set -ex; \
16
16
  apt-get update; \
17
17
  mkdir -p /usr/share/man/man1; \
18
- apt-get install -y --no-install-recommends \
18
+ apt-get install --force-yes --no-install-recommends \
19
19
  git mercurial xvfb \
20
20
  locales sudo openssh-client ca-certificates tar gzip parallel \
21
21
  net-tools netcat unzip zip bzip2 gnupg curl wget \
@@ -62,6 +62,16 @@ RUN DOCKERIZE_URL="https://circle-downloads.s3.amazonaws.com/circleci-images/cac
62
62
  && rm -rf /tmp/dockerize-linux-amd64.tar.gz \
63
63
  && dockerize --version
64
64
 
65
+ # Install Protobuf compiler
66
+ RUN export PROTOC_URL="https://github.com/protocolbuffers/protobuf/releases/download/v3.6.1/protoc-3.6.1-linux-x86_64.zip" \
67
+ && echo Protoc URL: $PROTOC_URL \
68
+ && curl --silent --show-error --location --fail --retry 3 --output /tmp/protoc.zip "${PROTOC_URL}" \
69
+ && ls -lha /tmp/protoc.zip \
70
+ && unzip /tmp/protoc.zip -d /tmp/protoc \
71
+ && mv /tmp/protoc/bin/* /usr/bin \
72
+ && rm -rf /tmp/protoc /tmp/protoc.zip \
73
+ && protoc --version
74
+
65
75
  # Install RubyGems
66
76
  RUN gem update --system 2.7.9
67
77
  RUN gem install bundler -v '1.17.3'
@@ -58,6 +58,16 @@ RUN DOCKERIZE_URL="https://circle-downloads.s3.amazonaws.com/circleci-images/cac
58
58
  && rm -rf /tmp/dockerize-linux-amd64.tar.gz \
59
59
  && dockerize --version
60
60
 
61
+ # Install Protobuf compiler
62
+ RUN export PROTOC_URL=$(curl -s https://api.github.com/repos/protocolbuffers/protobuf/releases/latest | grep browser_download_url | cut -d '"' -f 4 | grep -e 'protoc-[.0-9]*-linux-x86_64\.zip' | sort -r | head -n 1) \
63
+ && echo Protoc URL: $PROTOC_URL \
64
+ && curl --silent --show-error --location --fail --retry 3 --output /tmp/protoc.zip "${PROTOC_URL}" \
65
+ && ls -lha /tmp/protoc.zip \
66
+ && unzip /tmp/protoc.zip -d /tmp/protoc \
67
+ && mv /tmp/protoc/bin/* /usr/bin \
68
+ && rm -rf /tmp/protoc /tmp/protoc.zip \
69
+ && protoc --version
70
+
61
71
  # Install RubyGems
62
72
  RUN gem update --system
63
73
  RUN mkdir -p "$GEM_HOME" && chmod -R 777 "$GEM_HOME"
@@ -58,6 +58,16 @@ RUN DOCKERIZE_URL="https://circle-downloads.s3.amazonaws.com/circleci-images/cac
58
58
  && rm -rf /tmp/dockerize-linux-amd64.tar.gz \
59
59
  && dockerize --version
60
60
 
61
+ # Install Protobuf compiler
62
+ RUN export PROTOC_URL=$(curl -s https://api.github.com/repos/protocolbuffers/protobuf/releases/latest | grep browser_download_url | cut -d '"' -f 4 | grep -e 'protoc-[.0-9]*-linux-x86_64\.zip' | sort -r | head -n 1) \
63
+ && echo Protoc URL: $PROTOC_URL \
64
+ && curl --silent --show-error --location --fail --retry 3 --output /tmp/protoc.zip "${PROTOC_URL}" \
65
+ && ls -lha /tmp/protoc.zip \
66
+ && unzip /tmp/protoc.zip -d /tmp/protoc \
67
+ && mv /tmp/protoc/bin/* /usr/bin \
68
+ && rm -rf /tmp/protoc /tmp/protoc.zip \
69
+ && protoc --version
70
+
61
71
  # Install RubyGems
62
72
  RUN gem update --system
63
73
  RUN mkdir -p "$GEM_HOME" && chmod -R 777 "$GEM_HOME"
@@ -58,6 +58,16 @@ RUN DOCKERIZE_URL="https://circle-downloads.s3.amazonaws.com/circleci-images/cac
58
58
  && rm -rf /tmp/dockerize-linux-amd64.tar.gz \
59
59
  && dockerize --version
60
60
 
61
+ # Install Protobuf compiler
62
+ RUN export PROTOC_URL=$(curl -s https://api.github.com/repos/protocolbuffers/protobuf/releases/latest | grep browser_download_url | cut -d '"' -f 4 | grep -e 'protoc-[.0-9]*-linux-x86_64\.zip' | sort -r | head -n 1) \
63
+ && echo Protoc URL: $PROTOC_URL \
64
+ && curl --silent --show-error --location --fail --retry 3 --output /tmp/protoc.zip "${PROTOC_URL}" \
65
+ && ls -lha /tmp/protoc.zip \
66
+ && unzip /tmp/protoc.zip -d /tmp/protoc \
67
+ && mv /tmp/protoc/bin/* /usr/bin \
68
+ && rm -rf /tmp/protoc /tmp/protoc.zip \
69
+ && protoc --version
70
+
61
71
  # Install RubyGems
62
72
  RUN gem update --system
63
73
  RUN mkdir -p "$GEM_HOME" && chmod -R 777 "$GEM_HOME"
@@ -58,6 +58,16 @@ RUN DOCKERIZE_URL="https://circle-downloads.s3.amazonaws.com/circleci-images/cac
58
58
  && rm -rf /tmp/dockerize-linux-amd64.tar.gz \
59
59
  && dockerize --version
60
60
 
61
+ # Install Protobuf compiler
62
+ RUN export PROTOC_URL=$(curl -s https://api.github.com/repos/protocolbuffers/protobuf/releases/latest | grep browser_download_url | cut -d '"' -f 4 | grep -e 'protoc-[.0-9]*-linux-x86_64\.zip' | sort -r | head -n 1) \
63
+ && echo Protoc URL: $PROTOC_URL \
64
+ && curl --silent --show-error --location --fail --retry 3 --output /tmp/protoc.zip "${PROTOC_URL}" \
65
+ && ls -lha /tmp/protoc.zip \
66
+ && unzip /tmp/protoc.zip -d /tmp/protoc \
67
+ && mv /tmp/protoc/bin/* /usr/bin \
68
+ && rm -rf /tmp/protoc /tmp/protoc.zip \
69
+ && protoc --version
70
+
61
71
  # Install RubyGems
62
72
  RUN gem update --system
63
73
  RUN mkdir -p "$GEM_HOME" && chmod -R 777 "$GEM_HOME"
@@ -58,6 +58,16 @@ RUN DOCKERIZE_URL="https://circle-downloads.s3.amazonaws.com/circleci-images/cac
58
58
  && rm -rf /tmp/dockerize-linux-amd64.tar.gz \
59
59
  && dockerize --version
60
60
 
61
+ # Install Protobuf compiler
62
+ RUN export PROTOC_URL=$(curl -s https://api.github.com/repos/protocolbuffers/protobuf/releases/latest | grep browser_download_url | cut -d '"' -f 4 | grep -e 'protoc-[.0-9]*-linux-x86_64\.zip' | sort -r | head -n 1) \
63
+ && echo Protoc URL: $PROTOC_URL \
64
+ && curl --silent --show-error --location --fail --retry 3 --output /tmp/protoc.zip "${PROTOC_URL}" \
65
+ && ls -lha /tmp/protoc.zip \
66
+ && unzip /tmp/protoc.zip -d /tmp/protoc \
67
+ && mv /tmp/protoc/bin/* /usr/bin \
68
+ && rm -rf /tmp/protoc /tmp/protoc.zip \
69
+ && protoc --version
70
+
61
71
  # Install RubyGems
62
72
  # RUN gem update --system # Upgrading disabled until https://github.com/thoughtbot/appraisal/issues/162 is fixed
63
73
  RUN mkdir -p "$GEM_HOME" && chmod -R 777 "$GEM_HOME"
@@ -60,6 +60,16 @@ RUN DOCKERIZE_URL="https://circle-downloads.s3.amazonaws.com/circleci-images/cac
60
60
  && rm -rf /tmp/dockerize-linux-amd64.tar.gz \
61
61
  && dockerize --version
62
62
 
63
+ # Install Protobuf compiler
64
+ RUN export PROTOC_URL=$(curl -s https://api.github.com/repos/protocolbuffers/protobuf/releases/latest | grep browser_download_url | cut -d '"' -f 4 | grep -e 'protoc-[.0-9]*-linux-x86_64\.zip' | sort -r | head -n 1) \
65
+ && echo Protoc URL: $PROTOC_URL \
66
+ && curl --silent --show-error --location --fail --retry 3 --output /tmp/protoc.zip "${PROTOC_URL}" \
67
+ && ls -lha /tmp/protoc.zip \
68
+ && unzip /tmp/protoc.zip -d /tmp/protoc \
69
+ && mv /tmp/protoc/bin/* /usr/bin \
70
+ && rm -rf /tmp/protoc /tmp/protoc.zip \
71
+ && protoc --version
72
+
63
73
  # Install RubyGems
64
74
  RUN gem update --system
65
75
  RUN mkdir -p "$GEM_HOME" && chmod -R 777 "$GEM_HOME"
data/.gitlab-ci.yml CHANGED
@@ -2,26 +2,26 @@ stages:
2
2
  - deploy
3
3
 
4
4
  variables:
5
- INDEX_FILE: index.txt
5
+ DOWNSTREAM_BRANCH:
6
+ value: "master"
7
+ description: "Run a specific datadog-reliability-env branch downstream"
8
+ FORCE_TRIGGER:
9
+ value: "false"
10
+ description: "Set to true to override rules in the reliability-env pipeline (e.g. override 'only deploy master')"
6
11
 
7
12
  .common: &common
8
13
  tags: [ "runner:main", "size:large" ]
9
14
 
10
- copy_to_s3:
11
- <<: *common
15
+ deploy_to_reliability_env:
12
16
  stage: deploy
13
- image: registry.gitlab.com/gitlab-org/cloud-deploy/aws-base:latest
14
- rules:
15
- - if: '$CI_COMMIT_BRANCH == "master"'
16
- when: on_success
17
- - when: manual
18
- allow_failure: true
19
- script:
20
- - export ACCESS_KEY_ID=$(aws ssm get-parameter --region us-east-1 --name ci.dd-trace-rb.secret_key_id --with-decryption --query "Parameter.Value" --out text)
21
- - export SECRET_ACCESS_KEY=$(aws ssm get-parameter --region us-east-1 --name ci.dd-trace-rb.secret_sec_key_id --with-decryption --query "Parameter.Value" --out text)
22
- - export AWS_ACCESS_KEY_ID=$ACCESS_KEY_ID
23
- - export AWS_SECRET_ACCESS_KEY=$SECRET_ACCESS_KEY
24
- - echo $CI_COMMIT_REF_NAME >> $INDEX_FILE
25
- - echo $CI_COMMIT_SHA >> $INDEX_FILE
26
- - echo $GITLAB_USER_NAME >> $INDEX_FILE
27
- - aws s3 cp $INDEX_FILE s3://datadog-reliability-env/ruby/$INDEX_FILE
17
+ when: on_success
18
+ trigger:
19
+ project: DataDog/datadog-reliability-env
20
+ branch: $DOWNSTREAM_BRANCH
21
+ variables:
22
+ UPSTREAM_BRANCH: $CI_COMMIT_REF_NAME
23
+ UPSTREAM_PROJECT_ID: $CI_PROJECT_ID
24
+ UPSTREAM_PROJECT_NAME: $CI_PROJECT_NAME
25
+ UPSTREAM_COMMIT_SHA: $CI_COMMIT_SHA
26
+ FORCE_TRIGGER: $FORCE_TRIGGER
27
+
data/.rubocop.yml CHANGED
@@ -18,6 +18,7 @@ AllCops:
18
18
  - 'lib/ddtrace/**/vendor/**/*.rb'
19
19
  - 'integration/apps/*/bin/*'
20
20
  - 'integration/apps/*/Gemfile'
21
+ - 'lib/ddtrace/profiling/pprof/pprof_pb.rb'
21
22
  NewCops: disable # Don't allow new cops to be enabled implicitly.
22
23
 
23
24
  # 80 characters is a nice goal, but not worth currently changing in existing
@@ -201,6 +202,10 @@ Style/HashTransformValues:
201
202
  Style/CollectionCompact:
202
203
  Enabled: false
203
204
 
205
+ # Requires Ruby 2.4
206
+ Performance/RegexpMatch:
207
+ Enabled: false
208
+
204
209
  # Enforces negative/positive branching order,
205
210
  # which can hurt readability.
206
211
  Style/NegatedIfElseCondition:
@@ -226,6 +231,14 @@ RSpec/LeadingSubject:
226
231
  RSpec/ImplicitSubject:
227
232
  Enabled: false
228
233
 
234
+ # Enforces empty line after subject declaration.
235
+ RSpec/EmptyLineAfterSubject:
236
+ Enabled: false
237
+
238
+ # Enforces empty line after last let declaration.
239
+ RSpec/EmptyLineAfterFinalLet:
240
+ Enabled: false
241
+
229
242
  # TODO: Disabling until we categorize which file are safe to do so.
230
243
  Style/FrozenStringLiteralComment:
231
244
  Enabled: false
@@ -245,6 +258,12 @@ Lint/EmptyBlock:
245
258
  RSpec/ContextWording:
246
259
  Enabled: false
247
260
 
261
+ # Checks for multiple top-level example groups.
262
+ # Multiple descriptions for the same class or module should either
263
+ # be nested or separated into different test files.
264
+ RSpec/MultipleDescribes:
265
+ Enabled: false
266
+
248
267
  # Enforces that examples should only have a limited amount of assertions.
249
268
  RSpec/MultipleExpectations:
250
269
  Enabled: false
data/.rubocop_todo.yml CHANGED
@@ -86,13 +86,20 @@ Lint/MissingCopEnableDirective:
86
86
  - 'test/contrib/rails/errors_test.rb'
87
87
  - 'test/tracer_test.rb'
88
88
 
89
- # Offense count: 24
89
+ # Offense count: 32
90
90
  Lint/MissingSuper:
91
91
  Exclude:
92
92
  - 'lib/ddtrace/contrib/grpc/datadog_interceptor.rb'
93
93
  - 'lib/ddtrace/opentracer/scope.rb'
94
94
  - 'lib/ddtrace/opentracer/span.rb'
95
95
  - 'lib/ddtrace/opentracer/span_context.rb'
96
+ - 'lib/ddtrace/profiling/collectors/stack.rb'
97
+ - 'lib/ddtrace/profiling/pprof/converter.rb'
98
+ - 'lib/ddtrace/profiling/pprof/template.rb'
99
+ - 'lib/ddtrace/profiling/recorder.rb'
100
+ - 'lib/ddtrace/profiling/scheduler.rb'
101
+ - 'lib/ddtrace/profiling/transport/http/api/instance.rb'
102
+ - 'lib/ddtrace/profiling/transport/http/api/spec.rb'
96
103
  - 'lib/ddtrace/sampler.rb'
97
104
  - 'lib/ddtrace/sampling/matcher.rb'
98
105
  - 'lib/ddtrace/sampling/rate_limiter.rb'
@@ -108,6 +115,11 @@ Lint/MissingSuper:
108
115
  - 'spec/support/spy_transport.rb'
109
116
  - 'test/helper.rb'
110
117
 
118
+ # Offense count: 1
119
+ Lint/StructNewOverride:
120
+ Exclude:
121
+ - 'lib/ddtrace/profiling/pprof/converter.rb'
122
+
111
123
  # Offense count: 1
112
124
  # Configuration parameters: AllowComments.
113
125
  Lint/SuppressedException:
@@ -149,12 +161,16 @@ Naming/VariableNumber:
149
161
  - 'spec/ddtrace/contrib/ethon/typhoeus_integration_spec.rb'
150
162
  - 'spec/ddtrace/contrib/resque/instrumentation_spec.rb'
151
163
 
152
- # Offense count: 12
164
+ # Offense count: 18
153
165
  Performance/MethodObjectAsBlock:
154
166
  Exclude:
155
167
  - 'lib/ddtrace/contrib/cucumber/formatter.rb'
156
168
  - 'lib/ddtrace/contrib/delayed_job/plugin.rb'
157
169
  - 'lib/ddtrace/pipeline.rb'
170
+ - 'lib/ddtrace/profiling/collectors/stack.rb'
171
+ - 'lib/ddtrace/profiling/pprof/builder.rb'
172
+ - 'lib/ddtrace/profiling/pprof/stack_sample.rb'
173
+ - 'lib/ddtrace/profiling/pprof/template.rb'
158
174
  - 'spec/ddtrace/contrib/cucumber/patcher_spec.rb'
159
175
 
160
176
  # Offense count: 6
@@ -307,7 +323,7 @@ RSpec/UnspecifiedException:
307
323
  - 'spec/ddtrace/contrib/delayed_job/plugin_spec.rb'
308
324
  - 'spec/ddtrace/contrib/sidekiq/tracer_configure_spec.rb'
309
325
 
310
- # Offense count: 303
326
+ # Offense count: 421
311
327
  # Configuration parameters: IgnoreNameless, IgnoreSymbolicNames.
312
328
  RSpec/VerifiedDoubles:
313
329
  Exclude:
@@ -351,7 +367,32 @@ RSpec/VerifiedDoubles:
351
367
  - 'spec/ddtrace/opentracer/tracer_spec.rb'
352
368
  - 'spec/ddtrace/patcher_spec.rb'
353
369
  - 'spec/ddtrace/pin_spec.rb'
370
+ - 'spec/ddtrace/profiling/backtrace_location_spec.rb'
371
+ - 'spec/ddtrace/profiling/collectors/stack_spec.rb'
372
+ - 'spec/ddtrace/profiling/encoding/profile_spec.rb'
373
+ - 'spec/ddtrace/profiling/events/stack_spec.rb'
374
+ - 'spec/ddtrace/profiling/exporter_spec.rb'
375
+ - 'spec/ddtrace/profiling/ext/cthread_spec.rb'
376
+ - 'spec/ddtrace/profiling/ext/forking_spec.rb'
377
+ - 'spec/ddtrace/profiling/flush_spec.rb'
378
+ - 'spec/ddtrace/profiling/pprof/builder_spec.rb'
379
+ - 'spec/ddtrace/profiling/pprof/converter_spec.rb'
380
+ - 'spec/ddtrace/profiling/pprof/message_set_spec.rb'
381
+ - 'spec/ddtrace/profiling/pprof/payload_spec.rb'
382
+ - 'spec/ddtrace/profiling/pprof/template_spec.rb'
383
+ - 'spec/ddtrace/profiling/transport/http/api/endpoint_spec.rb'
384
+ - 'spec/ddtrace/profiling/transport/http/api/instance_spec.rb'
385
+ - 'spec/ddtrace/profiling/transport/http/builder_spec.rb'
386
+ - 'spec/ddtrace/profiling/transport/http/client_spec.rb'
387
+ - 'spec/ddtrace/profiling/transport/http/response_spec.rb'
388
+ - 'spec/ddtrace/profiling/transport/http_spec.rb'
389
+ - 'spec/ddtrace/profiling/transport/io/client_spec.rb'
390
+ - 'spec/ddtrace/profiling/transport/io/response_spec.rb'
391
+ - 'spec/ddtrace/profiling/transport/io_spec.rb'
392
+ - 'spec/ddtrace/profiling/transport/parcel_spec.rb'
393
+ - 'spec/ddtrace/profiling_spec.rb'
354
394
  - 'spec/ddtrace/runtime/metrics_spec.rb'
395
+ - 'spec/ddtrace/tasks/exec_spec.rb'
355
396
  - 'spec/ddtrace/tracer_spec.rb'
356
397
  - 'spec/ddtrace/transport/http/adapters/net_spec.rb'
357
398
  - 'spec/ddtrace/transport/http/adapters/registry_spec.rb'
data/Appraisals CHANGED
@@ -41,6 +41,8 @@ elsif Gem::Version.new('2.0.0') <= Gem::Version.new(RUBY_VERSION) \
41
41
  gem 'rack-cache', '1.7.1'
42
42
  gem 'sqlite3', '~> 1.3.5'
43
43
  gem 'lograge', '< 0.4'
44
+ gem 'makara', '< 0.5.0' # >= 0.5.0 contain Ruby 2.3+ syntax
45
+ gem 'safe_yaml' # Required for makara, as YAML.safe_load is not available in Ruby 2.0
44
46
  end
45
47
 
46
48
  appraise 'rails32-postgres' do
@@ -88,6 +90,7 @@ elsif Gem::Version.new('2.0.0') <= Gem::Version.new(RUBY_VERSION) \
88
90
  gem 'hiredis'
89
91
  gem 'http'
90
92
  gem 'httpclient'
93
+ gem 'makara', '< 0.5.0' # >= 0.5.0 contain Ruby 2.3+ syntax
91
94
  gem 'mongo', '< 2.5'
92
95
  gem 'mysql2', '0.3.21', platform: :ruby
93
96
  gem 'pg', '< 1.0', platform: :ruby
@@ -99,6 +102,7 @@ elsif Gem::Version.new('2.0.0') <= Gem::Version.new(RUBY_VERSION) \
99
102
  gem 'rest-client'
100
103
  gem 'resque', '< 2.0'
101
104
  gem 'rspec', '>= 3.0.0'
105
+ gem 'safe_yaml' # Required for makara, as YAML.safe_load is not available in Ruby 2.0
102
106
  gem 'sequel', '~> 4.0', '< 4.37'
103
107
  gem 'sidekiq', '~> 3.5.4'
104
108
  gem 'sinatra', '1.4.5'
@@ -107,6 +111,10 @@ elsif Gem::Version.new('2.0.0') <= Gem::Version.new(RUBY_VERSION) \
107
111
  gem 'timers', '< 4.2'
108
112
  gem 'typhoeus'
109
113
  end
114
+
115
+ appraise 'core-old' do
116
+ gem 'dogstatsd-ruby', '~> 4'
117
+ end
110
118
  end
111
119
  elsif Gem::Version.new('2.1.0') <= Gem::Version.new(RUBY_VERSION) \
112
120
  && Gem::Version.new(RUBY_VERSION) < Gem::Version.new('2.2.0')
@@ -139,6 +147,7 @@ elsif Gem::Version.new('2.1.0') <= Gem::Version.new(RUBY_VERSION) \
139
147
  gem 'rack-cache', '1.7.1'
140
148
  gem 'sqlite3', '~> 1.3.5'
141
149
  gem 'lograge', '< 0.4'
150
+ gem 'makara', '< 0.5.0' # >= 0.5.0 contain Ruby 2.3+ syntax
142
151
  end
143
152
 
144
153
  appraise 'rails32-postgres' do
@@ -213,6 +222,7 @@ elsif Gem::Version.new('2.1.0') <= Gem::Version.new(RUBY_VERSION) \
213
222
  gem 'hiredis'
214
223
  gem 'http'
215
224
  gem 'httpclient'
225
+ gem 'makara', '< 0.5.0' # >= 0.5.0 contain Ruby 2.3+ syntax
216
226
  gem 'mongo', '< 2.5'
217
227
  gem 'mysql2', '0.3.21', platform: :ruby
218
228
  gem 'pg', '< 1.0', platform: :ruby
@@ -234,6 +244,10 @@ elsif Gem::Version.new('2.1.0') <= Gem::Version.new(RUBY_VERSION) \
234
244
  gem 'timers', '< 4.2'
235
245
  gem 'typhoeus'
236
246
  end
247
+
248
+ appraise 'core-old' do
249
+ gem 'dogstatsd-ruby', '~> 4'
250
+ end
237
251
  end
238
252
  elsif Gem::Version.new('2.2.0') <= Gem::Version.new(RUBY_VERSION) \
239
253
  && Gem::Version.new(RUBY_VERSION) < Gem::Version.new('2.3.0')
@@ -339,6 +353,7 @@ elsif Gem::Version.new('2.2.0') <= Gem::Version.new(RUBY_VERSION) \
339
353
  gem 'mysql2', '< 1', platform: :ruby
340
354
  gem 'sprockets', '< 4'
341
355
  gem 'lograge'
356
+ gem 'mimemagic', '0.3.9' # Pinned until https://github.com/mimemagicrb/mimemagic/issues/142 is resolved.
342
357
  end
343
358
 
344
359
  appraise 'rails5-postgres' do
@@ -346,6 +361,7 @@ elsif Gem::Version.new('2.2.0') <= Gem::Version.new(RUBY_VERSION) \
346
361
  gem 'pg', '< 1.0', platform: :ruby
347
362
  gem 'sprockets', '< 4'
348
363
  gem 'lograge'
364
+ gem 'mimemagic', '0.3.9' # Pinned until https://github.com/mimemagicrb/mimemagic/issues/142 is resolved.
349
365
  end
350
366
 
351
367
  appraise 'rails5-postgres-redis' do
@@ -354,6 +370,7 @@ elsif Gem::Version.new('2.2.0') <= Gem::Version.new(RUBY_VERSION) \
354
370
  gem 'redis', '>= 4.0.1'
355
371
  gem 'sprockets', '< 4'
356
372
  gem 'lograge'
373
+ gem 'mimemagic', '0.3.9' # Pinned until https://github.com/mimemagicrb/mimemagic/issues/142 is resolved.
357
374
  end
358
375
 
359
376
  appraise 'rails5-postgres-redis-activesupport' do
@@ -362,6 +379,7 @@ elsif Gem::Version.new('2.2.0') <= Gem::Version.new(RUBY_VERSION) \
362
379
  gem 'redis', '>= 4.0.1'
363
380
  gem 'sprockets', '< 4'
364
381
  gem 'lograge'
382
+ gem 'mimemagic', '0.3.9' # Pinned until https://github.com/mimemagicrb/mimemagic/issues/142 is resolved.
365
383
  end
366
384
 
367
385
  appraise 'rails5-postgres-sidekiq' do
@@ -371,6 +389,7 @@ elsif Gem::Version.new('2.2.0') <= Gem::Version.new(RUBY_VERSION) \
371
389
  gem 'activejob'
372
390
  gem 'sprockets', '< 4'
373
391
  gem 'lograge'
392
+ gem 'mimemagic', '0.3.9' # Pinned until https://github.com/mimemagicrb/mimemagic/issues/142 is resolved.
374
393
  end
375
394
 
376
395
  appraise 'contrib' do
@@ -391,10 +410,11 @@ elsif Gem::Version.new('2.2.0') <= Gem::Version.new(RUBY_VERSION) \
391
410
  gem 'faraday'
392
411
  gem 'grape'
393
412
  gem 'graphql', '>= 1.12.0'
394
- gem 'grpc', '~> 1.21.0' # Last version to support Ruby < 2.3
413
+ gem 'grpc', '~> 1.19.0' # Last version to support Ruby < 2.3 & google-protobuf < 3.7
395
414
  gem 'hiredis'
396
415
  gem 'http'
397
416
  gem 'httpclient'
417
+ gem 'makara', '< 0.5.0' # >= 0.5.0 contain Ruby 2.3+ syntax
398
418
  gem 'mongo', '>= 2.8.0'
399
419
  gem 'mysql2', '< 0.5', platform: :ruby
400
420
  gem 'qless'
@@ -417,6 +437,10 @@ elsif Gem::Version.new('2.2.0') <= Gem::Version.new(RUBY_VERSION) \
417
437
  gem 'typhoeus'
418
438
  gem 'que', '>= 1.0.0.beta2'
419
439
  end
440
+
441
+ appraise 'core-old' do
442
+ gem 'dogstatsd-ruby', '~> 4'
443
+ end
420
444
  end
421
445
  elsif Gem::Version.new('2.3.0') <= Gem::Version.new(RUBY_VERSION) \
422
446
  && Gem::Version.new(RUBY_VERSION) < Gem::Version.new('2.4.0')
@@ -589,6 +613,7 @@ elsif Gem::Version.new('2.3.0') <= Gem::Version.new(RUBY_VERSION) \
589
613
  gem 'hiredis'
590
614
  gem 'http'
591
615
  gem 'httpclient'
616
+ gem 'makara'
592
617
  gem 'mongo', '>= 2.8.0'
593
618
  gem 'mysql2', '< 0.5', platform: :ruby
594
619
  gem 'pg', platform: :ruby
@@ -617,6 +642,10 @@ elsif Gem::Version.new('2.3.0') <= Gem::Version.new(RUBY_VERSION) \
617
642
  appraise 'contrib-old' do
618
643
  gem 'faraday', '0.17'
619
644
  end
645
+
646
+ appraise 'core-old' do
647
+ gem 'dogstatsd-ruby', '~> 4'
648
+ end
620
649
  end
621
650
  elsif Gem::Version.new('2.4.0') <= Gem::Version.new(RUBY_VERSION) \
622
651
  && Gem::Version.new(RUBY_VERSION) < Gem::Version.new('2.5.0')
@@ -694,6 +723,7 @@ elsif Gem::Version.new('2.4.0') <= Gem::Version.new(RUBY_VERSION) \
694
723
  gem 'hiredis'
695
724
  gem 'http'
696
725
  gem 'httpclient'
726
+ gem 'makara'
697
727
  gem 'mongo', '>= 2.8.0'
698
728
  gem 'mysql2', '< 0.5', platform: :ruby
699
729
  gem 'pg', platform: :ruby
@@ -722,6 +752,10 @@ elsif Gem::Version.new('2.4.0') <= Gem::Version.new(RUBY_VERSION) \
722
752
  appraise 'contrib-old' do
723
753
  gem 'faraday', '0.17'
724
754
  end
755
+
756
+ appraise 'core-old' do
757
+ gem 'dogstatsd-ruby', '~> 4'
758
+ end
725
759
  end
726
760
  elsif Gem::Version.new('2.5.0') <= Gem::Version.new(RUBY_VERSION) \
727
761
  && Gem::Version.new(RUBY_VERSION) < Gem::Version.new('2.6.0')
@@ -895,6 +929,7 @@ elsif Gem::Version.new('2.5.0') <= Gem::Version.new(RUBY_VERSION) \
895
929
  gem 'http'
896
930
  gem 'httpclient'
897
931
  gem 'i18n', '1.8.7', platform: :jruby # Removal pending: https://github.com/ruby-i18n/i18n/issues/555#issuecomment-772112169
932
+ gem 'makara'
898
933
  gem 'mongo', '>= 2.8.0'
899
934
  gem 'mysql2', '< 1', platform: :ruby
900
935
  gem 'activerecord-jdbcmysql-adapter', '>= 60.2', platform: :jruby
@@ -926,6 +961,10 @@ elsif Gem::Version.new('2.5.0') <= Gem::Version.new(RUBY_VERSION) \
926
961
  appraise 'contrib-old' do
927
962
  gem 'faraday', '0.17'
928
963
  end
964
+
965
+ appraise 'core-old' do
966
+ gem 'dogstatsd-ruby', '~> 4'
967
+ end
929
968
  elsif Gem::Version.new('2.6.0') <= Gem::Version.new(RUBY_VERSION) \
930
969
  && Gem::Version.new(RUBY_VERSION) < Gem::Version.new('2.7.0')
931
970
  if RUBY_PLATFORM != 'java'
@@ -1070,6 +1109,7 @@ elsif Gem::Version.new('2.6.0') <= Gem::Version.new(RUBY_VERSION) \
1070
1109
  gem 'hiredis'
1071
1110
  gem 'http'
1072
1111
  gem 'httpclient'
1112
+ gem 'makara'
1073
1113
  gem 'mongo', '>= 2.8.0'
1074
1114
  gem 'mysql2', '< 1', platform: :ruby
1075
1115
  gem 'pg', platform: :ruby
@@ -1098,6 +1138,10 @@ elsif Gem::Version.new('2.6.0') <= Gem::Version.new(RUBY_VERSION) \
1098
1138
  appraise 'contrib-old' do
1099
1139
  gem 'faraday', '0.17'
1100
1140
  end
1141
+
1142
+ appraise 'core-old' do
1143
+ gem 'dogstatsd-ruby', '~> 4'
1144
+ end
1101
1145
  end
1102
1146
  elsif Gem::Version.new('2.7.0') <= Gem::Version.new(RUBY_VERSION) \
1103
1147
  && Gem::Version.new(RUBY_VERSION) < Gem::Version.new('3.0.0')
@@ -1246,6 +1290,7 @@ elsif Gem::Version.new('2.7.0') <= Gem::Version.new(RUBY_VERSION) \
1246
1290
  gem 'hiredis'
1247
1291
  gem 'http'
1248
1292
  gem 'httpclient'
1293
+ gem 'makara'
1249
1294
  gem 'mongo', '>= 2.8.0'
1250
1295
  gem 'mysql2', '< 1', platform: :ruby
1251
1296
  gem 'pg', platform: :ruby
@@ -1274,6 +1319,10 @@ elsif Gem::Version.new('2.7.0') <= Gem::Version.new(RUBY_VERSION) \
1274
1319
  appraise 'contrib-old' do
1275
1320
  gem 'faraday', '0.17'
1276
1321
  end
1322
+
1323
+ appraise 'core-old' do
1324
+ gem 'dogstatsd-ruby', '~> 4'
1325
+ end
1277
1326
  end
1278
1327
  elsif Gem::Version.new('3.0.0') <= Gem::Version.new(RUBY_VERSION)
1279
1328
  appraise 'rails61-mysql2' do
@@ -1338,6 +1387,7 @@ elsif Gem::Version.new('3.0.0') <= Gem::Version.new(RUBY_VERSION)
1338
1387
  gem 'hiredis'
1339
1388
  gem 'http'
1340
1389
  gem 'httpclient'
1390
+ gem 'makara', '>= 0.6.0.pre' # Ruby 3 requires >= 0.6.0, which is currently in pre-release: https://rubygems.org/gems/makara/versions
1341
1391
  gem 'mongo', '>= 2.8.0'
1342
1392
  gem 'mysql2', '>= 0.5.3', platform: :ruby
1343
1393
  gem 'pg', '>= 1.1', platform: :ruby
@@ -1362,4 +1412,8 @@ elsif Gem::Version.new('3.0.0') <= Gem::Version.new(RUBY_VERSION)
1362
1412
  gem 'typhoeus'
1363
1413
  gem 'que', '>= 1.0.0.beta2'
1364
1414
  end
1415
+
1416
+ appraise 'core-old' do
1417
+ gem 'dogstatsd-ruby', '~> 4'
1418
+ end
1365
1419
  end