Skip to content

Commit 6910cc7

Browse files
author
Emanuele Palazzetti
committed
[docs] moving to .md
1 parent 2ed2274 commit 6910cc7

File tree

2 files changed

+109
-109
lines changed

2 files changed

+109
-109
lines changed

.yardopts

+5-1
Original file line numberDiff line numberDiff line change
@@ -1 +1,5 @@
1-
--readme docs/index.rdoc
1+
--readme docs/GettingStarted.md
2+
--main docs/GettingStarted.md
3+
-
4+
docs/GettingStarted.md
5+
LICENSE
+104-108
Original file line numberDiff line numberDiff line change
@@ -1,40 +1,40 @@
1-
= \Datadog Trace Client
1+
# Datadog Trace Client
22

3-
_ddtrace_ is Datadog’s tracing client for Ruby. It is used to trace requests as they flow across web servers,
3+
``ddtrace`` is Datadog’s tracing client for Ruby. It is used to trace requests as they flow across web servers,
44
databases and microservices so that developers have great visiblity into bottlenecks and troublesome requests.
55

6-
== Install the gem
6+
## Install the gem
77

8-
Install the tracing client, adding the following gem in your +Gemfile+:
8+
Install the tracing client, adding the following gem in your ``Gemfile``:
99

1010
source 'https://rubygems.org'
1111

1212
# tracing gem
1313
gem 'ddtrace'
1414

15-
If you're not using +Bundler+ to manage your dependencies, you can install +ddtrace+ with:
15+
If you're not using ``Bundler`` to manage your dependencies, you can install ``ddtrace`` with:
1616

1717
gem install ddtrace
1818

1919
We strongly suggest pinning the version of the library you deploy.
2020

21-
== Quickstart
21+
## Quickstart
2222

23-
The easiest way to get started with the tracing client is to instrument your web application. +ddtrace+ gem
23+
The easiest way to get started with the tracing client is to instrument your web application. ``ddtrace`` gem
2424
provides auto instrumentation for the following web frameworks:
2525

