ddtrace 0.24.0 → 0.25.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.circleci/config.yml +6 -6
- data/.circleci/images/primary/Dockerfile-1.9.3 +6 -2
- data/.circleci/images/primary/Dockerfile-2.0.0 +6 -2
- data/.circleci/images/primary/Dockerfile-2.1.10 +6 -2
- data/.circleci/images/primary/Dockerfile-2.2.10 +6 -2
- data/.circleci/images/primary/{Dockerfile-2.4.4 → Dockerfile-2.3.8} +5 -3
- data/.circleci/images/primary/{Dockerfile-2.3.7 → Dockerfile-2.4.6} +2 -2
- data/CHANGELOG.md +36 -0
- data/docker-compose.yml +6 -6
- data/docs/DevelopmentGuide.md +63 -0
- data/docs/GettingStarted.md +73 -3
- data/lib/ddtrace/configuration.rb +20 -1
- data/lib/ddtrace/contrib/http/circuit_breaker.rb +39 -11
- data/lib/ddtrace/contrib/http/instrumentation.rb +2 -11
- data/lib/ddtrace/ext/forced_tracing.rb +18 -2
- data/lib/ddtrace/ext/manual_tracing.rb +9 -0
- data/lib/ddtrace/ext/metrics.rb +0 -1
- data/lib/ddtrace/ext/runtime.rb +0 -1
- data/lib/ddtrace/forced_tracing.rb +3 -3
- data/lib/ddtrace/metrics.rb +0 -3
- data/lib/ddtrace/runtime/metrics.rb +0 -1
- data/lib/ddtrace/sync_writer.rb +1 -1
- data/lib/ddtrace/tracer.rb +78 -17
- data/lib/ddtrace/transport.rb +9 -0
- data/lib/ddtrace/transport/http.rb +85 -0
- data/lib/ddtrace/transport/http/adapters/net.rb +112 -0
- data/lib/ddtrace/transport/http/adapters/registry.rb +24 -0
- data/lib/ddtrace/transport/http/adapters/test.rb +77 -0
- data/lib/ddtrace/transport/http/adapters/unix_socket.rb +64 -0
- data/lib/ddtrace/transport/http/api.rb +46 -0
- data/lib/ddtrace/transport/http/api/endpoint.rb +27 -0
- data/lib/ddtrace/transport/http/api/fallbacks.rb +22 -0
- data/lib/ddtrace/transport/http/api/instance.rb +29 -0
- data/lib/ddtrace/transport/http/api/map.rb +14 -0
- data/lib/ddtrace/transport/http/api/spec.rb +15 -0
- data/lib/ddtrace/transport/http/builder.rb +165 -0
- data/lib/ddtrace/transport/http/client.rb +108 -0
- data/lib/ddtrace/transport/http/env.rb +48 -0
- data/lib/ddtrace/transport/http/response.rb +22 -0
- data/lib/ddtrace/transport/http/traces.rb +140 -0
- data/lib/ddtrace/transport/parcel.rb +13 -0
- data/lib/ddtrace/transport/request.rb +13 -0
- data/lib/ddtrace/transport/response.rb +49 -0
- data/lib/ddtrace/transport/statistics.rb +44 -0
- data/lib/ddtrace/transport/traces.rb +33 -0
- data/lib/ddtrace/version.rb +1 -1
- data/lib/ddtrace/workers.rb +6 -2
- data/lib/ddtrace/writer.rb +48 -21
- metadata +26 -4
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: cc7abea1fd11b0e43875d0b3e657110d9784e735
|
4
|
+
data.tar.gz: dcfbeb9c0ad9d4a1d32e8bca7ab24290e65a40aa
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: a3d4c48ba5015646eecc48254b76a71dad02713c4ceaf01a5b97dc2538784df65ee55b10e5794ed9987390145e83a00a8cb8214b9e445cfd80dbc750c3fad83d
|
7
|
+
data.tar.gz: e22ee413bba3877f5296ffcaa6ca62684c65c907dbe03e1f62d63c6c98cb187ae19ec9217d5e9b1c6a35dcd9f5a03e37c6964728d9489e8ec6ed860330572b33
|
data/.circleci/config.yml
CHANGED
@@ -5,27 +5,27 @@ job_defaults: &job_defaults
|
|
5
5
|
|
6
6
|
ruby_containers: &ruby_containers
|
7
7
|
- &container-1_9
|
8
|
-
image:
|
8
|
+
image: palazzem/docker-library:ddtrace_rb_1_9_3
|
9
9
|
environment:
|
10
10
|
- BUNDLE_GEMFILE=/app/Gemfile
|
11
11
|
- &container-2_0
|
12
|
-
image:
|
12
|
+
image: palazzem/docker-library:ddtrace_rb_2_0_0
|
13
13
|
environment:
|
14
14
|
- BUNDLE_GEMFILE=/app/Gemfile
|
15
15
|
- &container-2_1
|
16
|
-
image:
|
16
|
+
image: palazzem/docker-library:ddtrace_rb_2_1_10
|
17
17
|
environment:
|
18
18
|
- BUNDLE_GEMFILE=/app/Gemfile
|
19
19
|
- &container-2_2
|
20
|
-
image:
|
20
|
+
image: palazzem/docker-library:ddtrace_rb_2_2_10
|
21
21
|
environment:
|
22
22
|
- BUNDLE_GEMFILE=/app/Gemfile
|
23
23
|
- &container-2_3
|
24
|
-
image:
|
24
|
+
image: palazzem/docker-library:ddtrace_rb_2_3_8
|
25
25
|
environment:
|
26
26
|
- BUNDLE_GEMFILE=/app/Gemfile
|
27
27
|
- &container-2_4
|
28
|
-
image:
|
28
|
+
image: palazzem/docker-library:ddtrace_rb_2_4_6
|
29
29
|
environment:
|
30
30
|
- BUNDLE_GEMFILE=/app/Gemfile
|
31
31
|
|
@@ -1,6 +1,10 @@
|
|
1
1
|
# Last version: https://github.com/docker-library/ruby/blob/90c4e3be58d565007c518d311d4bd05086a1638c/1.9/Dockerfile
|
2
2
|
FROM ruby:1.9.3
|
3
3
|
|
4
|
+
# Add Jessie repos
|
5
|
+
# Fixes https://superuser.com/questions/1423486/issue-with-fetching-http-deb-debian-org-debian-dists-jessie-updates-inrelease
|
6
|
+
RUN printf "deb http://archive.debian.org/debian/ jessie main\ndeb-src http://archive.debian.org/debian/ jessie main\ndeb http://security.debian.org jessie/updates main\ndeb-src http://security.debian.org jessie/updates main" > /etc/apt/sources.list
|
7
|
+
|
4
8
|
# Make apt non-interactive
|
5
9
|
RUN echo 'APT::Get::Assume-Yes "true";' > /etc/apt/apt.conf.d/90circleci \
|
6
10
|
&& echo 'DPkg::Options "--force-confnew";' >> /etc/apt/apt.conf.d/90circleci
|
@@ -59,8 +63,8 @@ RUN DOCKERIZE_URL="https://circle-downloads.s3.amazonaws.com/circleci-images/cac
|
|
59
63
|
&& dockerize --version
|
60
64
|
|
61
65
|
# Install RubyGems
|
62
|
-
RUN gem update --system
|
63
|
-
RUN gem install bundler
|
66
|
+
RUN gem update --system 2.7.9
|
67
|
+
RUN gem install bundler -v '1.17.3'
|
64
68
|
ENV BUNDLE_SILENCE_ROOT_WARNING 1
|
65
69
|
|
66
70
|
RUN mkdir /app
|
@@ -1,6 +1,10 @@
|
|
1
1
|
# Last version: https://github.com/docker-library/ruby/blob/c387c6c3a2505060514e31c247cb37d22c944e55/2.0/Dockerfile
|
2
2
|
FROM ruby:2.0.0
|
3
3
|
|
4
|
+
# Add Jessie repos
|
5
|
+
# Fixes https://superuser.com/questions/1423486/issue-with-fetching-http-deb-debian-org-debian-dists-jessie-updates-inrelease
|
6
|
+
RUN printf "deb http://archive.debian.org/debian/ jessie main\ndeb-src http://archive.debian.org/debian/ jessie main\ndeb http://security.debian.org jessie/updates main\ndeb-src http://security.debian.org jessie/updates main" > /etc/apt/sources.list
|
7
|
+
|
4
8
|
# Make apt non-interactive
|
5
9
|
RUN echo 'APT::Get::Assume-Yes "true";' > /etc/apt/apt.conf.d/90circleci \
|
6
10
|
&& echo 'DPkg::Options "--force-confnew";' >> /etc/apt/apt.conf.d/90circleci
|
@@ -59,8 +63,8 @@ RUN DOCKERIZE_URL="https://circle-downloads.s3.amazonaws.com/circleci-images/cac
|
|
59
63
|
&& dockerize --version
|
60
64
|
|
61
65
|
# Install RubyGems
|
62
|
-
RUN gem update --system
|
63
|
-
RUN gem install bundler
|
66
|
+
RUN gem update --system 2.7.9
|
67
|
+
RUN gem install bundler -v '1.17.3'
|
64
68
|
ENV BUNDLE_SILENCE_ROOT_WARNING 1
|
65
69
|
|
66
70
|
RUN mkdir /app
|
@@ -1,6 +1,10 @@
|
|
1
1
|
# Last version: https://github.com/docker-library/ruby/blob/99def14400fcd612782367830836dfcbc10c8c50/2.1/Dockerfile
|
2
2
|
FROM ruby:2.1.10
|
3
3
|
|
4
|
+
# Add Jessie repos
|
5
|
+
# Fixes https://superuser.com/questions/1423486/issue-with-fetching-http-deb-debian-org-debian-dists-jessie-updates-inrelease
|
6
|
+
RUN printf "deb http://archive.debian.org/debian/ jessie main\ndeb-src http://archive.debian.org/debian/ jessie main\ndeb http://security.debian.org jessie/updates main\ndeb-src http://security.debian.org jessie/updates main" > /etc/apt/sources.list
|
7
|
+
|
4
8
|
# Make apt non-interactive
|
5
9
|
RUN echo 'APT::Get::Assume-Yes "true";' > /etc/apt/apt.conf.d/90circleci \
|
6
10
|
&& echo 'DPkg::Options "--force-confnew";' >> /etc/apt/apt.conf.d/90circleci
|
@@ -59,8 +63,8 @@ RUN DOCKERIZE_URL="https://circle-downloads.s3.amazonaws.com/circleci-images/cac
|
|
59
63
|
&& dockerize --version
|
60
64
|
|
61
65
|
# Install RubyGems
|
62
|
-
RUN gem update --system
|
63
|
-
RUN gem install bundler
|
66
|
+
RUN gem update --system 2.7.9
|
67
|
+
RUN gem install bundler -v '1.17.3'
|
64
68
|
ENV BUNDLE_SILENCE_ROOT_WARNING 1
|
65
69
|
|
66
70
|
RUN mkdir /app
|
@@ -1,6 +1,10 @@
|
|
1
1
|
# Last version: https://github.com/docker-library/ruby/blob/395cce4eba52917eb9a40c72d50703a1ce9e1acd/2.2/jessie/Dockerfile
|
2
2
|
FROM ruby:2.2.10
|
3
3
|
|
4
|
+
# Add Jessie repos
|
5
|
+
# Fixes https://superuser.com/questions/1423486/issue-with-fetching-http-deb-debian-org-debian-dists-jessie-updates-inrelease
|
6
|
+
RUN printf "deb http://archive.debian.org/debian/ jessie main\ndeb-src http://archive.debian.org/debian/ jessie main\ndeb http://security.debian.org jessie/updates main\ndeb-src http://security.debian.org jessie/updates main" > /etc/apt/sources.list
|
7
|
+
|
4
8
|
# Make apt non-interactive
|
5
9
|
RUN echo 'APT::Get::Assume-Yes "true";' > /etc/apt/apt.conf.d/90circleci \
|
6
10
|
&& echo 'DPkg::Options "--force-confnew";' >> /etc/apt/apt.conf.d/90circleci
|
@@ -59,8 +63,8 @@ RUN DOCKERIZE_URL="https://circle-downloads.s3.amazonaws.com/circleci-images/cac
|
|
59
63
|
&& dockerize --version
|
60
64
|
|
61
65
|
# Install RubyGems
|
62
|
-
RUN gem update --system
|
63
|
-
RUN gem install bundler
|
66
|
+
RUN gem update --system 2.7.9
|
67
|
+
RUN gem install bundler -v '1.17.3'
|
64
68
|
ENV BUNDLE_SILENCE_ROOT_WARNING 1
|
65
69
|
|
66
70
|
RUN mkdir /app
|
@@ -1,5 +1,5 @@
|
|
1
|
-
# Current version: https://github.com/docker-library/ruby/blob/
|
2
|
-
FROM ruby:2.
|
1
|
+
# Current version: https://github.com/docker-library/ruby/blob/31f66490fdb837ddcc5896e3275f2188f2b7b6dd/2.3/stretch/Dockerfile
|
2
|
+
FROM ruby:2.3.8
|
3
3
|
|
4
4
|
# Make apt non-interactive
|
5
5
|
RUN echo 'APT::Get::Assume-Yes "true";' > /etc/apt/apt.conf.d/90circleci \
|
@@ -64,7 +64,9 @@ RUN mkdir -p "$GEM_HOME" && chmod -R 777 "$GEM_HOME"
|
|
64
64
|
|
65
65
|
# Install RubyGems
|
66
66
|
RUN gem update --system
|
67
|
-
|
67
|
+
# Ruby 2.3 can support Bundler 2+
|
68
|
+
# But hold back to < 2 for now, because some dependencies require it.
|
69
|
+
RUN gem install bundler -v '1.17.3'
|
68
70
|
ENV BUNDLE_SILENCE_ROOT_WARNING 1
|
69
71
|
|
70
72
|
RUN mkdir /app
|
@@ -1,5 +1,5 @@
|
|
1
|
-
# Current version: https://github.com/docker-library/ruby/blob/
|
2
|
-
FROM ruby:2.
|
1
|
+
# Current version: https://github.com/docker-library/ruby/blob/802421922ef50cfa05c89a3c619992acf4329986/2.4/jessie/Dockerfile
|
2
|
+
FROM ruby:2.4.6
|
3
3
|
|
4
4
|
# Make apt non-interactive
|
5
5
|
RUN echo 'APT::Get::Assume-Yes "true";' > /etc/apt/apt.conf.d/90circleci \
|
data/CHANGELOG.md
CHANGED
@@ -4,6 +4,42 @@
|
|
4
4
|
|
5
5
|
## [Unreleased (beta)]
|
6
6
|
|
7
|
+
## [0.25.0] - 2019-06-27
|
8
|
+
|
9
|
+
Release notes: https://github.com/DataDog/dd-trace-rb/releases/tag/v0.25.0
|
10
|
+
|
11
|
+
Git diff: https://github.com/DataDog/dd-trace-rb/compare/v0.24.0...v0.25.0
|
12
|
+
|
13
|
+
Support for Ruby < 2.0 is *deprecated*. Plan for timeline is as follows:
|
14
|
+
|
15
|
+
- 0.25.0: Support for Ruby < 2.0 is deprecated; retains full feature support.
|
16
|
+
- 0.26.0: Last version to support Ruby < 2.0; any new features will not support 1.9.
|
17
|
+
- 0.27.0: Support for Ruby < 2.0 is removed.
|
18
|
+
|
19
|
+
Version 0.26.x will receive only critical bugfixes for 1 year following the release of 0.26.0.
|
20
|
+
|
21
|
+
### Added
|
22
|
+
|
23
|
+
- Unix socket support for transport layer (#770)
|
24
|
+
|
25
|
+
### Changed
|
26
|
+
|
27
|
+
- Renamed 'ForcedTracing' to 'ManualTracing' (#765)
|
28
|
+
|
29
|
+
### Fixed
|
30
|
+
|
31
|
+
- HTTP headers for distributed tracing sometimes appearing in duplicate (#768)
|
32
|
+
|
33
|
+
### Refactored
|
34
|
+
|
35
|
+
- Transport layer (#628)
|
36
|
+
|
37
|
+
### Deprecated
|
38
|
+
|
39
|
+
- Ruby < 2.0 support (#771)
|
40
|
+
- Use of `Datadog::HTTPTransport` (#628)
|
41
|
+
- Use of `Datadog::Ext::ForcedTracing` (#765)
|
42
|
+
|
7
43
|
## [0.24.0] - 2019-05-21
|
8
44
|
|
9
45
|
Release notes: https://github.com/DataDog/dd-trace-rb/releases/tag/v0.24.0
|
data/docker-compose.yml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
version: '3.2'
|
2
2
|
services:
|
3
3
|
tracer-1.9:
|
4
|
-
image:
|
4
|
+
image: palazzem/docker-library:ddtrace_rb_1_9_3
|
5
5
|
command: /bin/bash
|
6
6
|
depends_on:
|
7
7
|
- ddagent
|
@@ -29,7 +29,7 @@ services:
|
|
29
29
|
- bundle-1.9:/usr/local/bundle
|
30
30
|
- gemfiles-1.9:/app/gemfiles
|
31
31
|
tracer-2.0:
|
32
|
-
image:
|
32
|
+
image: palazzem/docker-library:ddtrace_rb_2_0_0
|
33
33
|
command: /bin/bash
|
34
34
|
depends_on:
|
35
35
|
- ddagent
|
@@ -57,7 +57,7 @@ services:
|
|
57
57
|
- bundle-2.0:/usr/local/bundle
|
58
58
|
- gemfiles-2.0:/app/gemfiles
|
59
59
|
tracer-2.1:
|
60
|
-
image:
|
60
|
+
image: palazzem/docker-library:ddtrace_rb_2_1_10
|
61
61
|
command: /bin/bash
|
62
62
|
depends_on:
|
63
63
|
- ddagent
|
@@ -85,7 +85,7 @@ services:
|
|
85
85
|
- bundle-2.1:/usr/local/bundle
|
86
86
|
- gemfiles-2.1:/app/gemfiles
|
87
87
|
tracer-2.2:
|
88
|
-
image:
|
88
|
+
image: palazzem/docker-library:ddtrace_rb_2_2_10
|
89
89
|
command: /bin/bash
|
90
90
|
depends_on:
|
91
91
|
- ddagent
|
@@ -113,7 +113,7 @@ services:
|
|
113
113
|
- bundle-2.2:/usr/local/bundle
|
114
114
|
- gemfiles-2.2:/app/gemfiles
|
115
115
|
tracer-2.3:
|
116
|
-
image:
|
116
|
+
image: palazzem/docker-library:ddtrace_rb_2_3_8
|
117
117
|
command: /bin/bash
|
118
118
|
depends_on:
|
119
119
|
- ddagent
|
@@ -141,7 +141,7 @@ services:
|
|
141
141
|
- bundle-2.3:/usr/local/bundle
|
142
142
|
- gemfiles-2.3:/app/gemfiles
|
143
143
|
tracer-2.4:
|
144
|
-
image:
|
144
|
+
image: palazzem/docker-library:ddtrace_rb_2_4_6
|
145
145
|
command: /bin/bash
|
146
146
|
depends_on:
|
147
147
|
- ddagent
|
data/docs/DevelopmentGuide.md
CHANGED
@@ -11,6 +11,7 @@ This guide covers some of the common how-tos and technical reference material fo
|
|
11
11
|
- [Checking code quality](#checking-code-quality)
|
12
12
|
- [Appendix](#appendix)
|
13
13
|
- [Writing new integrations](#writing-new-integrations)
|
14
|
+
- [Custom transport adapters](#custom-transport-adapters)
|
14
15
|
|
15
16
|
## Setting up
|
16
17
|
|
@@ -130,3 +131,65 @@ Then [open a pull request](https://github.com/DataDog/dd-trace-rb/CONTRIBUTING.m
|
|
130
131
|
- Links to the repository/website of the library being integrated
|
131
132
|
- Screenshots showing a sample trace
|
132
133
|
- Any additional code snippets, sample apps, benchmarks, or other resources that demonstrate its implementation are a huge plus!
|
134
|
+
|
135
|
+
### Custom transport adapters
|
136
|
+
|
137
|
+
The tracer can be configured with transports that customize how data is sent and where it is sent to. This is done through the use of adapters: classes that receive generic requests, process them, and return appropriate responses.
|
138
|
+
|
139
|
+
#### Developing HTTP transport adapters
|
140
|
+
|
141
|
+
To create a custom HTTP adapter, define a class that responds to `call(env)` which returns a kind of `Datadog::Transport::Response`:
|
142
|
+
|
143
|
+
```ruby
|
144
|
+
require 'ddtrace/transport/response'
|
145
|
+
|
146
|
+
class CustomAdapter
|
147
|
+
# Sends HTTP request
|
148
|
+
# env: Datadog::Transport::HTTP::Env
|
149
|
+
def call(env)
|
150
|
+
# Add custom code here to send data.
|
151
|
+
# Then return a Response object.
|
152
|
+
Response.new
|
153
|
+
end
|
154
|
+
|
155
|
+
class Response
|
156
|
+
include Datadog::Transport::Response
|
157
|
+
|
158
|
+
# Implement the following methods as appropriate
|
159
|
+
# for your adapter.
|
160
|
+
|
161
|
+
# Return a String
|
162
|
+
def payload; end
|
163
|
+
|
164
|
+
# Return true/false
|
165
|
+
# Return nil if it does not apply
|
166
|
+
def ok?; end
|
167
|
+
def unsupported?; end
|
168
|
+
def not_found?; end
|
169
|
+
def client_error?; end
|
170
|
+
def server_error?; end
|
171
|
+
def internal_error?; end
|
172
|
+
end
|
173
|
+
end
|
174
|
+
```
|
175
|
+
|
176
|
+
Optionally, you can register the adapter as a well-known type:
|
177
|
+
|
178
|
+
```ruby
|
179
|
+
Datadog::Transport::HTTP::Builder::REGISTRY.set(CustomAdapter, :custom)
|
180
|
+
```
|
181
|
+
|
182
|
+
Then pass an adapter instance to the tracer configuration:
|
183
|
+
|
184
|
+
```ruby
|
185
|
+
Datadog.configure do |c|
|
186
|
+
c.tracer transport_options: proc { |t|
|
187
|
+
# By name
|
188
|
+
t.adapter :custom
|
189
|
+
|
190
|
+
# By instance
|
191
|
+
custom_adapter = CustomAdapter.new
|
192
|
+
t.adapter custom_adapter
|
193
|
+
}
|
194
|
+
end
|
195
|
+
```
|
data/docs/GettingStarted.md
CHANGED
@@ -67,6 +67,7 @@ For contributing, checkout the [contribution guidelines][contribution docs] and
|
|
67
67
|
- [Filtering](#filtering)
|
68
68
|
- [Processing](#processing)
|
69
69
|
- [Trace correlation](#trace-correlation)
|
70
|
+
- [Configuring the transport layer](#configuring-the-transport-layer)
|
70
71
|
- [Metrics](#metrics)
|
71
72
|
- [For application runtime](#for-application-runtime)
|
72
73
|
- [OpenTracing](#opentracing)
|
@@ -77,8 +78,8 @@ For contributing, checkout the [contribution guidelines][contribution docs] and
|
|
77
78
|
|
78
79
|
| Type | Documentation | Version | Support type |
|
79
80
|
| ----- | -------------------------- | ----- | ------------ |
|
80
|
-
| MRI | https://www.ruby-lang.org/ | 1.9.1 |
|
81
|
-
| | | 1.9.3 |
|
81
|
+
| MRI | https://www.ruby-lang.org/ | 1.9.1 | Deprecated |
|
82
|
+
| | | 1.9.3 | Deprecated |
|
82
83
|
| | | 2.0 | Full |
|
83
84
|
| | | 2.1 | Full |
|
84
85
|
| | | 2.2 | Full |
|
@@ -104,6 +105,8 @@ For contributing, checkout the [contribution guidelines][contribution docs] and
|
|
104
105
|
|
105
106
|
*Experimental* indicates most features should be available, but unverified.
|
106
107
|
|
108
|
+
*Deprecated* indicates support will be removed in a future release.
|
109
|
+
|
107
110
|
## Installation
|
108
111
|
|
109
112
|
The following steps will help you quickly start tracing your Ruby application.
|
@@ -1402,6 +1405,9 @@ When not using [distributed tracing](#distributed-tracing), you may change the p
|
|
1402
1405
|
If you change the priority, we recommend you do it as soon as possible, when the root span has just been created.
|
1403
1406
|
|
1404
1407
|
```ruby
|
1408
|
+
# First, grab the active span
|
1409
|
+
span = Datadog.tracer.active_span
|
1410
|
+
|
1405
1411
|
# Indicate to reject the trace
|
1406
1412
|
span.context.sampling_priority = Datadog::Ext::Priority::USER_REJECT
|
1407
1413
|
|
@@ -1731,6 +1737,71 @@ Datadog.tracer.trace('my.operation') { logger.warn('This is a traced operation.'
|
|
1731
1737
|
# [2019-01-16 18:38:41 +0000][my_app][WARN][dd.trace_id=8545847825299552251 dd.span_id=3711755234730770098] This is a traced operation.
|
1732
1738
|
```
|
1733
1739
|
|
1740
|
+
### Configuring the transport layer
|
1741
|
+
|
1742
|
+
By default, the tracer submits trace data using `Net::HTTP` to `127.0.0.1:8126`, the default location for the Datadog trace agent process. However, the tracer can be configured to send its trace data to alternative destinations, or by alternative protocols.
|
1743
|
+
|
1744
|
+
Some basic settings, such as hostname and port, can be configured using [tracer settings](#tracer-settings).
|
1745
|
+
|
1746
|
+
#### Using the Net::HTTP adapter
|
1747
|
+
|
1748
|
+
The `Net` adapter submits traces using `Net::HTTP` over TCP. It is the default transport adapter.
|
1749
|
+
|
1750
|
+
```ruby
|
1751
|
+
Datadog.configure do |c|
|
1752
|
+
c.tracer transport_options: proc do |t|
|
1753
|
+
# Hostname, port, and additional options. :timeout is in seconds.
|
1754
|
+
t.adapter :net_http, '127.0.0.1', 8126, { timeout: 1 }
|
1755
|
+
}
|
1756
|
+
end
|
1757
|
+
```
|
1758
|
+
|
1759
|
+
#### Using the Unix socket adapter
|
1760
|
+
|
1761
|
+
The `UnixSocket` adapter submits traces using `Net::HTTP` over Unix socket.
|
1762
|
+
|
1763
|
+
To use, first configure your trace agent to listen by Unix socket, then configure the tracer with:
|
1764
|
+
|
1765
|
+
```ruby
|
1766
|
+
Datadog.configure do |c|
|
1767
|
+
c.tracer transport_options: proc { |t|
|
1768
|
+
# Provide filepath to trace agent Unix socket
|
1769
|
+
t.adapter :unix, '/tmp/ddagent/trace.sock'
|
1770
|
+
}
|
1771
|
+
end
|
1772
|
+
```
|
1773
|
+
|
1774
|
+
#### Using the transport test adapter
|
1775
|
+
|
1776
|
+
The `Test` adapter is a no-op transport that can optionally buffer requests. For use in test suites or other non-production environments.
|
1777
|
+
|
1778
|
+
```ruby
|
1779
|
+
Datadog.configure do |c|
|
1780
|
+
c.tracer transport_options: proc { |t|
|
1781
|
+
# Set transport to no-op mode. Does not retain traces.
|
1782
|
+
t.adapter :test
|
1783
|
+
|
1784
|
+
# Alternatively, you can provide a buffer to examine trace output.
|
1785
|
+
# The buffer must respond to '<<'.
|
1786
|
+
t.adapter :test, []
|
1787
|
+
}
|
1788
|
+
end
|
1789
|
+
```
|
1790
|
+
|
1791
|
+
#### Using a custom transport adapter
|
1792
|
+
|
1793
|
+
Custom adapters can be configured with:
|
1794
|
+
|
1795
|
+
```ruby
|
1796
|
+
Datadog.configure do |c|
|
1797
|
+
c.tracer transport_options: proc { |t|
|
1798
|
+
# Initialize and pass an instance of the adapter
|
1799
|
+
custom_adapter = CustomAdapter.new
|
1800
|
+
t.adapter custom_adapter
|
1801
|
+
}
|
1802
|
+
end
|
1803
|
+
```
|
1804
|
+
|
1734
1805
|
### Metrics
|
1735
1806
|
|
1736
1807
|
The tracer and its integrations can produce some additional metrics that can provide useful insight into the performance of your application. These metrics are collected with `dogstatsd-ruby`, and can be sent to the same Datadog agent to which you send your traces.
|
@@ -1778,7 +1849,6 @@ In addition, all metrics will include the following tags:
|
|
1778
1849
|
| Name | Description |
|
1779
1850
|
| ------------ | ------------------------------------------------------- |
|
1780
1851
|
| `language` | Programming language traced. (e.g. `ruby`) |
|
1781
|
-
| `runtime-id` | Unique identifier of runtime environment (i.e. process) |
|
1782
1852
|
| `service` | List of services this metric is associated with. |
|
1783
1853
|
|
1784
1854
|
### OpenTracing
|