ddtrace 0.4.0 → 0.4.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.yardopts +1 -0
- data/README.md +5 -1
- data/Rakefile +35 -9
- data/circle.yml +10 -24
- data/ddtrace.gemspec +1 -0
- data/docs/{GettingStarted → index.rdoc} +80 -103
- data/gemfiles/contrib.gemfile +2 -0
- data/lib/ddtrace/contrib/redis/patcher.rb +0 -2
- data/lib/ddtrace/ext/redis.rb +0 -5
- data/lib/ddtrace/tracer.rb +2 -2
- data/lib/ddtrace/version.rb +1 -1
- metadata +18 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 72729f2159c8955311ce44e2f616f76dad528f3e
|
4
|
+
data.tar.gz: b29b89057f37fdc35e2e3c94155a4929997fb437
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 27b419978a59a4e55d637f0a9d03a288c9e0d7869bf2c02a6265ba75bc3579ea051fa62ff6c1d48b0f69420b99e9b4387c51833849361a505c99b71d008b8f01
|
7
|
+
data.tar.gz: 679a3d8bcc5a4f46e59565da6f5f61c23501a4905c7adaae522b507059ea2c1b7ec9601e69772f4ea3e93db196185df04a635393b2eb1fab465bcc542a748afd
|
data/.yardopts
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
--readme docs/index.rdoc
|
data/README.md
CHANGED
@@ -12,13 +12,17 @@ You can find the latest documentation in the Datadog's [private repository][docs
|
|
12
12
|
|
13
13
|
### Install
|
14
14
|
|
15
|
+
Install the Ruby client with the ``gem`` command:
|
16
|
+
|
17
|
+
gem install ddtrace
|
18
|
+
|
15
19
|
If you're using ``Bundler``, just update your ``Gemfile`` as follows:
|
16
20
|
|
17
21
|
```ruby
|
18
22
|
source 'https://rubygems.org'
|
19
23
|
|
20
24
|
# tracing gem
|
21
|
-
gem 'ddtrace'
|
25
|
+
gem 'ddtrace'
|
22
26
|
```
|
23
27
|
|
24
28
|
### Quickstart (manual instrumentation)
|
data/Rakefile
CHANGED
@@ -1,8 +1,9 @@
|
|
1
1
|
require 'bundler/gem_tasks'
|
2
|
+
require 'ddtrace/version'
|
2
3
|
require 'rubocop/rake_task'
|
3
4
|
require 'rake/testtask'
|
4
|
-
require 'rdoc/task'
|
5
5
|
require 'appraisal'
|
6
|
+
require 'yard'
|
6
7
|
|
7
8
|
namespace :test do
|
8
9
|
task all: [:main, :rails, :railsredis, :elasticsearch, :http, :redis, :sinatra, :monkey]
|
@@ -51,12 +52,8 @@ RuboCop::RakeTask.new(:rubocop) do |t|
|
|
51
52
|
t.patterns = ['lib/**/*.rb', 'test/**/*.rb', 'Gemfile', 'Rakefile']
|
52
53
|
end
|
53
54
|
|
54
|
-
|
55
|
-
|
56
|
-
doc.title = 'Datadog Ruby Tracer'
|
57
|
-
# TODO[manu]: include all lib/ folder, but only when all classes' docs are ready
|
58
|
-
doc.rdoc_files = FileList.new(%w(lib/ddtrace/tracer.rb lib/ddtrace/span.rb docs/**/*))
|
59
|
-
doc.rdoc_dir = 'html'
|
55
|
+
YARD::Rake::YardocTask.new(:docs) do |t|
|
56
|
+
t.options += ['--title', "ddtrace #{Datadog::VERSION::STRING} documentation"]
|
60
57
|
end
|
61
58
|
|
62
59
|
# Deploy tasks
|
@@ -98,9 +95,38 @@ task :'release:gem' do
|
|
98
95
|
end
|
99
96
|
|
100
97
|
desc 'release the docs website'
|
101
|
-
task :'release:docs' => :
|
98
|
+
task :'release:docs' => :docs do
|
102
99
|
raise 'Missing environment variable S3_DIR' if !S3_DIR || S3_DIR.empty?
|
103
|
-
sh "aws s3 cp --recursive
|
100
|
+
sh "aws s3 cp --recursive doc/ s3://#{S3_BUCKET}/#{S3_DIR}/docs/"
|
101
|
+
end
|
102
|
+
|
103
|
+
desc 'CI dependent task; it runs all parallel tests'
|
104
|
+
task :ci do
|
105
|
+
# CircleCI uses this environment to store the node index (starting from 0)
|
106
|
+
# check: https://circleci.com/docs/parallel-manual-setup/#env-splitting
|
107
|
+
case ENV['CIRCLE_NODE_INDEX'].to_i
|
108
|
+
when 0
|
109
|
+
sh 'rvm $MRI_VERSIONS --verbose do rake test:main'
|
110
|
+
sh 'rvm $LAST_STABLE --verbose do rake benchmark'
|
111
|
+
when 1
|
112
|
+
sh 'rvm $MRI_VERSIONS --verbose do appraisal contrib rake test:monkey'
|
113
|
+
sh 'rvm $MRI_VERSIONS --verbose do appraisal contrib rake test:elasticsearch'
|
114
|
+
sh 'rvm $MRI_VERSIONS --verbose do appraisal contrib rake test:http'
|
115
|
+
sh 'rvm $MRI_VERSIONS --verbose do appraisal contrib rake test:redis'
|
116
|
+
sh 'rvm $MRI_VERSIONS --verbose do appraisal contrib rake test:sinatra'
|
117
|
+
when 2
|
118
|
+
sh 'rvm $RAILS_VERSIONS --verbose do appraisal rails3-postgres rake test:rails'
|
119
|
+
sh 'rvm $RAILS_VERSIONS --verbose do appraisal rails3-mysql2 rake test:rails'
|
120
|
+
sh 'rvm $RAILS_VERSIONS --verbose do appraisal rails4-postgres rake test:rails'
|
121
|
+
sh 'rvm $RAILS_VERSIONS --verbose do appraisal rails4-mysql2 rake test:rails'
|
122
|
+
sh 'rvm $RAILS5_VERSIONS --verbose do appraisal rails5-postgres rake test:rails'
|
123
|
+
sh 'rvm $RAILS5_VERSIONS --verbose do appraisal rails5-mysql2 rake test:rails'
|
124
|
+
sh 'rvm $RAILS_VERSIONS --verbose do appraisal rails3-postgres-redis rake test:railsredis'
|
125
|
+
sh 'rvm $RAILS_VERSIONS --verbose do appraisal rails4-postgres-redis rake test:railsredis'
|
126
|
+
sh 'rvm $RAILS5_VERSIONS --verbose do appraisal rails5-postgres-redis rake test:railsredis'
|
127
|
+
else
|
128
|
+
puts 'Too many workers than parallel tasks'
|
129
|
+
end
|
104
130
|
end
|
105
131
|
|
106
132
|
task default: :test
|
data/circle.yml
CHANGED
@@ -2,6 +2,7 @@ machine:
|
|
2
2
|
services:
|
3
3
|
- docker
|
4
4
|
environment:
|
5
|
+
# FIXME: Disabled $JRUBY_VERSIONS tests because of a Java incompatibility
|
5
6
|
LAST_STABLE: 2.4.0
|
6
7
|
EARLY_STABLE: 2.1.10
|
7
8
|
MRI_VERSIONS: 2.4.0,2.3.3,2.2.6,2.1.10
|
@@ -19,16 +20,16 @@ dependencies:
|
|
19
20
|
# only docker-engine==1.9
|
20
21
|
- pip install docker-compose==1.7.1
|
21
22
|
- docker-compose up -d | cat
|
22
|
-
#
|
23
|
+
# installing dev dependencies
|
24
|
+
- gem update --system
|
23
25
|
- gem install builder
|
26
|
+
- gem update bundler
|
24
27
|
- bundle install
|
28
|
+
# configure Ruby interpreters
|
25
29
|
- rvm get head
|
26
30
|
- rvm install $MRI_VERSIONS
|
27
|
-
#
|
28
|
-
|
29
|
-
- git clone git@github.com:DataDog/datadog-trace-agent.git $AGENT_BUILD_PATH
|
30
|
-
- cd $AGENT_BUILD_PATH && docker build -t datadog/trace-agent .
|
31
|
-
- docker run -d -e DD_API_KEY=invalid_key_but_this_is_fine -e DD_BIND_HOST=0.0.0.0 -p 127.0.0.1:7777:7777 datadog/trace-agent
|
31
|
+
# run the agent
|
32
|
+
- docker run -d -e DD_API_KEY=invalid_key_but_this_is_fine -e DD_BIND_HOST=0.0.0.0 -e DD_APM_ENABLED=true -p 127.0.0.1:8126:8126 -p 127.0.0.1:7777:7777 datadog/docker-dd-agent
|
32
33
|
override:
|
33
34
|
- rvm $MRI_VERSIONS --verbose do gem update --system
|
34
35
|
- rvm $MRI_VERSIONS --verbose do gem install bundler
|
@@ -38,24 +39,9 @@ dependencies:
|
|
38
39
|
test:
|
39
40
|
override:
|
40
41
|
- rvm $EARLY_STABLE --verbose do rake rubocop
|
41
|
-
#
|
42
|
-
|
43
|
-
|
44
|
-
- rvm $MRI_VERSIONS --verbose do appraisal contrib rake test:monkey
|
45
|
-
- rvm $MRI_VERSIONS --verbose do appraisal contrib rake test:elasticsearch
|
46
|
-
- rvm $MRI_VERSIONS --verbose do appraisal contrib rake test:http
|
47
|
-
- rvm $MRI_VERSIONS --verbose do appraisal contrib rake test:redis
|
48
|
-
- rvm $MRI_VERSIONS --verbose do appraisal contrib rake test:sinatra
|
49
|
-
- rvm $RAILS_VERSIONS --verbose do appraisal rails3-postgres rake test:rails
|
50
|
-
- rvm $RAILS_VERSIONS --verbose do appraisal rails3-mysql2 rake test:rails
|
51
|
-
- rvm $RAILS_VERSIONS --verbose do appraisal rails4-postgres rake test:rails
|
52
|
-
- rvm $RAILS_VERSIONS --verbose do appraisal rails4-mysql2 rake test:rails
|
53
|
-
- rvm $RAILS5_VERSIONS --verbose do appraisal rails5-postgres rake test:rails
|
54
|
-
- rvm $RAILS5_VERSIONS --verbose do appraisal rails5-mysql2 rake test:rails
|
55
|
-
- rvm $RAILS_VERSIONS --verbose do appraisal rails3-postgres-redis rake test:railsredis
|
56
|
-
- rvm $RAILS_VERSIONS --verbose do appraisal rails4-postgres-redis rake test:railsredis
|
57
|
-
- rvm $RAILS5_VERSIONS --verbose do appraisal rails5-postgres-redis rake test:railsredis
|
58
|
-
- rvm $LAST_STABLE --verbose do rake benchmark
|
42
|
+
# TODO: integration tests should run with the master branch of the agent
|
43
|
+
- rake ci:
|
44
|
+
parallel: true
|
59
45
|
|
60
46
|
deployment:
|
61
47
|
develop:
|
data/ddtrace.gemspec
CHANGED
@@ -3,72 +3,30 @@
|
|
3
3
|
_ddtrace_ is Datadog’s tracing client for Ruby. It is used to trace requests as they flow across web servers,
|
4
4
|
databases and microservices so that developers have great visiblity into bottlenecks and troublesome requests.
|
5
5
|
|
6
|
-
==
|
6
|
+
== Install the gem
|
7
7
|
|
8
|
-
Install the
|
9
|
-
|
10
|
-
$ gem install ddtrace
|
11
|
-
|
12
|
-
On the other hand, if you're using +Bundler+, just update your +Gemfile+ as follows:
|
8
|
+
Install the tracing client, adding the following gem in your +Gemfile+:
|
13
9
|
|
14
10
|
source 'https://rubygems.org'
|
15
11
|
|
16
12
|
# tracing gem
|
17
13
|
gem 'ddtrace'
|
18
14
|
|
19
|
-
If you're using
|
15
|
+
If you're not using +Bundler+ to manage your dependencies, you can install +ddtrace+ with:
|
20
16
|
|
21
|
-
|
17
|
+
gem install ddtrace
|
22
18
|
|
23
|
-
|
24
|
-
metrics listed in your service list.
|
19
|
+
We strongly suggest pinning the version of the library you deploy.
|
25
20
|
|
26
|
-
== Quickstart
|
21
|
+
== Quickstart
|
27
22
|
|
28
|
-
|
29
|
-
|
30
|
-
to trace requests to the home page:
|
23
|
+
The easiest way to get started with the tracing client is to instrument your web application. +ddtrace+ gem
|
24
|
+
provides auto instrumentation for the following web frameworks:
|
31
25
|
|
32
|
-
|
33
|
-
|
34
|
-
require 'activerecord'
|
26
|
+
* {Ruby on Rails}[#label-Ruby+on+Rails]
|
27
|
+
* {Sinatra}[#label-Sinatra]
|
35
28
|
|
36
|
-
|
37
|
-
tracer = Datadog.tracer
|
38
|
-
|
39
|
-
get '/' do
|
40
|
-
tracer.trace('web.request') do |span|
|
41
|
-
# set some span metadata
|
42
|
-
span.service = 'my-web-site'
|
43
|
-
span.resource = '/'
|
44
|
-
span.set_tag('http.method', request.request_method)
|
45
|
-
|
46
|
-
# trace the activerecord call
|
47
|
-
tracer.trace('posts.fetch') do
|
48
|
-
@posts = Posts.order(created_at: :desc).limit(10)
|
49
|
-
end
|
50
|
-
|
51
|
-
# trace the template rendering
|
52
|
-
tracer.trace('template.render') do
|
53
|
-
erb :index
|
54
|
-
end
|
55
|
-
end
|
56
|
-
end
|
57
|
-
|
58
|
-
== Glossary
|
59
|
-
|
60
|
-
[Service] The name of a set of processes that do the same job. Some examples are +datadog-web-app+ or +datadog-metrics-db+.
|
61
|
-
|
62
|
-
[Resource] A particular query to a service. For a web application, some examples might be a URL stem like +/user/home+ or a
|
63
|
-
handler function like +web.user.home+. For a SQL database, a resource would be the SQL of the query itself like
|
64
|
-
<tt>select * from users where id = ?</tt>.
|
65
|
-
You can track thousands (not millions or billions) of unique resources per services, so prefer resources like
|
66
|
-
+/user/home+ rather than <tt>/user/home?id=123456789</tt>.
|
67
|
-
|
68
|
-
[Span] A span tracks a unit of work in a service, like querying a database or rendering a template. Spans are associated
|
69
|
-
with a service and optionally a resource. Spans have names, start times, durations and optional tags.
|
70
|
-
|
71
|
-
== Integrations
|
29
|
+
== Web Frameworks
|
72
30
|
|
73
31
|
=== Ruby on \Rails
|
74
32
|
|
@@ -76,13 +34,7 @@ The \Rails integration will trace requests, database calls, templates rendering
|
|
76
34
|
operations. The integration makes use of the Active Support Instrumentation, listening to the Notification API
|
77
35
|
so that any operation instrumented by the API is traced.
|
78
36
|
|
79
|
-
|
80
|
-
|
81
|
-
Add the tracer gem to your +Gemfile+:
|
82
|
-
|
83
|
-
gem 'ddtrace'
|
84
|
-
|
85
|
-
To enable the Rails auto-instrumentation, you must create an initializer file in your +config/+ folder:
|
37
|
+
To enable the Rails auto instrumentation, create an initializer file in your +config/+ folder:
|
86
38
|
|
87
39
|
# config/initializers/datadog-tracer.rb
|
88
40
|
|
@@ -94,29 +46,7 @@ To enable the Rails auto-instrumentation, you must create an initializer file in
|
|
94
46
|
|
95
47
|
If you're using \Rails 3 or higher, your application will be listed as +my-rails-app+ in your service list.
|
96
48
|
|
97
|
-
====
|
98
|
-
|
99
|
-
If you need to instrument custom code within your controllers, you can simply:
|
100
|
-
|
101
|
-
class CustomController < ApplicationController
|
102
|
-
def index
|
103
|
-
# using auto instrumentation, these calls are already traced
|
104
|
-
@values = SomeModel.all
|
105
|
-
@counter = Rails.cache.fetch('custom_cache_key')
|
106
|
-
|
107
|
-
# use the global tracer to instrument your code
|
108
|
-
tracer = Datadog.tracer
|
109
|
-
tracer.trace('custom.service') do
|
110
|
-
data = Something::fetch_data()
|
111
|
-
@objects = Something::parse_data(data)
|
112
|
-
end
|
113
|
-
end
|
114
|
-
end
|
115
|
-
|
116
|
-
With the auto instrumentation turned on, the result trace will include your span correctly nested under the
|
117
|
-
+rails.request+ span.
|
118
|
-
|
119
|
-
==== Tracer Configuration
|
49
|
+
==== Configure the tracer with initializers
|
120
50
|
|
121
51
|
All tracing settings are namespaced under the +Rails.configuration.datadog_tracer+ hash. To change the default behavior
|
122
52
|
of the Datadog tracer, you can override the following defaults:
|
@@ -128,6 +58,7 @@ of the Datadog tracer, you can override the following defaults:
|
|
128
58
|
auto_instrument: false,
|
129
59
|
auto_instrument_redis: false,
|
130
60
|
default_service: 'rails-app',
|
61
|
+
default_database_service: 'postgresql',
|
131
62
|
default_cache_service: 'rails-cache',
|
132
63
|
template_base_path: 'views/',
|
133
64
|
tracer: Datadog.tracer,
|
@@ -136,7 +67,7 @@ of the Datadog tracer, you can override the following defaults:
|
|
136
67
|
trace_agent_port: 7777
|
137
68
|
}
|
138
69
|
|
139
|
-
|
70
|
+
Available settings are:
|
140
71
|
|
141
72
|
* +enabled+: defines if the +tracer+ is enabled or not. If set to +false+ the code could be still instrumented
|
142
73
|
because of other settings, but no spans are sent to the local trace agent.
|
@@ -158,35 +89,32 @@ The available settings are:
|
|
158
89
|
|
159
90
|
=== Sinatra
|
160
91
|
|
161
|
-
The Sinatra integration traces requests and template rendering. The
|
162
|
-
|
163
|
-
|
164
|
-
==== Setup
|
92
|
+
The Sinatra integration traces requests and template rendering. The integration is based on the
|
93
|
+
+Datadog::Contrib::Sinatra::Tracer+ extension.
|
165
94
|
|
166
|
-
|
167
|
-
|
168
|
-
gem 'ddtrace'
|
169
|
-
|
170
|
-
Make sure you import +ddtrace+ and +ddtrace/contrib/sinatra/tracer+ after
|
95
|
+
To start using the tracing client, make sure you import +ddtrace+ and +ddtrace/contrib/sinatra/tracer+ after
|
171
96
|
either +sinatra+ or +sinatra/base+:
|
172
97
|
|
173
98
|
require 'sinatra'
|
174
99
|
require 'ddtrace'
|
175
100
|
require 'ddtrace/contrib/sinatra/tracer'
|
176
101
|
|
102
|
+
get '/' do
|
103
|
+
'Hello world!'
|
104
|
+
end
|
105
|
+
|
177
106
|
The tracing extension will be automatically activated.
|
178
107
|
|
179
|
-
====
|
108
|
+
==== Configure the tracer
|
180
109
|
|
181
|
-
To modify the default configuration, use the
|
182
|
-
|
183
|
-
service name and activate the debug mode:
|
110
|
+
To modify the default configuration, use the +settings.datadog_tracer.configure+ method. For example,
|
111
|
+
to change the default service name and activate the debug mode:
|
184
112
|
|
185
113
|
configure do
|
186
114
|
settings.datadog_tracer.configure default_service: 'my-app', debug: true
|
187
115
|
end
|
188
116
|
|
189
|
-
|
117
|
+
Available settings are:
|
190
118
|
|
191
119
|
* +enabled+: define if the +tracer+ is enabled or not. If set to +false+, the code is still instrumented
|
192
120
|
but no spans are sent to the local trace agent.
|
@@ -197,6 +125,8 @@ The available settings are:
|
|
197
125
|
* +trace_agent_hostname+: set the hostname of the trace agent.
|
198
126
|
* +trace_agent_port+: set the port the trace agent is listening on.
|
199
127
|
|
128
|
+
== Other libraries
|
129
|
+
|
200
130
|
=== Redis
|
201
131
|
|
202
132
|
The \Redis integration will trace simple calls as well as pipelines.
|
@@ -245,7 +175,39 @@ The \Net/HTTP integration will trace any HTTP call using the standard lib
|
|
245
175
|
|
246
176
|
content = Net::HTTP.get(URI('http://127.0.0.1/index.html'))
|
247
177
|
|
248
|
-
==
|
178
|
+
== Advanced usage
|
179
|
+
|
180
|
+
=== Manual Instrumentation
|
181
|
+
|
182
|
+
If you aren't using a supported framework instrumentation, you may want to to manually instrument your code.
|
183
|
+
Adding tracing to your code is very simple. As an example, let’s imagine we have a web server and we want
|
184
|
+
to trace requests to the home page:
|
185
|
+
|
186
|
+
require 'ddtrace'
|
187
|
+
require 'sinatra'
|
188
|
+
require 'activerecord'
|
189
|
+
|
190
|
+
# a generic tracer that you can use across your application
|
191
|
+
tracer = Datadog.tracer
|
192
|
+
|
193
|
+
get '/' do
|
194
|
+
tracer.trace('web.request') do |span|
|
195
|
+
# set some span metadata
|
196
|
+
span.service = 'my-web-site'
|
197
|
+
span.resource = '/'
|
198
|
+
span.set_tag('http.method', request.request_method)
|
199
|
+
|
200
|
+
# trace the activerecord call
|
201
|
+
tracer.trace('posts.fetch') do
|
202
|
+
@posts = Posts.order(created_at: :desc).limit(10)
|
203
|
+
end
|
204
|
+
|
205
|
+
# trace the template rendering
|
206
|
+
tracer.trace('template.render') do
|
207
|
+
erb :index
|
208
|
+
end
|
209
|
+
end
|
210
|
+
end
|
249
211
|
|
250
212
|
=== Patching methods
|
251
213
|
|
@@ -341,7 +303,7 @@ You can use this object to instrument your own code:
|
|
341
303
|
end
|
342
304
|
end
|
343
305
|
|
344
|
-
|
306
|
+
=== Debug Mode
|
345
307
|
|
346
308
|
If you need to check locally what traces and spans are sent after each traced block, you can enable
|
347
309
|
a global debug mode for all tracers so that every time a trace is ready to be sent, the content will be
|
@@ -367,7 +329,9 @@ for the first time:
|
|
367
329
|
Remember that the debug mode may affect your application performance and so it must not be used
|
368
330
|
in a production environment.
|
369
331
|
|
370
|
-
|
332
|
+
=== Supported Versions
|
333
|
+
|
334
|
+
==== Ruby interpreters
|
371
335
|
|
372
336
|
The \Datadog Trace Client has been tested with the following Ruby versions:
|
373
337
|
|
@@ -379,7 +343,7 @@ The \Datadog Trace Client has been tested with the following Ruby versions:
|
|
379
343
|
|
380
344
|
Other versions aren't yet officially supported.
|
381
345
|
|
382
|
-
|
346
|
+
==== Ruby on Rails versions
|
383
347
|
|
384
348
|
The supported versions are:
|
385
349
|
|
@@ -392,6 +356,19 @@ The currently supported web server are:
|
|
392
356
|
* Unicorn 4.8+ and 5.1+
|
393
357
|
* Passenger 5.0+
|
394
358
|
|
395
|
-
|
359
|
+
==== Sinatra versions
|
396
360
|
|
397
361
|
Currently we are supporting Sinatra >= 1.4.0.
|
362
|
+
|
363
|
+
=== Glossary
|
364
|
+
|
365
|
+
[Service] The name of a set of processes that do the same job. Some examples are +datadog-web-app+ or +datadog-metrics-db+.
|
366
|
+
|
367
|
+
[Resource] A particular query to a service. For a web application, some examples might be a URL stem like +/user/home+ or a
|
368
|
+
handler function like +web.user.home+. For a SQL database, a resource would be the SQL of the query itself like
|
369
|
+
<tt>select * from users where id = ?</tt>.
|
370
|
+
You can track thousands (not millions or billions) of unique resources per services, so prefer resources like
|
371
|
+
+/user/home+ rather than <tt>/user/home?id=123456789</tt>.
|
372
|
+
|
373
|
+
[Span] A span tracks a unit of work in a service, like querying a database or rendering a template. Spans are associated
|
374
|
+
with a service and optionally a resource. Spans have names, start times, durations and optional tags.
|
data/gemfiles/contrib.gemfile
CHANGED
@@ -74,7 +74,6 @@ module Datadog
|
|
74
74
|
span.service = pin.service
|
75
75
|
span.span_type = Datadog::Ext::Redis::TYPE
|
76
76
|
span.resource = Datadog::Contrib::Redis::Quantize.format_command_args(*args)
|
77
|
-
span.set_tag(Datadog::Ext::Redis::RAWCMD, span.resource)
|
78
77
|
Datadog::Contrib::Redis::Tags.set_common_tags(self, span)
|
79
78
|
|
80
79
|
response = call_without_datadog(*args, &block)
|
@@ -95,7 +94,6 @@ module Datadog
|
|
95
94
|
span.span_type = Datadog::Ext::Redis::TYPE
|
96
95
|
commands = args[0].commands.map { |c| Datadog::Contrib::Redis::Quantize.format_command_args(c) }
|
97
96
|
span.resource = commands.join("\n")
|
98
|
-
span.set_tag(Datadog::Ext::Redis::RAWCMD, span.resource)
|
99
97
|
Datadog::Contrib::Redis::Tags.set_common_tags(self, span)
|
100
98
|
|
101
99
|
response = call_pipeline_without_datadog(*args, &block)
|
data/lib/ddtrace/ext/redis.rb
CHANGED
data/lib/ddtrace/tracer.rb
CHANGED
@@ -21,14 +21,14 @@ module Datadog
|
|
21
21
|
def self.log
|
22
22
|
unless defined? @logger
|
23
23
|
@logger = Logger.new(STDOUT)
|
24
|
-
@logger.level = Logger::
|
24
|
+
@logger.level = Logger::WARN
|
25
25
|
end
|
26
26
|
@logger
|
27
27
|
end
|
28
28
|
|
29
29
|
# Activate the debug mode providing more information related to tracer usage
|
30
30
|
def self.debug_logging=(value)
|
31
|
-
log.level = value ? Logger::DEBUG : Logger::
|
31
|
+
log.level = value ? Logger::DEBUG : Logger::WARN
|
32
32
|
end
|
33
33
|
|
34
34
|
# Return if the debug mode is activated or not
|
data/lib/ddtrace/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: ddtrace
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.4.
|
4
|
+
version: 0.4.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Datadog, Inc.
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2017-
|
11
|
+
date: 2017-02-14 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: msgpack
|
@@ -80,6 +80,20 @@ dependencies:
|
|
80
80
|
- - "~>"
|
81
81
|
- !ruby/object:Gem::Version
|
82
82
|
version: '2.1'
|
83
|
+
- !ruby/object:Gem::Dependency
|
84
|
+
name: yard
|
85
|
+
requirement: !ruby/object:Gem::Requirement
|
86
|
+
requirements:
|
87
|
+
- - "~>"
|
88
|
+
- !ruby/object:Gem::Version
|
89
|
+
version: '0.9'
|
90
|
+
type: :development
|
91
|
+
prerelease: false
|
92
|
+
version_requirements: !ruby/object:Gem::Requirement
|
93
|
+
requirements:
|
94
|
+
- - "~>"
|
95
|
+
- !ruby/object:Gem::Version
|
96
|
+
version: '0.9'
|
83
97
|
description: |
|
84
98
|
ddtrace is Datadog’s tracing client for Ruby. It is used to trace requests
|
85
99
|
as they flow across web servers, databases and microservices so that developers
|
@@ -93,6 +107,7 @@ files:
|
|
93
107
|
- ".env"
|
94
108
|
- ".gitignore"
|
95
109
|
- ".rubocop.yml"
|
110
|
+
- ".yardopts"
|
96
111
|
- Appraisals
|
97
112
|
- Gemfile
|
98
113
|
- LICENSE
|
@@ -101,7 +116,7 @@ files:
|
|
101
116
|
- circle.yml
|
102
117
|
- ddtrace.gemspec
|
103
118
|
- docker-compose.yml
|
104
|
-
- docs/
|
119
|
+
- docs/index.rdoc
|
105
120
|
- gemfiles/contrib.gemfile
|
106
121
|
- gemfiles/rails3_mysql2.gemfile
|
107
122
|
- gemfiles/rails3_postgres.gemfile
|