Skip to content

Commit 8a9a7a5

Browse files
authored
Merge pull request #78 from DataDog/awang/doc_cleanup
clarify python docs based on user tests
2 parents 018bb13 + 36a8a90 commit 8a9a7a5

File tree

3 files changed

+27
-9
lines changed

3 files changed

+27
-9
lines changed

ddtrace/contrib/flask/__init__.py

Lines changed: 12 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,26 @@
11
"""
2-
The flask trace middleware will track request timings and templates. It
2+
The Flask trace middleware will track request timings and templates. It
33
requires the `Blinker <https://pythonhosted.org/blinker/>`_ library, which
44
Flask uses for signalling.
55
6-
To install the middleware, do the following::
6+
To install the middleware, add::
7+
8+
from ddtrace import tracer
9+
from ddtrace.contrib.flask import TraceMiddleware
10+
11+
and create a `TraceMiddleware` object::
12+
13+
traced_app = TraceMiddleware(app, tracer, service="my-flask-app")
14+
15+
Here is the end result, in a sample app::
716
817
from flask import Flask
918
import blinker as _
1019
1120
from ddtrace import tracer
1221
from ddtrace.contrib.flask import TraceMiddleware
1322
14-
app = Flask(...)
23+
app = Flask(__name__)
1524
1625
traced_app = TraceMiddleware(app, tracer, service="my-flask-app")
1726

ddtrace/contrib/flask_cache/__init__.py

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,16 @@
22
The flask cache tracer will track any access to a cache backend.
33
You can use this tracer together with the Flask tracer middleware.
44
5-
To install the tracer, do the following::
5+
To install the tracer, ``from ddtrace`` needs to be added::
6+
7+
from ddtrace import tracer
8+
from ddtrace.contrib.flask_cache import get_traced_cache
9+
10+
and the tracer needs to be initialized::
11+
12+
Cache = get_traced_cache(tracer, service='my-flask-cache-app')
13+
14+
Here is the end result, in a sample app::
615
716
from flask import Flask
817

docs/index.rst

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -18,9 +18,11 @@ Install with :code:`pip` but point to Datadog's package repo::
1818

1919
$ pip install ddtrace --find-links=https://s3.amazonaws.com/pypi.datadoghq.com/trace/index.html
2020

21-
If you are using a supported integration, proceed to the :ref:`relevant instructions <integrations>` next.
21+
Quick Start (Auto Instrumentation)
22+
-----------
23+
If you are using a supported integration, proceed to the :ref:`relevant instructions<integrations>` for the integrations you are interested in.
2224

23-
Quick Start
25+
Quick Start (Manual Instrumentation)
2426
-----------
2527

2628
Adding tracing to your code is very simple. As an example, let's imagine we are adding
@@ -33,10 +35,8 @@ tracing from scratch to a small web app::
3335
@route("/home")
3436
def home(request):
3537

36-
with tracer.trace('web.request') as span:
38+
with tracer.trace('web.request', service=service, resource='home') as span:
3739
# set some span metadata
38-
span.service = service
39-
span.resource = "home"
4040
span.set_tag('web.user', request.username)
4141

4242
# trace a database request

0 commit comments

Comments
 (0)