You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
If you aren't using a supported framework instrumentation, you may want to to manually instrument your code.
183
183
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:
209
209
end
210
210
end
211
211
212
-
=== Patching methods
212
+
###Patching methods
213
213
214
-
Integrations such as \Redis or \Elasticsearch use monkey patching.
214
+
Integrations such as Redis or Elasticsearch use monkey patching.
215
215
216
216
The available methods are:
217
217
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
223
223
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``.
230
230
231
231
Example:
232
232
@@ -238,36 +238,36 @@ Example:
238
238
Datadog::Monkey.patch_all # patch all the available modules
239
239
puts Datadog::Monkey.get_patched_modules # tells wether modules are patched or not
240
240
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``.
244
244
Once a module is patched, it is not possible to unpatch it.
245
245
246
-
=== Patch Info (PIN)
246
+
###Patch Info (PIN)
247
247
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.
249
249
250
250
It has one class method:
251
251
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``.
254
254
255
255
Some instance methods:
256
256
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``.
260
260
261
261
Accessors:
262
262
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
269
269
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:
271
271
272
272
require 'redis'
273
273
require 'ddtrace'
@@ -303,7 +303,7 @@ You can use this object to instrument your own code:
303
303
end
304
304
end
305
305
306
-
=== Debug Mode
306
+
###Debug Mode
307
307
308
308
If you need to check locally what traces and spans are sent after each traced block, you can enable
309
309
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:
329
329
Remember that the debug mode may affect your application performance and so it must not be used
330
330
in a production environment.
331
331
332
-
=== Supported Versions
332
+
###Supported Versions
333
333
334
-
==== Ruby interpreters
334
+
####Ruby interpreters
335
335
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:
337
337
338
338
* Ruby MRI 2.1
339
339
* Ruby MRI 2.2
@@ -343,32 +343,28 @@ The \Datadog Trace Client has been tested with the following Ruby versions:
343
343
344
344
Other versions aren't yet officially supported.
345
345
346
-
==== Ruby on Rails versions
346
+
####Ruby on Rails versions
347
347
348
348
The supported versions are:
349
349
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)
353
353
354
354
The currently supported web server are:
355
355
* Puma 2.16+ and 3.6+
356
356
* Unicorn 4.8+ and 5.1+
357
357
* Passenger 5.0+
358
358
359
-
==== Sinatra versions
359
+
####Sinatra versions
360
360
361
361
Currently we are supporting Sinatra >= 1.4.0.
362
362
363
-
=== Glossary
363
+
###Glossary
364
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.
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