ddtrace 0.34.2 → 0.35.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 +5 -5
- data/.circleci/config.yml +58 -9
- data/.circleci/images/primary/Dockerfile-jruby-9.2 +77 -0
- data/Appraisals +1 -1
- data/CHANGELOG.md +33 -1
- data/Rakefile +1 -1
- data/ddtrace.gemspec +5 -3
- data/docs/DevelopmentGuide.md +1 -1
- data/docs/GettingStarted.md +89 -36
- data/lib/ddtrace.rb +1 -1
- data/lib/ddtrace/buffer.rb +9 -9
- data/lib/ddtrace/chunker.rb +34 -0
- data/lib/ddtrace/configuration.rb +28 -5
- data/lib/ddtrace/configuration/components.rb +154 -0
- data/lib/ddtrace/configuration/settings.rb +131 -63
- data/lib/ddtrace/context.rb +6 -6
- data/lib/ddtrace/context_flush.rb +1 -1
- data/lib/ddtrace/contrib/action_cable/instrumentation.rb +1 -1
- data/lib/ddtrace/contrib/action_pack/action_controller/instrumentation.rb +2 -2
- data/lib/ddtrace/contrib/action_view/events/render_partial.rb +1 -1
- data/lib/ddtrace/contrib/action_view/events/render_template.rb +1 -1
- data/lib/ddtrace/contrib/action_view/instrumentation/partial_renderer.rb +1 -1
- data/lib/ddtrace/contrib/action_view/instrumentation/template_renderer.rb +2 -2
- data/lib/ddtrace/contrib/action_view/patcher.rb +1 -1
- data/lib/ddtrace/contrib/active_record/events/instantiation.rb +1 -1
- data/lib/ddtrace/contrib/active_record/events/sql.rb +1 -1
- data/lib/ddtrace/contrib/active_support/cache/instrumentation.rb +2 -2
- data/lib/ddtrace/contrib/active_support/notifications/subscription.rb +2 -2
- data/lib/ddtrace/contrib/analytics.rb +1 -1
- data/lib/ddtrace/contrib/dalli/patcher.rb +1 -1
- data/lib/ddtrace/contrib/dalli/quantize.rb +1 -1
- data/lib/ddtrace/contrib/elasticsearch/patcher.rb +1 -1
- data/lib/ddtrace/contrib/excon/middleware.rb +2 -2
- data/lib/ddtrace/contrib/faraday/patcher.rb +1 -1
- data/lib/ddtrace/contrib/grape/endpoint.rb +5 -5
- data/lib/ddtrace/contrib/grape/patcher.rb +1 -1
- data/lib/ddtrace/contrib/grpc/datadog_interceptor/client.rb +1 -1
- data/lib/ddtrace/contrib/grpc/datadog_interceptor/server.rb +2 -2
- data/lib/ddtrace/contrib/grpc/patcher.rb +1 -1
- data/lib/ddtrace/contrib/http/instrumentation.rb +1 -1
- data/lib/ddtrace/contrib/mongodb/subscribers.rb +2 -2
- data/lib/ddtrace/contrib/patchable.rb +1 -1
- data/lib/ddtrace/contrib/patcher.rb +3 -3
- data/lib/ddtrace/contrib/presto/instrumentation.rb +3 -3
- data/lib/ddtrace/contrib/presto/patcher.rb +1 -1
- data/lib/ddtrace/contrib/rack/middlewares.rb +2 -2
- data/lib/ddtrace/contrib/rack/patcher.rb +2 -2
- data/lib/ddtrace/contrib/rack/request_queue.rb +1 -1
- data/lib/ddtrace/contrib/rake/instrumentation.rb +2 -2
- data/lib/ddtrace/contrib/redis/quantize.rb +1 -1
- data/lib/ddtrace/contrib/resque/resque_job.rb +2 -2
- data/lib/ddtrace/contrib/sidekiq/tracing.rb +1 -1
- data/lib/ddtrace/contrib/sinatra/env.rb +20 -0
- data/lib/ddtrace/contrib/sinatra/ext.rb +6 -0
- data/lib/ddtrace/contrib/sinatra/patcher.rb +1 -0
- data/lib/ddtrace/contrib/sinatra/tracer.rb +98 -35
- data/lib/ddtrace/contrib/sinatra/tracer_middleware.rb +16 -13
- data/lib/ddtrace/correlation.rb +9 -6
- data/lib/ddtrace/diagnostics/health.rb +2 -6
- data/lib/ddtrace/encoding.rb +13 -39
- data/lib/ddtrace/event.rb +1 -1
- data/lib/ddtrace/ext/correlation.rb +1 -0
- data/lib/ddtrace/ext/diagnostics.rb +2 -0
- data/lib/ddtrace/ext/environment.rb +1 -0
- data/lib/ddtrace/ext/forced_tracing.rb +1 -1
- data/lib/ddtrace/logger.rb +3 -44
- data/lib/ddtrace/metrics.rb +5 -5
- data/lib/ddtrace/monkey.rb +1 -1
- data/lib/ddtrace/opentracer/global_tracer.rb +1 -1
- data/lib/ddtrace/pin.rb +1 -1
- data/lib/ddtrace/pipeline.rb +1 -1
- data/lib/ddtrace/propagation/http_propagator.rb +2 -2
- data/lib/ddtrace/runtime/cgroup.rb +1 -1
- data/lib/ddtrace/runtime/container.rb +1 -1
- data/lib/ddtrace/runtime/metrics.rb +5 -2
- data/lib/ddtrace/sampler.rb +2 -2
- data/lib/ddtrace/sampling/rule.rb +1 -1
- data/lib/ddtrace/sampling/rule_sampler.rb +1 -1
- data/lib/ddtrace/span.rb +4 -4
- data/lib/ddtrace/sync_writer.rb +3 -8
- data/lib/ddtrace/tracer.rb +26 -31
- data/lib/ddtrace/transport/http.rb +1 -1
- data/lib/ddtrace/transport/http/api/instance.rb +4 -0
- data/lib/ddtrace/transport/http/builder.rb +3 -5
- data/lib/ddtrace/transport/http/client.rb +7 -64
- data/lib/ddtrace/transport/http/response.rb +1 -1
- data/lib/ddtrace/transport/http/statistics.rb +1 -1
- data/lib/ddtrace/transport/http/traces.rb +10 -7
- data/lib/ddtrace/transport/io.rb +1 -1
- data/lib/ddtrace/transport/io/client.rb +2 -2
- data/lib/ddtrace/transport/io/response.rb +3 -1
- data/lib/ddtrace/transport/io/traces.rb +50 -3
- data/lib/ddtrace/transport/parcel.rb +0 -4
- data/lib/ddtrace/transport/statistics.rb +2 -2
- data/lib/ddtrace/transport/traces.rb +160 -10
- data/lib/ddtrace/utils.rb +1 -1
- data/lib/ddtrace/version.rb +2 -2
- data/lib/ddtrace/workers.rb +5 -13
- data/lib/ddtrace/workers/async.rb +2 -2
- data/lib/ddtrace/workers/runtime_metrics.rb +47 -0
- data/lib/ddtrace/workers/trace_writer.rb +199 -0
- data/lib/ddtrace/writer.rb +20 -27
- metadata +22 -32
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
|
-
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
2
|
+
SHA256:
|
|
3
|
+
metadata.gz: 21f4247167d50bf629af437139a08b0b07ce84f66d4a1c273b327bd3a909510c
|
|
4
|
+
data.tar.gz: 0a71268b253fdfea93c6ecb749edd4758e99e25728a48f777832780d7c915ea6
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: a38ea403030ed7405b11401b7ff7b81cbd7669bfe5aac582e03c57da96c81f5294dd7b073107441400f506135590e246dffebdb0b169abfc0da2f0d275e6d47e
|
|
7
|
+
data.tar.gz: d33fa196c75876d526c79dbd041ea31c367e0084588f740ed6322fe38bc716dae9d97e50c2b981f5437774716767bc7cae461f5bfe21911571e8f6596a501a9b
|
data/.circleci/config.yml
CHANGED
|
@@ -59,6 +59,9 @@ step_compute_bundle_checksum: &step_compute_bundle_checksum
|
|
|
59
59
|
run:
|
|
60
60
|
name: Compute bundle checksum
|
|
61
61
|
command: |
|
|
62
|
+
# JRuby: Ensure files exist when Appraisal generates no output
|
|
63
|
+
mkdir gemfiles
|
|
64
|
+
touch gemfiles/_.gemfile.lock
|
|
62
65
|
cat Gemfile.lock gemfiles/*.gemfile.lock > .circleci/bundle_checksum
|
|
63
66
|
step_run_all_tests: &step_run_all_tests
|
|
64
67
|
run:
|
|
@@ -110,10 +113,6 @@ orbs:
|
|
|
110
113
|
image:
|
|
111
114
|
description: Docker image location
|
|
112
115
|
type: string
|
|
113
|
-
rubocop:
|
|
114
|
-
description: Run Rubocop on this version of Ruby
|
|
115
|
-
type: boolean
|
|
116
|
-
default: true
|
|
117
116
|
docker:
|
|
118
117
|
- <<: *container_base
|
|
119
118
|
image: <<parameters.image>>
|
|
@@ -132,10 +131,6 @@ orbs:
|
|
|
132
131
|
keys:
|
|
133
132
|
- '{{ .Environment.CIRCLE_CACHE_VERSION }}-bundle-<<parameters.ruby_version>>-{{ checksum ".circleci/bundle_checksum" }}'
|
|
134
133
|
- *step_bundle_install
|
|
135
|
-
- when:
|
|
136
|
-
condition: <<parameters.rubocop>>
|
|
137
|
-
steps:
|
|
138
|
-
- *step_rubocop
|
|
139
134
|
- *step_appraisal_install
|
|
140
135
|
- *step_compute_bundle_checksum
|
|
141
136
|
- save_cache:
|
|
@@ -212,6 +207,28 @@ orbs:
|
|
|
212
207
|
- run:
|
|
213
208
|
name: Run Benchmark without ddtracer
|
|
214
209
|
command: rm -f lib/ddtrace.rb && bundle exec appraisal rails5-postgres-sidekiq ruby benchmarks/sidekiq_test.rb 2>&1 1> /dev/null | tee benchmark_results.csv
|
|
210
|
+
lint:
|
|
211
|
+
<<: *job_defaults
|
|
212
|
+
parameters:
|
|
213
|
+
ruby_version:
|
|
214
|
+
description: Ruby version
|
|
215
|
+
type: string
|
|
216
|
+
image:
|
|
217
|
+
description: Docker image location
|
|
218
|
+
type: string
|
|
219
|
+
docker:
|
|
220
|
+
- <<: *container_base
|
|
221
|
+
image: <<parameters.image>>
|
|
222
|
+
environment:
|
|
223
|
+
- BUNDLE_GEMFILE: /app/Gemfile
|
|
224
|
+
steps:
|
|
225
|
+
- restore_cache:
|
|
226
|
+
keys:
|
|
227
|
+
- '{{ .Environment.CIRCLE_CACHE_VERSION }}-bundled-repo-<<parameters.ruby_version>>-{{ .Environment.CIRCLE_SHA1 }}'
|
|
228
|
+
- restore_cache:
|
|
229
|
+
keys:
|
|
230
|
+
- '{{ .Environment.CIRCLE_CACHE_VERSION }}-bundle-<<parameters.ruby_version>>-{{ checksum ".circleci/bundle_checksum" }}'
|
|
231
|
+
- *step_rubocop
|
|
215
232
|
commands:
|
|
216
233
|
executors:
|
|
217
234
|
|
|
@@ -224,6 +241,7 @@ jobs:
|
|
|
224
241
|
steps:
|
|
225
242
|
- checkout
|
|
226
243
|
- run:
|
|
244
|
+
name: Install AWS CLI
|
|
227
245
|
command: |
|
|
228
246
|
apt-get -y -qq update
|
|
229
247
|
apt-get -y -qq install awscli
|
|
@@ -251,6 +269,7 @@ jobs:
|
|
|
251
269
|
fi
|
|
252
270
|
- checkout
|
|
253
271
|
- run:
|
|
272
|
+
name: Install AWS CLI
|
|
254
273
|
command: |
|
|
255
274
|
apt-get -y -qq update
|
|
256
275
|
apt-get -y -qq install awscli
|
|
@@ -270,6 +289,7 @@ jobs:
|
|
|
270
289
|
destination: gem
|
|
271
290
|
|
|
272
291
|
job_configuration:
|
|
292
|
+
# MRI
|
|
273
293
|
- &config-2_0
|
|
274
294
|
<<: *filters_all_branches_and_tags
|
|
275
295
|
ruby_version: '2.0'
|
|
@@ -302,17 +322,27 @@ job_configuration:
|
|
|
302
322
|
<<: *filters_all_branches_and_tags
|
|
303
323
|
ruby_version: '2.7'
|
|
304
324
|
image: marcotc/docker-library:ddtrace_rb_2_7_0
|
|
325
|
+
# JRuby
|
|
326
|
+
- &config-jruby-9_2
|
|
327
|
+
<<: *filters_all_branches_and_tags
|
|
328
|
+
ruby_version: 'jruby-9.2'
|
|
329
|
+
image: marcotc/docker-library:ddtrace_rb_jruby_9_2
|
|
305
330
|
|
|
306
331
|
workflows:
|
|
307
332
|
version: 2
|
|
308
333
|
build-and-test:
|
|
309
334
|
jobs:
|
|
335
|
+
- orb/lint:
|
|
336
|
+
<<: *config-2_6
|
|
337
|
+
name: lint
|
|
338
|
+
requires:
|
|
339
|
+
- build-2.6
|
|
340
|
+
# MRI
|
|
310
341
|
- orb/checkout:
|
|
311
342
|
<<: *config-2_0
|
|
312
343
|
name: checkout-2.0
|
|
313
344
|
- orb/build:
|
|
314
345
|
<<: *config-2_0
|
|
315
|
-
rubocop: false
|
|
316
346
|
name: build-2.0
|
|
317
347
|
requires:
|
|
318
348
|
- checkout-2.0
|
|
@@ -417,9 +447,25 @@ workflows:
|
|
|
417
447
|
name: test-2.7
|
|
418
448
|
requires:
|
|
419
449
|
- build-2.7
|
|
450
|
+
# JRuby
|
|
451
|
+
- orb/checkout:
|
|
452
|
+
<<: *config-jruby-9_2
|
|
453
|
+
name: checkout-jruby-9.2
|
|
454
|
+
- orb/build:
|
|
455
|
+
<<: *config-jruby-9_2
|
|
456
|
+
name: build-jruby-9.2
|
|
457
|
+
requires:
|
|
458
|
+
- checkout-jruby-9.2
|
|
459
|
+
- orb/test:
|
|
460
|
+
<<: *config-jruby-9_2
|
|
461
|
+
name: test-jruby-9.2
|
|
462
|
+
requires:
|
|
463
|
+
- build-jruby-9.2
|
|
464
|
+
# Release jobs
|
|
420
465
|
- "deploy prerelease Gem":
|
|
421
466
|
<<: *filters_all_branches_and_tags
|
|
422
467
|
requires:
|
|
468
|
+
- lint
|
|
423
469
|
- test-2.0
|
|
424
470
|
- test-2.1
|
|
425
471
|
- test-2.2
|
|
@@ -428,9 +474,11 @@ workflows:
|
|
|
428
474
|
- test-2.5
|
|
429
475
|
- test-2.6
|
|
430
476
|
- test-2.7
|
|
477
|
+
- test-jruby-9.2
|
|
431
478
|
- "deploy release":
|
|
432
479
|
<<: *filters_only_release_tags
|
|
433
480
|
requires:
|
|
481
|
+
- lint
|
|
434
482
|
- test-2.0
|
|
435
483
|
- test-2.1
|
|
436
484
|
- test-2.2
|
|
@@ -439,3 +487,4 @@ workflows:
|
|
|
439
487
|
- test-2.5
|
|
440
488
|
- test-2.6
|
|
441
489
|
- test-2.7
|
|
490
|
+
- test-jruby-9.2
|
|
@@ -0,0 +1,77 @@
|
|
|
1
|
+
# Current version: https://github.com/cpuguy83/docker-jruby/blob/db08637839406420a254a9c825d94994cded5021/9000/jre/Dockerfile
|
|
2
|
+
FROM jruby:9.2.11.1
|
|
3
|
+
|
|
4
|
+
# Make apt non-interactive
|
|
5
|
+
RUN echo 'APT::Get::Assume-Yes "true";' > /etc/apt/apt.conf.d/90circleci \
|
|
6
|
+
&& echo 'DPkg::Options "--force-confnew";' >> /etc/apt/apt.conf.d/90circleci
|
|
7
|
+
|
|
8
|
+
ENV DEBIAN_FRONTEND=noninteractive
|
|
9
|
+
|
|
10
|
+
# Install required packages
|
|
11
|
+
RUN set -ex; \
|
|
12
|
+
apt-get update; \
|
|
13
|
+
mkdir -p /usr/share/man/man1; \
|
|
14
|
+
apt-get install -y --no-install-recommends \
|
|
15
|
+
git mercurial xvfb \
|
|
16
|
+
locales sudo openssh-client ca-certificates tar gzip parallel \
|
|
17
|
+
net-tools netcat unzip zip bzip2 gnupg curl wget \
|
|
18
|
+
tzdata rsync vim \
|
|
19
|
+
build-essential; \
|
|
20
|
+
rm -rf /var/lib/apt/lists/*;
|
|
21
|
+
|
|
22
|
+
# Set timezone to UTC by default
|
|
23
|
+
RUN ln -sf /usr/share/zoneinfo/Etc/UTC /etc/localtime
|
|
24
|
+
|
|
25
|
+
# Set language
|
|
26
|
+
RUN locale-gen en_US.UTF-8
|
|
27
|
+
ENV LANG en_US.UTF-8
|
|
28
|
+
ENV LANGUAGE en_US:en
|
|
29
|
+
|
|
30
|
+
# Install jq
|
|
31
|
+
RUN JQ_URL="https://circle-downloads.s3.amazonaws.com/circleci-images/cache/linux-amd64/jq-latest" \
|
|
32
|
+
&& curl --silent --show-error --location --fail --retry 3 --output /usr/bin/jq $JQ_URL \
|
|
33
|
+
&& chmod +x /usr/bin/jq \
|
|
34
|
+
&& jq --version
|
|
35
|
+
|
|
36
|
+
# Install Docker
|
|
37
|
+
RUN set -ex \
|
|
38
|
+
&& export DOCKER_VERSION=$(curl --silent --fail --retry 3 https://download.docker.com/linux/static/stable/x86_64/ | grep -o -e 'docker-[.0-9]*-ce\.tgz' | sort -r | head -n 1) \
|
|
39
|
+
&& DOCKER_URL="https://download.docker.com/linux/static/stable/x86_64/${DOCKER_VERSION}" \
|
|
40
|
+
&& echo Docker URL: $DOCKER_URL \
|
|
41
|
+
&& curl --silent --show-error --location --fail --retry 3 --output /tmp/docker.tgz "${DOCKER_URL}" \
|
|
42
|
+
&& ls -lha /tmp/docker.tgz \
|
|
43
|
+
&& tar -xz -C /tmp -f /tmp/docker.tgz \
|
|
44
|
+
&& mv /tmp/docker/* /usr/bin \
|
|
45
|
+
&& rm -rf /tmp/docker /tmp/docker.tgz \
|
|
46
|
+
&& which docker \
|
|
47
|
+
&& (docker version || true)
|
|
48
|
+
|
|
49
|
+
# Install Docker Compose
|
|
50
|
+
RUN COMPOSE_URL="https://circle-downloads.s3.amazonaws.com/circleci-images/cache/linux-amd64/docker-compose-latest" \
|
|
51
|
+
&& curl --silent --show-error --location --fail --retry 3 --output /usr/bin/docker-compose $COMPOSE_URL \
|
|
52
|
+
&& chmod +x /usr/bin/docker-compose \
|
|
53
|
+
&& docker-compose version
|
|
54
|
+
|
|
55
|
+
# Install Dockerize
|
|
56
|
+
RUN DOCKERIZE_URL="https://circle-downloads.s3.amazonaws.com/circleci-images/cache/linux-amd64/dockerize-latest.tar.gz" \
|
|
57
|
+
&& curl --silent --show-error --location --fail --retry 3 --output /tmp/dockerize-linux-amd64.tar.gz $DOCKERIZE_URL \
|
|
58
|
+
&& tar -C /usr/local/bin -xzvf /tmp/dockerize-linux-amd64.tar.gz \
|
|
59
|
+
&& rm -rf /tmp/dockerize-linux-amd64.tar.gz \
|
|
60
|
+
&& dockerize --version
|
|
61
|
+
|
|
62
|
+
# Install RubyGems
|
|
63
|
+
RUN gem update --system
|
|
64
|
+
RUN mkdir -p "$GEM_HOME" && chmod -R 777 "$GEM_HOME"
|
|
65
|
+
|
|
66
|
+
# Upgrade RubyGems and Bundler
|
|
67
|
+
RUN gem uninstall -i /opt/jruby/lib/ruby/gems/shared bundler -v 2.1.4 # Remove when https://github.com/thoughtbot/appraisal/issues/162 is fixed
|
|
68
|
+
RUN gem install bundler -v 2.1.2 # Remove when https://github.com/thoughtbot/appraisal/issues/162 is fixed
|
|
69
|
+
ENV BUNDLE_SILENCE_ROOT_WARNING 1
|
|
70
|
+
|
|
71
|
+
# Ensure JRuby is available when running "bash --login"
|
|
72
|
+
RUN echo "export PATH=/opt/jruby/bin:$BUNDLE_BIN:\$PATH" >> ~/.profile
|
|
73
|
+
|
|
74
|
+
RUN mkdir /app
|
|
75
|
+
WORKDIR /app
|
|
76
|
+
|
|
77
|
+
CMD ["bin", "bash", "--login"]
|
data/Appraisals
CHANGED
|
@@ -916,7 +916,7 @@ elsif Gem::Version.new('2.7.0') <= Gem::Version.new(RUBY_VERSION)
|
|
|
916
916
|
gem 'excon'
|
|
917
917
|
gem 'grape'
|
|
918
918
|
gem 'graphql'
|
|
919
|
-
|
|
919
|
+
gem 'grpc'
|
|
920
920
|
gem 'hiredis'
|
|
921
921
|
gem 'mongo', '>= 2.8.0'
|
|
922
922
|
gem 'mysql2', '< 0.5', platform: :ruby
|
data/CHANGELOG.md
CHANGED
|
@@ -2,6 +2,37 @@
|
|
|
2
2
|
|
|
3
3
|
## [Unreleased]
|
|
4
4
|
|
|
5
|
+
## [0.35.0] - 2020-04-29
|
|
6
|
+
|
|
7
|
+
Release notes: https://github.com/DataDog/dd-trace-rb/releases/tag/v0.35.0
|
|
8
|
+
|
|
9
|
+
Git diff: https://github.com/DataDog/dd-trace-rb/compare/v0.34.2...v0.35.0
|
|
10
|
+
|
|
11
|
+
### Added
|
|
12
|
+
|
|
13
|
+
- Chunk large trace payloads before flushing (#818, #840)
|
|
14
|
+
- Support for Sinatra modular apps (#486, #913, #1015) (@jpaulgs, @tomasv, @ZimbiX)
|
|
15
|
+
- active_job support for Resque (#991) (@stefanahman, @psycholein)
|
|
16
|
+
- JRuby 9.2 to CI test matrix (#995)
|
|
17
|
+
- `TraceWriter` and `AsyncTraceWriter` workers (#986)
|
|
18
|
+
- Runtime metrics worker (#988)
|
|
19
|
+
|
|
20
|
+
### Changed
|
|
21
|
+
|
|
22
|
+
- Populate env, service, and version from tags (#1008)
|
|
23
|
+
- Extract components from configuration (#996)
|
|
24
|
+
- Extract logger to components (#997)
|
|
25
|
+
- Extract runtime metrics worker from `Writer` (#1004)
|
|
26
|
+
- Improvements to Faraday documentation (#1005)
|
|
27
|
+
|
|
28
|
+
### Fixed
|
|
29
|
+
|
|
30
|
+
- Runtime metrics not starting after #write (#1010)
|
|
31
|
+
|
|
32
|
+
### Refactored
|
|
33
|
+
|
|
34
|
+
- Improvements to test suite (#842, #1006, #1009)
|
|
35
|
+
|
|
5
36
|
## [0.34.2] - 2020-04-09
|
|
6
37
|
|
|
7
38
|
Release notes: https://github.com/DataDog/dd-trace-rb/releases/tag/v0.34.2
|
|
@@ -1164,7 +1195,8 @@ Release notes: https://github.com/DataDog/dd-trace-rb/releases/tag/v0.3.1
|
|
|
1164
1195
|
|
|
1165
1196
|
Git diff: https://github.com/DataDog/dd-trace-rb/compare/v0.3.0...v0.3.1
|
|
1166
1197
|
|
|
1167
|
-
[Unreleased]: https://github.com/DataDog/dd-trace-rb/compare/v0.
|
|
1198
|
+
[Unreleased]: https://github.com/DataDog/dd-trace-rb/compare/v0.35.0...master
|
|
1199
|
+
[0.35.0]: https://github.com/DataDog/dd-trace-rb/compare/v0.34.2...v0.35.0
|
|
1168
1200
|
[0.34.2]: https://github.com/DataDog/dd-trace-rb/compare/v0.34.1...v0.34.2
|
|
1169
1201
|
[0.34.1]: https://github.com/DataDog/dd-trace-rb/compare/v0.34.0...v0.34.1
|
|
1170
1202
|
[0.34.0]: https://github.com/DataDog/dd-trace-rb/compare/v0.33.1...v0.34.0
|
data/Rakefile
CHANGED
|
@@ -678,7 +678,7 @@ task :ci do
|
|
|
678
678
|
sh 'bundle exec appraisal contrib rake spec:faraday'
|
|
679
679
|
sh 'bundle exec appraisal contrib rake spec:grape'
|
|
680
680
|
sh 'bundle exec appraisal contrib rake spec:graphql'
|
|
681
|
-
|
|
681
|
+
sh 'bundle exec appraisal contrib rake spec:grpc'
|
|
682
682
|
sh 'bundle exec appraisal contrib rake spec:http'
|
|
683
683
|
sh 'bundle exec appraisal contrib rake spec:mongodb'
|
|
684
684
|
sh 'bundle exec appraisal contrib rake spec:mysql2'
|
data/ddtrace.gemspec
CHANGED
|
@@ -47,12 +47,14 @@ Gem::Specification.new do |spec|
|
|
|
47
47
|
spec.add_development_dependency 'rspec-collection_matchers', '~> 1.1'
|
|
48
48
|
spec.add_development_dependency 'minitest', '= 5.10.1'
|
|
49
49
|
spec.add_development_dependency 'appraisal', '~> 2.2'
|
|
50
|
-
spec.add_development_dependency 'bundler', '<= 2.1.2' # Remove when https://github.com/thoughtbot/appraisal/issues/162 is fixed
|
|
51
50
|
spec.add_development_dependency 'yard', '~> 0.9'
|
|
52
51
|
spec.add_development_dependency 'webmock', '~> 2.0'
|
|
53
52
|
spec.add_development_dependency 'builder'
|
|
54
|
-
|
|
55
|
-
|
|
53
|
+
if RUBY_PLATFORM != 'java'
|
|
54
|
+
spec.add_development_dependency 'sqlite3', '~> 1.3.6'
|
|
55
|
+
else
|
|
56
|
+
spec.add_development_dependency 'jdbc-sqlite3', '~> 3'
|
|
57
|
+
end
|
|
56
58
|
spec.add_development_dependency 'climate_control', '~> 0.2.0'
|
|
57
59
|
|
|
58
60
|
# locking transitive dependency of webmock
|
data/docs/DevelopmentGuide.md
CHANGED
data/docs/GettingStarted.md
CHANGED
|
@@ -92,7 +92,7 @@ To contribute, check out the [contribution guidelines][contribution docs] and [d
|
|
|
92
92
|
| | | 2.0 | Full | Latest |
|
|
93
93
|
| | | 1.9.3 | Maintenance (until August 6th, 2020) | < 0.27.0 |
|
|
94
94
|
| | | 1.9.1 | Maintenance (until August 6th, 2020) | < 0.27.0 |
|
|
95
|
-
| JRuby | http://jruby.org/ | 9.
|
|
95
|
+
| JRuby | http://jruby.org/ | 9.2.0.0 | Alpha | Latest |
|
|
96
96
|
|
|
97
97
|
**Supported web servers**:
|
|
98
98
|
|
|
@@ -771,7 +771,7 @@ Datadog.configure do |c|
|
|
|
771
771
|
end
|
|
772
772
|
end
|
|
773
773
|
|
|
774
|
-
#
|
|
774
|
+
# In case you want to override the global configuration for a certain client instance
|
|
775
775
|
connection = Faraday.new('https://example.com') do |builder|
|
|
776
776
|
builder.use(:ddtrace, options)
|
|
777
777
|
builder.adapter Faraday.default_adapter
|
|
@@ -1498,6 +1498,8 @@ The Sinatra integration traces requests and template rendering.
|
|
|
1498
1498
|
|
|
1499
1499
|
To start using the tracing client, make sure you import `ddtrace` and `use :sinatra` after either `sinatra` or `sinatra/base`, and before you define your application/routes:
|
|
1500
1500
|
|
|
1501
|
+
#### Classic application
|
|
1502
|
+
|
|
1501
1503
|
```ruby
|
|
1502
1504
|
require 'sinatra'
|
|
1503
1505
|
require 'ddtrace'
|
|
@@ -1511,7 +1513,40 @@ get '/' do
|
|
|
1511
1513
|
end
|
|
1512
1514
|
```
|
|
1513
1515
|
|
|
1514
|
-
|
|
1516
|
+
#### Modular application
|
|
1517
|
+
|
|
1518
|
+
```ruby
|
|
1519
|
+
require 'sinatra/base'
|
|
1520
|
+
require 'ddtrace'
|
|
1521
|
+
|
|
1522
|
+
Datadog.configure do |c|
|
|
1523
|
+
c.use :sinatra, options
|
|
1524
|
+
end
|
|
1525
|
+
|
|
1526
|
+
class NestedApp < Sinatra::Base
|
|
1527
|
+
register Datadog::Contrib::Sinatra::Tracer
|
|
1528
|
+
|
|
1529
|
+
get '/nested' do
|
|
1530
|
+
'Hello from nested app!'
|
|
1531
|
+
end
|
|
1532
|
+
end
|
|
1533
|
+
|
|
1534
|
+
class App < Sinatra::Base
|
|
1535
|
+
register Datadog::Contrib::Sinatra::Tracer
|
|
1536
|
+
|
|
1537
|
+
use NestedApp
|
|
1538
|
+
|
|
1539
|
+
get '/' do
|
|
1540
|
+
'Hello world!'
|
|
1541
|
+
end
|
|
1542
|
+
end
|
|
1543
|
+
```
|
|
1544
|
+
|
|
1545
|
+
Ensure you register `Datadog::Contrib::Sinatra::Tracer` as a middleware before you mount your nested applications.
|
|
1546
|
+
|
|
1547
|
+
#### Instrumentation options
|
|
1548
|
+
|
|
1549
|
+
`options` is an optional `Hash` that accepts the following parameters:
|
|
1515
1550
|
|
|
1516
1551
|
| Key | Description | Default |
|
|
1517
1552
|
| --- | ----------- | ------- |
|
|
@@ -1555,20 +1590,28 @@ To change the default behavior of the Datadog tracer, you can provide custom opt
|
|
|
1555
1590
|
# config/initializers/datadog-tracer.rb
|
|
1556
1591
|
|
|
1557
1592
|
Datadog.configure do |c|
|
|
1558
|
-
c.tracer
|
|
1593
|
+
c.tracer.enabled = true
|
|
1594
|
+
c.tracer.hostname = 'my-agent'
|
|
1595
|
+
c.tracer.port = 8126
|
|
1596
|
+
c.tracer.partial_flush.enabled = false
|
|
1597
|
+
c.tracer.sampler = Datadog::AllSampler.new
|
|
1598
|
+
|
|
1599
|
+
# OR for advanced use cases, you can specify your own tracer:
|
|
1600
|
+
c.tracer.instance = Datadog::Tracer.new
|
|
1601
|
+
|
|
1602
|
+
# To enable debug mode:
|
|
1603
|
+
c.diagnostics.debug = true
|
|
1559
1604
|
end
|
|
1560
1605
|
```
|
|
1561
1606
|
|
|
1562
1607
|
Available options are:
|
|
1563
1608
|
|
|
1564
|
-
- `enabled`: defines if the `tracer` is enabled or not. If set to `false`
|
|
1565
|
-
- `debug`: set to true to enable debug logging.
|
|
1609
|
+
- `enabled`: defines if the `tracer` is enabled or not. If set to `false` instrumentation will still run, but no spans are sent to the trace agent.
|
|
1566
1610
|
- `hostname`: set the hostname of the trace agent.
|
|
1611
|
+
- `instance`: set to a custom `Datadog::Tracer` instance. If provided, other trace settings are ignored (you must configure it manually.)
|
|
1612
|
+
- `partial_flush.enabled`: set to `true` to enable partial trace flushing (for long running traces.) Disabled by default. *Experimental.*
|
|
1567
1613
|
- `port`: set the port the trace agent is listening on.
|
|
1568
|
-
- `
|
|
1569
|
-
- `tags`: set global tags that should be applied to all spans. Defaults to an empty hash
|
|
1570
|
-
- `log`: defines a custom logger.
|
|
1571
|
-
- `partial_flush`: set to `true` to enable partial trace flushing (for long running traces.) Disabled by default. *Experimental.*
|
|
1614
|
+
- `sampler`: set to a custom `Datadog::Sampler` instance. If provided, the tracer will use this sampler to determine sampling behavior.
|
|
1572
1615
|
|
|
1573
1616
|
#### Custom logging
|
|
1574
1617
|
|
|
@@ -1576,15 +1619,16 @@ By default, all logs are processed by the default Ruby logger. When using Rails,
|
|
|
1576
1619
|
|
|
1577
1620
|
Datadog client log messages are marked with `[ddtrace]` so you should be able to isolate them from other messages.
|
|
1578
1621
|
|
|
1579
|
-
Additionally, it is possible to override the default logger and replace it by a custom one. This is done using the `log`
|
|
1622
|
+
Additionally, it is possible to override the default logger and replace it by a custom one. This is done using the `log` setting.
|
|
1580
1623
|
|
|
1581
1624
|
```ruby
|
|
1582
|
-
f = File.new("my-custom.log", "w+")
|
|
1625
|
+
f = File.new("my-custom.log", "w+") # Log messages should go there
|
|
1583
1626
|
Datadog.configure do |c|
|
|
1584
|
-
c.
|
|
1627
|
+
c.logger = Logger.new(f) # Overriding the default logger
|
|
1628
|
+
c.logger.level = ::Logger::INFO
|
|
1585
1629
|
end
|
|
1586
1630
|
|
|
1587
|
-
Datadog
|
|
1631
|
+
Datadog.logger.info { "this is typically called by tracing code" }
|
|
1588
1632
|
```
|
|
1589
1633
|
|
|
1590
1634
|
### Environment and tags
|
|
@@ -1594,9 +1638,11 @@ By default, the trace agent (not this library, but the program running in the ba
|
|
|
1594
1638
|
You can configure the application to automatically tag your traces and metrics, using the following environment variables:
|
|
1595
1639
|
|
|
1596
1640
|
- `DD_ENV`: Your application environment (e.g. `production`, `staging`, etc.)
|
|
1641
|
+
- `DD_SERVICE`: Your application's default service name (e.g. `billing-api`)
|
|
1597
1642
|
- `DD_VERSION`: Your application version (e.g. `2.5`, `202003181415`, `1.3-alpha`, etc.)
|
|
1598
1643
|
- `DD_TAGS`: Custom tags in value pairs separated by `,` (e.g. `layer:api,team:intake`)
|
|
1599
|
-
- If `DD_ENV` or `DD_VERSION
|
|
1644
|
+
- If `DD_ENV`, `DD_SERVICE` or `DD_VERSION` are set, it will override any respective `env`/`service`/`version` tag defined in `DD_TAGS`.
|
|
1645
|
+
- If `DD_ENV`, `DD_SERVICE` or `DD_VERSION` are NOT set, tags defined in `DD_TAGS` will be used to populate `env`/`service`/`version` respectively.
|
|
1600
1646
|
|
|
1601
1647
|
These values can also be overridden at the tracer level:
|
|
1602
1648
|
|
|
@@ -1609,9 +1655,9 @@ Datadog.configure do |c|
|
|
|
1609
1655
|
end
|
|
1610
1656
|
```
|
|
1611
1657
|
|
|
1612
|
-
This enables you to set this value on a per
|
|
1658
|
+
This enables you to set this value on a per application basis, so you can have for example several applications reporting for different environments on the same host.
|
|
1613
1659
|
|
|
1614
|
-
|
|
1660
|
+
Tags can also be set directly on individual spans, which will supersede any conflicting tags defined at the application level.
|
|
1615
1661
|
|
|
1616
1662
|
### Sampling
|
|
1617
1663
|
|
|
@@ -1622,8 +1668,9 @@ Ultimately, tags can be set per span, but `env` should typically be the same for
|
|
|
1622
1668
|
```ruby
|
|
1623
1669
|
# Sample rate is between 0 (nothing sampled) to 1 (everything sampled).
|
|
1624
1670
|
sampler = Datadog::RateSampler.new(0.5) # sample 50% of the traces
|
|
1671
|
+
|
|
1625
1672
|
Datadog.configure do |c|
|
|
1626
|
-
c.tracer
|
|
1673
|
+
c.tracer.sampler = sampler
|
|
1627
1674
|
end
|
|
1628
1675
|
```
|
|
1629
1676
|
|
|
@@ -1900,6 +1947,7 @@ Datadog.tracer.trace('correlation.example') do
|
|
|
1900
1947
|
correlation.trace_id # => 5963550561812073440
|
|
1901
1948
|
correlation.span_id # => 2232727802607726424
|
|
1902
1949
|
correlation.env # => 'production' (derived from DD_ENV)
|
|
1950
|
+
correlation.service # => 'billing-api' (derived from DD_SERVICE)
|
|
1903
1951
|
correlation.version # => '2.5.17' (derived from DD_VERSION)
|
|
1904
1952
|
end
|
|
1905
1953
|
|
|
@@ -1909,8 +1957,9 @@ correlation = Datadog.tracer.active_correlation
|
|
|
1909
1957
|
correlation = Datadog.tracer.active_correlation
|
|
1910
1958
|
correlation.trace_id # => 0
|
|
1911
1959
|
correlation.span_id # => 0
|
|
1912
|
-
correlation.
|
|
1913
|
-
correlation.
|
|
1960
|
+
correlation.env # => 'production' (derived from DD_ENV)
|
|
1961
|
+
correlation.service # => 'billing-api' (derived from DD_SERVICE)
|
|
1962
|
+
correlation.version # => '2.5.17' (derived from DD_VERSION)
|
|
1914
1963
|
```
|
|
1915
1964
|
|
|
1916
1965
|
#### For logging in Rails applications using Lograge (recommended)
|
|
@@ -1929,6 +1978,7 @@ config.lograge.custom_options = lambda do |event|
|
|
|
1929
1978
|
:trace_id => correlation.trace_id.to_s,
|
|
1930
1979
|
:span_id => correlation.span_id.to_s,
|
|
1931
1980
|
:env => correlation.env.to_s,
|
|
1981
|
+
:service => correlation.service.to_s,
|
|
1932
1982
|
:version => correlation.version.to_s
|
|
1933
1983
|
},
|
|
1934
1984
|
:ddsource => ["ruby"],
|
|
@@ -1950,27 +2000,29 @@ end
|
|
|
1950
2000
|
|
|
1951
2001
|
# Given:
|
|
1952
2002
|
# DD_ENV = 'production' (The name of the environment your application is running in.)
|
|
2003
|
+
# DD_SERVICE = 'billing-api' (Default service name of your application.)
|
|
1953
2004
|
# DD_VERSION = '2.5.17' (The version of your application.)
|
|
1954
2005
|
|
|
1955
2006
|
# Web requests will produce:
|
|
1956
|
-
# [dd.
|
|
1957
|
-
# [dd.
|
|
1958
|
-
# [dd.
|
|
1959
|
-
# [dd.
|
|
2007
|
+
# [dd.env=production dd.service=billing-api dd.version=2.5.17 dd.trace_id=7110975754844687674 dd.span_id=7518426836986654206] Started GET "/articles" for 172.22.0.1 at 2019-01-16 18:50:57 +0000
|
|
2008
|
+
# [dd.env=production dd.service=billing-api dd.version=2.5.17 dd.trace_id=7110975754844687674 dd.span_id=7518426836986654206] Processing by ArticlesController#index as */*
|
|
2009
|
+
# [dd.env=production dd.service=billing-api dd.version=2.5.17 dd.trace_id=7110975754844687674 dd.span_id=7518426836986654206] Article Load (0.5ms) SELECT "articles".* FROM "articles"
|
|
2010
|
+
# [dd.env=production dd.service=billing-api dd.version=2.5.17 dd.trace_id=7110975754844687674 dd.span_id=7518426836986654206] Completed 200 OK in 7ms (Views: 5.5ms | ActiveRecord: 0.5ms)
|
|
1960
2011
|
```
|
|
1961
2012
|
|
|
1962
2013
|
#### For logging in Ruby applications
|
|
1963
2014
|
|
|
1964
2015
|
To add correlation IDs to your logger, add a log formatter which retrieves the correlation IDs with `Datadog.tracer.active_correlation`, then add them to the message.
|
|
1965
2016
|
|
|
1966
|
-
To properly correlate with Datadog logging, be sure the following is present in the log message:
|
|
2017
|
+
To properly correlate with Datadog logging, be sure the following is present in the log message, in order as they appear:
|
|
1967
2018
|
|
|
2019
|
+
- `dd.env=<ENV>`: Where `<ENV>` is equal to `Datadog.tracer.active_correlation.env`. Omit if no environment is configured.
|
|
2020
|
+
- `dd.service=<SERVICE>`: Where `<SERVICE>` is equal to `Datadog.tracer.active_correlation.service`. Omit if no default service name is configured.
|
|
2021
|
+
- `dd.version=<VERSION>`: Where `<VERSION>` is equal to `Datadog.tracer.active_correlation.version`. Omit if no application version is configured.
|
|
1968
2022
|
- `dd.trace_id=<TRACE_ID>`: Where `<TRACE_ID>` is equal to `Datadog.tracer.active_correlation.trace_id` or `0` if no trace is active during logging.
|
|
1969
2023
|
- `dd.span_id=<SPAN_ID>`: Where `<SPAN_ID>` is equal to `Datadog.tracer.active_correlation.span_id` or `0` if no trace is active during logging.
|
|
1970
|
-
- `dd.env=<ENV>`: Where `<ENV>` is equal to `Datadog.tracer.active_correlation.env` or empty string (no quotes) if no environment name is configured.
|
|
1971
|
-
- `dd.version=<SPAN_ID>`: Where `<SPAN_ID>` is equal to `Datadog.tracer.active_correlation.version` or empty string (no quotes) if no application version is configured.
|
|
1972
2024
|
|
|
1973
|
-
By default, `Datadog::Correlation::Identifier#to_s` will return `dd.
|
|
2025
|
+
By default, `Datadog::Correlation::Identifier#to_s` will return `dd.env=<ENV> dd.service=<SERVICE> dd.version=<VERSION> dd.trace_id=<TRACE_ID> dd.span_id=<SPAN_ID>`.
|
|
1974
2026
|
|
|
1975
2027
|
If a trace is not active and the application environment & version is not configured, it will return `dd.trace_id=0 dd.span_id=0 dd.env= dd.version=`.
|
|
1976
2028
|
|
|
@@ -1981,6 +2033,7 @@ require 'ddtrace'
|
|
|
1981
2033
|
require 'logger'
|
|
1982
2034
|
|
|
1983
2035
|
ENV['DD_ENV'] = 'production'
|
|
2036
|
+
ENV['DD_SERVICE'] = 'billing-api'
|
|
1984
2037
|
ENV['DD_VERSION'] = '2.5.17'
|
|
1985
2038
|
|
|
1986
2039
|
logger = Logger.new(STDOUT)
|
|
@@ -1991,11 +2044,11 @@ end
|
|
|
1991
2044
|
|
|
1992
2045
|
# When no trace is active
|
|
1993
2046
|
logger.warn('This is an untraced operation.')
|
|
1994
|
-
# [2019-01-16 18:38:41 +0000][my_app][WARN][dd.
|
|
2047
|
+
# [2019-01-16 18:38:41 +0000][my_app][WARN][dd.env=production dd.service=billing-api dd.version=2.5.17 dd.trace_id=0 dd.span_id=0] This is an untraced operation.
|
|
1995
2048
|
|
|
1996
2049
|
# When a trace is active
|
|
1997
2050
|
Datadog.tracer.trace('my.operation') { logger.warn('This is a traced operation.') }
|
|
1998
|
-
# [2019-01-16 18:38:41 +0000][my_app][WARN][dd.
|
|
2051
|
+
# [2019-01-16 18:38:41 +0000][my_app][WARN][dd.env=production dd.service=billing-api dd.version=2.5.17 dd.trace_id=8545847825299552251 dd.span_id=3711755234730770098] This is a traced operation.
|
|
1999
2052
|
```
|
|
2000
2053
|
|
|
2001
2054
|
### Configuring the transport layer
|
|
@@ -2010,7 +2063,7 @@ The `Net` adapter submits traces using `Net::HTTP` over TCP. It is the default t
|
|
|
2010
2063
|
|
|
2011
2064
|
```ruby
|
|
2012
2065
|
Datadog.configure do |c|
|
|
2013
|
-
c.tracer
|
|
2066
|
+
c.tracer.transport_options = proc { |t|
|
|
2014
2067
|
# Hostname, port, and additional options. :timeout is in seconds.
|
|
2015
2068
|
t.adapter :net_http, '127.0.0.1', 8126, { timeout: 1 }
|
|
2016
2069
|
}
|
|
@@ -2025,7 +2078,7 @@ To use, first configure your trace agent to listen by Unix socket, then configur
|
|
|
2025
2078
|
|
|
2026
2079
|
```ruby
|
|
2027
2080
|
Datadog.configure do |c|
|
|
2028
|
-
c.tracer
|
|
2081
|
+
c.tracer.transport_options = proc { |t|
|
|
2029
2082
|
# Provide filepath to trace agent Unix socket
|
|
2030
2083
|
t.adapter :unix, '/tmp/ddagent/trace.sock'
|
|
2031
2084
|
}
|
|
@@ -2038,7 +2091,7 @@ The `Test` adapter is a no-op transport that can optionally buffer requests. For
|
|
|
2038
2091
|
|
|
2039
2092
|
```ruby
|
|
2040
2093
|
Datadog.configure do |c|
|
|
2041
|
-
c.tracer
|
|
2094
|
+
c.tracer.transport_options = proc { |t|
|
|
2042
2095
|
# Set transport to no-op mode. Does not retain traces.
|
|
2043
2096
|
t.adapter :test
|
|
2044
2097
|
|
|
@@ -2055,7 +2108,7 @@ Custom adapters can be configured with:
|
|
|
2055
2108
|
|
|
2056
2109
|
```ruby
|
|
2057
2110
|
Datadog.configure do |c|
|
|
2058
|
-
c.tracer
|
|
2111
|
+
c.tracer.transport_options = proc { |t|
|
|
2059
2112
|
# Initialize and pass an instance of the adapter
|
|
2060
2113
|
custom_adapter = CustomAdapter.new
|
|
2061
2114
|
t.adapter custom_adapter
|
|
@@ -2086,12 +2139,12 @@ require 'ddtrace'
|
|
|
2086
2139
|
Datadog.configure do |c|
|
|
2087
2140
|
# To enable runtime metrics collection, set `true`. Defaults to `false`
|
|
2088
2141
|
# You can also set DD_RUNTIME_METRICS_ENABLED=true to configure this.
|
|
2089
|
-
c.
|
|
2142
|
+
c.runtime_metrics.enabled = true
|
|
2090
2143
|
|
|
2091
2144
|
# Optionally, you can configure the Statsd instance used for sending runtime metrics.
|
|
2092
2145
|
# Statsd is automatically configured with default settings if `dogstatsd-ruby` is available.
|
|
2093
2146
|
# You can configure with host and port of Datadog agent; defaults to 'localhost:8125'.
|
|
2094
|
-
c.runtime_metrics
|
|
2147
|
+
c.runtime_metrics.statsd = Datadog::Statsd.new
|
|
2095
2148
|
end
|
|
2096
2149
|
```
|
|
2097
2150
|
|