26-
* {Ruby on Rails}[#label-Ruby+on+Rails]
27-
* {Sinatra}[#label-Sinatra]
26+
* [Ruby on Rails](#label-Ruby+on+Rails)
27+
* [Sinatra](#label-Sinatra)
2828

29-
== Web Frameworks
29+
## Web Frameworks
3030

31-
=== Ruby on \Rails
31+
### Ruby on Rails
3232

33-
The \Rails integration will trace requests, database calls, templates rendering and cache read/write/delete
33+
The Rails integration will trace requests, database calls, templates rendering and cache read/write/delete
3434
operations. The integration makes use of the Active Support Instrumentation, listening to the Notification API
3535
so that any operation instrumented by the API is traced.
3636

37-
To enable the Rails auto instrumentation, create an initializer file in your +config/+ folder:
37+
To enable the Rails auto instrumentation, create an initializer file in your ``config/`` folder:
3838

3939
# config/initializers/datadog-tracer.rb
4040

@@ -44,11 +44,11 @@ To enable the Rails auto instrumentation, create an initializer file in your +co
4444
default_service: 'my-rails-app'
4545
}
4646

47-
If you're using \Rails 3 or higher, your application will be listed as +my-rails-app+ in your service list.
47+
If you're using Rails 3 or higher, your application will be listed as ``my-rails-app`` in your service list.
4848

49-
==== Configure the tracer with initializers
49+
#### Configure the tracer with initializers
5050

51-
All tracing settings are namespaced under the +Rails.configuration.datadog_tracer+ hash. To change the default behavior
51+
All tracing settings are namespaced under the ``Rails.configuration.datadog_tracer`` hash. To change the default behavior
5252
of the Datadog tracer, you can override the following defaults:
5353

5454
# config/initializers/datadog-tracer.rb
@@ -69,31 +69,31 @@ of the Datadog tracer, you can override the following defaults:
6969

7070
Available settings are:
7171

72-
* +enabled+: defines if the +tracer+ is enabled or not. If set to +false+ the code could be still instrumented
72+
* ``enabled``: defines if the ``tracer`` is enabled or not. If set to ``false`` the code could be still instrumented
7373
because of other settings, but no spans are sent to the local trace agent.
74-
* +auto_instrument+: if set to +true+ the code will be automatically instrumented. You may change this value
74+
* ``auto_instrument``: if set to +true+ the code will be automatically instrumented. You may change this value
7575
with a condition, to enable the auto-instrumentation only for particular environments (production, staging, etc...).
76-
* +auto_instrument_redis+: if set to +true+ \Redis calls will be traced as such. Calls to Redis cache may be
77-
still instrumented but you will not have the detail of low-level \Redis calls.
78-
* +default_service+: set the service name used when tracing application requests. Defaults to +rails-app+
79-
* +default_database_service+: set the database service name used when tracing database activity. Defaults to the
80-
current adapter name, so if you're using PostgreSQL it will be +postgres+.
81-
* +default_cache_service+: set the cache service name used when tracing cache activity. Defaults to +rails-cache+
82-
* +template_base_path+: used when the template name is parsed in the auto instrumented code. If you don't store
83-
your templates in the +views/+ folder, you may need to change this value
84-
* +tracer+: is the global tracer used by the tracing application. Usually you don't need to change that value
85-
unless you're already using a different initialized +tracer+ somewhere else
86-
* +debug+: set to true to enable debug logging.
87-
* +trace_agent_hostname+: set the hostname of the trace agent.
88-
* +trace_agent_port+: set the port the trace agent is listening on.
89-
90-
=== Sinatra
76+
* ``auto_instrument_redis``: if set to ``true`` Redis calls will be traced as such. Calls to Redis cache may be
77+
still instrumented but you will not have the detail of low-level Redis calls.
78+
* ``default_service``: set the service name used when tracing application requests. Defaults to ``rails-app``
79+
* ``default_database_service``: set the database service name used when tracing database activity. Defaults to the
80+
current adapter name, so if you're using PostgreSQL it will be ``postgres``.
81+
* ``default_cache_service``: set the cache service name used when tracing cache activity. Defaults to ``rails-cache``
82+
* ``template_base_path``: used when the template name is parsed in the auto instrumented code. If you don't store
83+
your templates in the ``views/`` folder, you may need to change this value
84+
* ``tracer``: is the global tracer used by the tracing application. Usually you don't need to change that value
85+
unless you're already using a different initialized ``tracer`` somewhere else
86+
* ``debug``: set to true to enable debug logging.
87+
* ``trace_agent_hostname``: set the hostname of the trace agent.
88+
* ``trace_agent_port``: set the port the trace agent is listening on.
89+
90+
### Sinatra
9191

9292
The Sinatra integration traces requests and template rendering. The integration is based on the
93-
+Datadog::Contrib::Sinatra::Tracer+ extension.
93+
``Datadog::Contrib::Sinatra::Tracer`` extension.
9494

95-
To start using the tracing client, make sure you import +ddtrace+ and +ddtrace/contrib/sinatra/tracer+ after
96-
either +sinatra+ or +sinatra/base+:
95+
To start using the tracing client, make sure you import ``ddtrace`` and ``ddtrace/contrib/sinatra/tracer`` after
96+
either ``sinatra`` or ``sinatra/base``:
9797

9898
require 'sinatra'
9999
require 'ddtrace'
@@ -105,9 +105,9 @@ either +sinatra+ or +sinatra/base+:
105105

106106
The tracing extension will be automatically activated.
107107

108-
==== Configure the tracer
108+
#### Configure the tracer
109109

110-
To modify the default configuration, use the +settings.datadog_tracer.configure+ method. For example,
110+
To modify the default configuration, use the ``settings.datadog_tracer.configure`` method. For example,
111111
to change the default service name and activate the debug mode:
112112

113113
configure do
@@ -116,20 +116,20 @@ to change the default service name and activate the debug mode:
116116

117117
Available settings are:
118118

119-
* +enabled+: define if the +tracer+ is enabled or not. If set to +false+, the code is still instrumented
119+
* ``enabled``: define if the ``tracer`` is enabled or not. If set to ``false``, the code is still instrumented
120120
but no spans are sent to the local trace agent.
121-
* +default_service+: set the service name used when tracing application requests. Defaults to +sinatra+
122-
* +tracer+: set the tracer to use. Usually you don't need to change that value
121+
* ``default_service``: set the service name used when tracing application requests. Defaults to ``sinatra``
122+
* ``tracer``: set the tracer to use. Usually you don't need to change that value
123123
unless you're already using a different initialized tracer somewhere else
124-
* +debug+: set to +true+ to enable debug logging.
125-
* +trace_agent_hostname+: set the hostname of the trace agent.
126-
* +trace_agent_port+: set the port the trace agent is listening on.
124+
* ``debug``: set to ``true`` to enable debug logging.
125+
* ``trace_agent_hostname``: set the hostname of the trace agent.
126+
* ``trace_agent_port``: set the port the trace agent is listening on.
127127

128-
== Other libraries
128+
## Other libraries
129129

130-
=== Redis
130+
### Redis
131131

132-
The \Redis integration will trace simple calls as well as pipelines.
132+
The Redis integration will trace simple calls as well as pipelines.
133133

134134
require 'redis'
135135
require 'ddtrace'
@@ -140,10 +140,10 @@ The \Redis integration will trace simple calls as well as pipelines.
140140
redis = Redis.new
141141
redis.set 'foo', 'bar' # traced!
142142

143-
=== Elastic Search
143+
### Elastic Search
144144

145-
The \Elasticsearch integration will trace any call to \perform_request
146-
in the \Client object:
145+
The Elasticsearch integration will trace any call to ``perform_request``
146+
in the ``Client`` object:
147147

148148
require 'elasticsearch/transport'
149149
require 'ddtrace'
@@ -154,14 +154,14 @@ in the \Client object:
154154
client = Elasticsearch::Client.new url: 'http://127.0.0.1:9200'
155155
response = client.perform_request 'GET', '_cluster/health'
156156

157-
Note that if you enable both \Elasticsearch and \Net/HTTP integrations then
158-
for each call, two spans are created, one for \Elasctisearch and one for \Net/HTTP.
159-
This typically happens if you call \patch_all to enable all integrations by default.
157+
Note that if you enable both Elasticsearch and Net/HTTP integrations then
158+
for each call, two spans are created, one for Elasctisearch and one for Net/HTTP.
159+
This typically happens if you call ``patch_all`` to enable all integrations by default.
160160

161-
=== Net/HTTP
161+
### Net/HTTP
162162

163-
The \Net/HTTP integration will trace any HTTP call using the standard lib
164-
\Net::HTTP module.
163+
The Net/HTTP integration will trace any HTTP call using the standard lib
164+
Net::HTTP module.
165165

166166
require 'net/http'
167167
require 'ddtrace'
@@ -175,9 +175,9 @@ The \Net/HTTP integration will trace any HTTP call using the standard lib
175175

176176
content = Net::HTTP.get(URI('http://127.0.0.1/index.html'))
177177

178-
== Advanced usage
178+
## Advanced usage
179179

180-
=== Manual Instrumentation
180+
### Manual Instrumentation
181181

182182
If you aren't using a supported framework instrumentation, you may want to to manually instrument your code.
183183
Adding tracing to your code is very simple. As an example, let’s imagine we have a web server and we want
@@ -209,24 +209,24 @@ to trace requests to the home page:
209209
end
210210
end
211211

212-
=== Patching methods
212+
### Patching methods
213213

214-
Integrations such as \Redis or \Elasticsearch use monkey patching.
214+
Integrations such as Redis or Elasticsearch use monkey patching.
215215

216216
The available methods are:
217217

218-
* +autopatch_modules+: returns a \Hash of all modules available for monkey patching,
219-
the key is the name of the module and the value \true or \false. If it is \true,
220-
a call to \patch_all will enable the module, if it is \false, it will do nothing.
221-
* +patch_all+: patches all modules which are supported. Make sure all the necessary
222-
calls to \require have been done before this is called, else monkey patching will
218+
* ``autopatch_modules``: returns a hash of all modules available for monkey patching,
219+
the key is the name of the module and the value ``true`` or ``false``. If it is ``true``,
220+
a call to ``patch_all`` will enable the module, if it is ``false``, it will do nothing.
221+
* ``patch_all``: patches all modules which are supported. Make sure all the necessary
222+
calls to ``require`` have been done before this is called, else monkey patching will
223223
not work.
224-
* +patch_module+: patches a single module, regardless of its settings in the
225-
\autopatch_modules list.
226-
* +patch+: patches some modules, you should pass a hash like the one returned
227-
by \autopatch_modules
228-
* +get_patched_modules+: returns the list of patched modules, a module has been
229-
correctly patched only if it is in this hash, with a value set to \true.
224+
* ``patch_module``: patches a single module, regardless of its settings in the
225+
``autopatch_modules`` list.
226+
* ``patch``: patches some modules, you should pass a hash like the one returned
227+
by ``autopatch_modules``
228+
* ``get_patched_modules``: returns the list of patched modules, a module has been
229+
correctly patched only if it is in this hash, with a value set to ``true``.
230230

231231
Example:
232232

@@ -238,36 +238,36 @@ Example:
238238
Datadog::Monkey.patch_all # patch all the available modules
239239
puts Datadog::Monkey.get_patched_modules # tells wether modules are patched or not
240240

241-
It is safe to call \patch_all, \patch_module or \patch several times.
242-
Make sure the library you want to patch is imported before you call \patch_module.
243-
In doubt, check with \get_patched_modules.
241+
It is safe to call ``patch_all``, ``patch_module`` or ``patch`` several times.
242+
Make sure the library you want to patch is imported before you call ``patch_module``.
243+
In doubt, check with ``get_patched_modules``.
244244
Once a module is patched, it is not possible to unpatch it.
245245

246-
=== Patch Info (PIN)
246+
### Patch Info (PIN)
247247

248-
The Patch Info, AKA \Pin object, gives you control on the integration.
248+
The Patch Info, AKA ``Pin`` object, gives you control on the integration.
249249

250250
It has one class method:
251251

252-
* +get_from+: returns the Pin object which has been pinned onto some random
253-
object. It is safe to call \get_from on any object, but it might return \nil.
252+
* ``get_from``: returns the Pin object which has been pinned onto some random
253+
object. It is safe to call ``get_from`` on any object, but it might return ``nil``.
254254

255255
Some instance methods:
256256

257-
* +enabled?+: wether tracing is enabled for this object
258-
* +onto+: applies the patch information to some random object. It is the companion
259-
function of \get_from.
257+
* ``enabled?``: wether tracing is enabled for this object
258+
* ``onto``: applies the patch information to some random object. It is the companion
259+
function of ``get_from``.
260260

261261
Accessors:
262262

263-
* +service+: service, you should typically set some meaningful value for this.
264-
* +app+: application name
265-
* +tags+: optional tags
266-
* +app_type+: application type
267-
* +name+: span name
268-
* +tracer+: the tracer object used for tracing
263+
* ``service``: service, you should typically set some meaningful value for this.
264+
* ``app``: application name
265+
* ``tags``: optional tags
266+
* ``app_type``: application type
267+
* ``name``: span name
268+
* ``tracer``: the tracer object used for tracing
269269

270-
By default, a traced integration such as \Redis or \Elasticsearch carries a \Pin object. Eg:
270+
By default, a traced integration such as Redis or Elasticsearch carries a Pin object. Eg:
271271

272272
require 'redis'
273273
require 'ddtrace'
@@ -303,7 +303,7 @@ You can use this object to instrument your own code:
303303
end
304304
end
305305

306-
=== Debug Mode
306+
### Debug Mode
307307

308308
If you need to check locally what traces and spans are sent after each traced block, you can enable
309309
a global debug mode for all tracers so that every time a trace is ready to be sent, the content will be
@@ -329,11 +329,11 @@ for the first time:
329329
Remember that the debug mode may affect your application performance and so it must not be used
330330
in a production environment.
331331

332-
=== Supported Versions
332+
### Supported Versions
333333

334-
==== Ruby interpreters
334+
#### Ruby interpreters
335335

336-
The \Datadog Trace Client has been tested with the following Ruby versions:
336+
The Datadog Trace Client has been tested with the following Ruby versions:
337337

338338
* Ruby MRI 2.1
339339
* Ruby MRI 2.2
@@ -343,32 +343,28 @@ The \Datadog Trace Client has been tested with the following Ruby versions:
343343

344344
Other versions aren't yet officially supported.
345345

346-
==== Ruby on Rails versions
346+
#### Ruby on Rails versions
347347

348348
The supported versions are:
349349

350-
* \Rails 3.2 (MRI interpreter, JRuby is experimental)
351-
* \Rails 4.2 (MRI interpreter, JRuby is experimental)
352-
* \Rails 5.0 (MRI interpreter)
350+
* Rails 3.2 (MRI interpreter, JRuby is experimental)
351+
* Rails 4.2 (MRI interpreter, JRuby is experimental)
352+
* Rails 5.0 (MRI interpreter)
353353

354354
The currently supported web server are:
355355
* Puma 2.16+ and 3.6+
356356
* Unicorn 4.8+ and 5.1+
357357
* Passenger 5.0+
358358

359-
==== Sinatra versions
359+
#### Sinatra versions
360360

361361
Currently we are supporting Sinatra >= 1.4.0.
362362

363-
=== Glossary
363+
### Glossary
364364

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.
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+
* ``Resource``: A particular query to a service. For a web application, some examples might be a URL stem like ``/user/home`` or a
367+
handler function like ``web.user.home``. For a SQL database, a resource would be the SQL of the query itself like ``select * from users where id = ?``.
368+
You can track thousands (not millions or billions) of unique resources per services, so prefer resources like ``/user/home`` rather than ``/user/home?id=123456789``.
369+
* ``Span``: A span tracks a unit of work in a service, like querying a database or rendering a template. Spans are associated
370+
with a service and optionally a resource. Spans have names, start times, durations and optional tags.

0 commit comments

Comments
 (0)