Skip to content

Commit 2071be2

Browse files
authored
[docs] Refactor documentation (#539)
* [docs] update README - add badges - add references to external documentation - reword a few things - remove information about versioning * [docs] fix badge formatting * [docs] separate docs into logical partitions * [docs] fix links, typos, consistency * [docs] a few more small fixes * [docs] address nits * [docs] fix HTTPPropagator usage docs (#546) * [docs/django] add Django tracer logging configuration docs * [docs] address nits - use only pypi version badge, drop release version - revert mysql naming changes - remove makefile link command - add missing supported distributed tracing libraries - dynamic copyright date - misc. wording fixes * [docs] refactor pre-sampling (to client sampling) * [docs] move aiohttp to web integrations * [docs] add web framework preamble * [docs] remove empty file
1 parent 2ca317a commit 2071be2

File tree

19 files changed

+1033
-733
lines changed

19 files changed

+1033
-733
lines changed

README.md

Lines changed: 90 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,90 @@
1+
# dd-trace-py
2+
3+
[![CircleCI](https://circleci.com/gh/DataDog/dd-trace-py/tree/master.svg?style=svg)](https://circleci.com/gh/DataDog/dd-trace-py/tree/master)
4+
[![Pyversions](https://img.shields.io/pypi/pyversions/ddtrace.svg?style=flat)](https://pypi.org/project/ddtrace/)
5+
[![PypiVersions](https://img.shields.io/pypi/v/ddtrace.svg)](https://pypi.org/project/ddtrace/)
6+
7+
`ddtrace` is Datadog's tracing library for Python. It is used to trace requests
8+
as they flow across web servers, databases and microservices so that developers
9+
have great visiblity into bottlenecks and troublesome requests.
10+
11+
## Getting Started
12+
13+
For a basic product overview, installation and quick start, check out our
14+
[setup documentation][setup docs].
15+
16+
For more advanced usage and configuration, check out our [API
17+
documentation][pypi docs].
18+
19+
For descriptions of terminology used in APM, take a look at the [official
20+
documentation][visualization docs].
21+
22+
[setup docs]: https://docs.datadoghq.com/tracing/setup/python/
23+
[pypi docs]: http://pypi.datadoghq.com/trace/docs/
24+
[visualization docs]: https://docs.datadoghq.com/tracing/visualization/
25+
26+
27+
## Development
28+
29+
30+
### Testing
31+
32+
33+
#### Environment
34+
35+
The test suite requires many backing services such as PostgreSQL, MySQL, Redis
36+
and more. We use ``docker`` and ``docker-compose`` to run the services in our CI
37+
and for development. To run the test matrix, please [install docker][docker] and
38+
[docker-compose][docker-compose] using the instructions provided by your platform. Then
39+
launch them through:
40+
41+
$ docker-compose up -d
42+
43+
44+
[docker]: https://www.docker.com/products/docker
45+
[docker-compose]: https://www.docker.com/products/docker-compose
46+
47+
48+
#### Running the Tests
49+
50+
Once docker is up and running you should be able to run the tests. To launch a
51+
single test manually. For example to run the tests for `redis-py` 2.10 on Python
52+
3.5 and 3.6:
53+
54+
$ tox -e '{py35,py36}-redis{210}'
55+
56+
To see the defined test commands see `tox.ini`.
57+
58+
To launch the complete test matrix run:
59+
60+
$ tox
61+
62+
63+
### Continuous Integration
64+
65+
We use CircleCI 2.0 for our continuous integration.
66+
67+
68+
#### Configuration
69+
70+
The CI tests are configured through [config.yml](.circleci/config.yml).
71+
72+
73+
#### Running Locally
74+
75+
The CI tests can be run locally using the `circleci` CLI. More information about
76+
the CLI can be found at https://circleci.com/docs/2.0/local-jobs/.
77+
78+
After installing the `circleci` CLI, you can run jobs by name. For example:
79+
80+
$ circleci build --job django
81+
82+
83+
### Benchmarking
84+
85+
When two or more approaches must be compared, please write a benchmark in the
86+
[benchmark.py](tests/benchmark.py) module so that we can measure the efficiency
87+
of the algorithm. To run your benchmark, just:
88+
89+
$ python -m tests.benchmark
90+

README.rst

Lines changed: 0 additions & 72 deletions
This file was deleted.

ddtrace/contrib/aiopg/__init__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
"""
2-
Instrument `aiopg` to report a span for each executed Postgres queries::
2+
Instrument aiopg to report a span for each executed Postgres queries::
33
44
from ddtrace import Pin, patch
55
import aiopg

ddtrace/contrib/django/__init__.py

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,19 @@
2828
tracer.trace("something")
2929
# your code ...
3030
31+
To have Django capture the tracer logs, ensure the ``LOGGING`` variable in
32+
``settings.py`` looks similar to::
33+
34+
LOGGING = {
35+
'loggers': {
36+
'ddtrace': {
37+
'handlers': ['console'],
38+
'level': 'WARNING',
39+
},
40+
},
41+
}
42+
43+
3144
The available settings are:
3245
3346
* ``DEFAULT_SERVICE`` (default: ``'django'``): set the service name used by the

ddtrace/contrib/mysql/__init__.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,6 @@
1717
# Use a pin to specify metadata related to this connection
1818
Pin.override(conn, service='mysql-users')
1919
20-
This package works for mysql.connector version 2.1.x.
2120
Only the default full-Python integration works. The binary C connector,
2221
provided by _mysql_connector, is not supported yet.
2322

ddtrace/contrib/mysqldb/__init__.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -17,9 +17,9 @@
1717
# Use a pin to specify metadata related to this connection
1818
Pin.override(conn, service='mysql-users')
1919
20-
This package works for mysqlclient or MySQL-python
21-
Only the default full-Python integration works. The binary C connector,
22-
provided by _mysql, is not supported yet.
20+
This package works for mysqlclient or MySQL-python. Only the default
21+
full-Python integration works. The binary C connector provided by
22+
_mysql is not yet supported.
2323
2424
Help on mysqlclient can be found on:
2525
https://mysqlclient.readthedocs.io/

ddtrace/contrib/pymysql/__init__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
"""Instrumeent pymysql to report MySQL queries.
1+
"""Instrument pymysql to report MySQL queries.
22
33
``patch_all`` will automatically patch your pymysql connection to make it work.
44
::

ddtrace/propagation/http.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,8 @@ def inject(self, span_context, headers):
4040
def parent_call():
4141
with tracer.trace("parent_span") as span:
4242
headers = {}
43-
HTTPPropagator.inject(span.context, headers)
43+
propagator = HTTPPropagator()
44+
propagator.inject(span.context, headers)
4445
url = "<some RPC endpoint>"
4546
r = requests.get(url, headers=headers)
4647
@@ -92,7 +93,8 @@ def extract(self, headers):
9293
from ddtrace.propagation.http import HTTPPropagator
9394
9495
def my_controller(url, headers):
95-
context = HTTPPropagator.extract(headers)
96+
propagator = HTTPPropagator()
97+
context = propagator.extract(headers)
9698
tracer.context_provider.activate(context)
9799
98100
with tracer.trace("my_controller") as span:

docs/_templates/nav.html

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
{{ toctree(includehidden=theme_sidebar_includehidden, collapse=theme_sidebar_collapse) }}
2+
{% if theme_extra_nav_links %}
3+
<hr />
4+
<ul>
5+
{% for text, uri in theme_extra_nav_links.items() %}
6+
<li class="toctree-l1"><a href="{{ uri }}">{{ text }}</a></li>
7+
{% endfor %}
8+
</ul>
9+
{% endif %}

0 commit comments

Comments
 (0)