Skip to content

Commit 758f02d

Browse files
authored
[docs] add Flask configuration documentation (#734)
1 parent 22bd495 commit 758f02d

File tree

1 file changed

+58
-0
lines changed

1 file changed

+58
-0
lines changed

ddtrace/contrib/flask/__init__.py

Lines changed: 58 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,64 @@ def index():
2727
2828
ddtrace-run python app.py
2929
30+
31+
Configuration
32+
~~~~~~~~~~~~~
33+
34+
.. py:data:: ddtrace.config.flask['distributed_tracing_enabled']
35+
36+
Whether to parse distributed tracing headers from requests received by your Flask app.
37+
38+
Default: ``False``
39+
40+
.. py:data:: ddtrace.config.flask['service_name']
41+
42+
The service name reported for your Flask app.
43+
44+
Can also be configured via the ``DATADOG_SERVICE_NAME`` environment variable.
45+
46+
Default: ``'flask'``
47+
48+
.. py:data:: ddtrace.config.flask['collect_view_args']
49+
50+
Whether to add request tags for view function argument values.
51+
52+
Default: ``True``
53+
54+
.. py:data:: ddtrace.config.flask['template_default_name']
55+
56+
The default template name to use when one does not exist.
57+
58+
Default: ``<memory>``
59+
60+
.. py:data:: ddtrace.config.flask['trace_signals']
61+
62+
Whether to trace Flask signals (``before_request``, ``after_request``, etc).
63+
64+
Default: ``True``
65+
66+
.. py:data:: ddtrace.config.flask['extra_error_codes']
67+
68+
A list of response codes that should get marked as errors.
69+
70+
*5xx codes are always considered an error.*
71+
72+
Default: ``[]``
73+
74+
75+
Example::
76+
77+
from ddtrace import config
78+
79+
# Enable distributed tracing
80+
config.flask['distributed_tracing_enabled'] = True
81+
82+
# Override service name
83+
config.flask['service_name'] = 'custom-service-name'
84+
85+
# Report 401, and 403 responses as errors
86+
config.flask['extra_error_codes'] = [401, 403]
87+
3088
.. __: http://flask.pocoo.org/
3189
"""
3290

0 commit comments

Comments
 (0)