Skip to content
This repository was archived by the owner on Apr 22, 2022. It is now read-only.
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
110 commits
Select commit Hold shift + click to select a range
234e563
test: remove unneeded deps listing
brettlangdon Nov 4, 2019
a910a09
Remove quote enforcement
jd Nov 12, 2019
3609970
Add flake8-blind-except
jd Nov 12, 2019
07a3db8
flake8: ignore no error
jd Nov 12, 2019
f736e8c
Add flake8-builtins
jd Nov 12, 2019
d15b79d
Add flake8-logging-format
jd Nov 12, 2019
aaae149
Enable flake8-rst-docstrings
jd Nov 12, 2019
8cc13aa
flake8: enable flake8-docstrings
jd Nov 13, 2019
7bc0f21
internal: use histogram and counters for metrics (#1134)
brettlangdon Nov 15, 2019
2533ee9
internal: move health metrics enabled to config (#1135)
brettlangdon Nov 16, 2019
b173dbf
Merge branch 'master' into better-flake8
majorgreys Nov 18, 2019
e1b0893
ci: add black step to ci (#1137)
brettlangdon Nov 18, 2019
801254e
Merge branch 'master' into better-flake8
majorgreys Nov 18, 2019
2b0d396
Fixing sqlalchemy test failures (#1138)
codeboten Nov 18, 2019
7a46902
Merge branch 'master' into better-flake8
jd Nov 18, 2019
47396c6
Merge pull request #1132 from jd/better-flake8
jd Nov 19, 2019
db79781
Merge branch 'master' into brettlangdon/tox.cleanup
jd Nov 19, 2019
c2a483d
Merge pull request #1124 from DataDog/brettlangdon/tox.cleanup
jd Nov 19, 2019
e73da92
internal: use debtcollector for keyword argument warnings (#1147)
majorgreys Nov 22, 2019
a4b4534
core: deprecate unused app type (#1144)
majorgreys Nov 25, 2019
b90be8f
pin multidict dependency for aiobotocore02 tests (#1145)
Nov 26, 2019
12e48eb
vendor: fix debtcollector imports (#1152)
majorgreys Nov 27, 2019
0f3a62c
core: common span types and revise language tag (#1150)
majorgreys Dec 3, 2019
2c1f376
Start black formatting some files (#1141)
brettlangdon Dec 3, 2019
b50462e
Add support for dogpile.cache (#1123)
Dec 4, 2019
f13e9a7
core: Change DatadogSampler defaults (#1151)
brettlangdon Dec 11, 2019
cee5629
bottle: fix status code for responses (#1158)
majorgreys Dec 11, 2019
2dbc7d8
core: Deprecate ddtrace.ext.AppTypes (#1162)
brettlangdon Dec 18, 2019
5ea6a4f
core: safely deprecate ext type constants (#1165)
majorgreys Dec 20, 2019
a5d2186
core: fix new sampler defaults and add env variables to configure (#1…
brettlangdon Dec 20, 2019
6b4a62c
internal: Set numeric tags on Span.metrics instead of Span.meta
brettlangdon Dec 30, 2019
564ac41
Merge pull request #1169 from DataDog/brettlangdon/numeric.tags
brettlangdon Dec 31, 2019
abc6511
core: default to DatadogSampler
brettlangdon Jan 8, 2020
7aabb17
removed unused import
brettlangdon Jan 8, 2020
860f4b4
encode python in the install_requires string
JBKahn Jan 9, 2020
409330d
Merge pull request #1174 from JBKahn/patch-3
brettlangdon Jan 9, 2020
4a49501
not install enum34 for Python 3.4
majorgreys Jan 9, 2020
abe0ce4
Merge pull request #1175 from DataDog/majorgreys/enum34
brettlangdon Jan 9, 2020
c5d21da
add funcsigs backport to install
majorgreys Jan 9, 2020
4022b8a
copy from debtcollector's requirements
majorgreys Jan 9, 2020
a2f1697
Merge pull request #1176 from DataDog/majorgreys/funcsigs
brettlangdon Jan 9, 2020
6f8be58
tests: Fix botocore py34 tests
brettlangdon Jan 9, 2020
8cbd426
Merge branch 'master' into brettlangdon/pyyaml.botocore
brettlangdon Jan 9, 2020
21dda97
Merge pull request #1177 from DataDog/brettlangdon/pyyaml.botocore
brettlangdon Jan 13, 2020
1650cf4
Merge branch 'master' into brettlangdon/fallback.sampling
brettlangdon Jan 13, 2020
7035796
default rate limit of 100, always set span.sampled = True
brettlangdon Jan 13, 2020
99b86fb
Apply suggestions from code review
brettlangdon Jan 14, 2020
a87d66d
fix flake8
brettlangdon Jan 14, 2020
43ad608
Merge pull request #1172 from DataDog/brettlangdon/fallback.sampling
brettlangdon Jan 14, 2020
e5c50bb
Improve tracer.trace docs
adamchainz Jan 14, 2020
89942d4
Merge pull request #1180 from adamchainz/patch-2
brettlangdon Jan 14, 2020
0474798
Dual License
jeremy-lq Jan 14, 2020
b1d95cd
Dual License
jeremy-lq Jan 14, 2020
2f9c827
Merge pull request #1181 from DataDog/jeremy.g/dual-license
brettlangdon Jan 14, 2020
c138cfb
core: ensure http.status_code is always set as str on meta
brettlangdon Jan 15, 2020
30c4a3f
fix flake8
brettlangdon Jan 15, 2020
a923768
update missed assertions
brettlangdon Jan 15, 2020
11eea43
fix flask test
brettlangdon Jan 15, 2020
e8195a6
Merge pull request #1182 from DataDog/brettlangdon/http.status_code.meta
brettlangdon Jan 15, 2020
b4aaa29
Prefer random.getrandbits on Python 3+, fall back to urandom implemen…
thieman Jan 22, 2020
85b941d
tests: fix botocore tests on py3.4 (#1189)
brettlangdon Feb 3, 2020
db35ad1
black: ddtrace/bootstrap (#1187)
brettlangdon Feb 3, 2020
bda7a6c
black: ddtrace/utils/ (#1188)
brettlangdon Feb 3, 2020
7125e74
black: ddtrace/internal/ (#1190)
brettlangdon Feb 3, 2020
7594f01
internal: Refactor setup.py c-extension building (#1191)
brettlangdon Feb 3, 2020
1e87c9b
chord(flake8,black): ignore W504 and E231 not respected by black (#1185)
jd Feb 3, 2020
7691e90
fix(writer): start thread as late as possible (#1193)
jd Feb 7, 2020
7d92f7c
internal: Vendor psutil dependency (#1160)
brettlangdon Feb 10, 2020
140b953
tests: Run django_contrib and django_drf_contrib tests separately (#1…
brettlangdon Feb 11, 2020
f0746c3
[django] New Django Integration (#1161)
Kyle-Verhoog Feb 11, 2020
8158e25
fix(ci): limit Werkzeug to <1 for old Flask version
jd Feb 12, 2020
3aed51f
Merge pull request #1201 from jd/fix-flask-tests-werkzeug1
jd Feb 12, 2020
d69475c
fix(tox): flake8 does not need to install (#1200)
jd Feb 12, 2020
e1d9eab
core: unvendor msgpack (#1199)
majorgreys Feb 12, 2020
30ffa83
chord(encoding): remove unnused global variable
jd Feb 13, 2020
20be025
refactor(encoding): simplify msgpack/json encoders
jd Feb 13, 2020
abb0902
refactor(encoding): msgpack is a dependency, don't "try" to import it
jd Feb 13, 2020
839b582
fix(setup): set minimum msgpack version we support
jd Feb 13, 2020
12de872
ci(tox): do not install ddtrace for running black (#1204)
jd Feb 13, 2020
406bd0b
ci(wait): do not install ddtrace in the wait target
jd Feb 13, 2020
37df329
ci(docs): modernize documentation building
jd Feb 13, 2020
3aa79dc
Merge pull request #1207 from jd/fix-wait
jd Feb 13, 2020
9ca8596
Merge branch 'master' into update-doc-target
jd Feb 13, 2020
89833eb
Merge pull request #1205 from jd/update-doc-target
jd Feb 14, 2020
32dbbf4
ci(update): use standard Python images for black and flake8 jobs
jd Feb 13, 2020
ae9ea2f
ci(docs): fix deploy_dev target for releasing docs (#1212)
jd Feb 14, 2020
4653e97
utils: Update get_env to support any number of parts (#1208)
brettlangdon Feb 14, 2020
2d33d80
Merge branch 'master' into use-standard-python-img
brettlangdon Feb 14, 2020
9d896c3
tests: fix ordering of PYTHONPATH (#1210)
brettlangdon Feb 14, 2020
d2d2af6
Merge branch 'master' into use-standard-python-img
brettlangdon Feb 14, 2020
da6e87e
Merge pull request #1206 from jd/use-standard-python-img
jd Feb 14, 2020
00ac506
ci(update) use standard Python image for test_build job (#1209)
brettlangdon Feb 14, 2020
eac7442
ci(tox): remove useless basepython specifiers (#1214)
jd Feb 17, 2020
3251f93
Merge branch 'master' into clean-msgpack
majorgreys Feb 17, 2020
9ced4ec
ci: rework .circleci/config.yml (#1213)
brettlangdon Feb 17, 2020
492d454
Merge branch 'master' into clean-msgpack
majorgreys Feb 17, 2020
d1e26e7
Merge pull request #1202 from jd/clean-msgpack
jd Feb 18, 2020
69cd010
core: Set _dd.measured tag on integration spans (#1196)
brettlangdon Feb 18, 2020
40af970
Support msgpack 1.0.0 (#1216)
jd Feb 19, 2020
47d96b2
fix(encoding): always return bytes when decoding (#1220)
jd Feb 20, 2020
50b3170
fix(tests): use encoder decode in tests (#1221)
majorgreys Feb 21, 2020
8852b97
fix(tox): do not skip install for docs
majorgreys Feb 20, 2020
40da729
fix: treat spinx warnings as errors
majorgreys Feb 20, 2020
4c9d6c9
fix: fix sphinx errors
majorgreys Feb 20, 2020
e5af3b8
fix: typo
majorgreys Feb 21, 2020
f8ff030
Merge pull request #1218 from DataDog/majorgreys/fix-tox-docs
jd Feb 21, 2020
1487db6
Merge tag 'v0.34.0'
Feb 21, 2020
6a5d184
lint/black fixes
Mar 3, 2020
02ad6a0
fix docs and django builds
Mar 4, 2020
74c637b
ci: requires virtualenv < 20
jd Feb 26, 2020
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
1,292 changes: 528 additions & 764 deletions .circleci/config.yml

Large diffs are not rendered by default.

26 changes: 4 additions & 22 deletions LICENSE
Original file line number Diff line number Diff line change
@@ -1,24 +1,6 @@
Copyright (c) 2016, Datadog <info@datadoghq.com>
All rights reserved.
## License

Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are met:
* Redistributions of source code must retain the above copyright
notice, this list of conditions and the following disclaimer.
* Redistributions in binary form must reproduce the above copyright
notice, this list of conditions and the following disclaimer in the
documentation and/or other materials provided with the distribution.
* Neither the name of Datadog nor the
names of its contributors may be used to endorse or promote products
derived from this software without specific prior written permission.
This work is dual-licensed under Apache 2.0 or BSD3.
You may select, at your option, one of the above-listed licenses.

THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
DISCLAIMED. IN NO EVENT SHALL DATADOG BE LIABLE FOR ANY
DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
`SPDX-License-Identifier: Apache-2.0 OR BSD-3-Clause`
200 changes: 200 additions & 0 deletions LICENSE.Apache
Original file line number Diff line number Diff line change
@@ -0,0 +1,200 @@
Apache License
Version 2.0, January 2004
http://www.apache.org/licenses/

TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION

1. Definitions.

"License" shall mean the terms and conditions for use, reproduction,
and distribution as defined by Sections 1 through 9 of this document.

"Licensor" shall mean the copyright owner or entity authorized by
the copyright owner that is granting the License.

"Legal Entity" shall mean the union of the acting entity and all
other entities that control, are controlled by, or are under common
control with that entity. For the purposes of this definition,
"control" means (i) the power, direct or indirect, to cause the
direction or management of such entity, whether by contract or
otherwise, or (ii) ownership of fifty percent (50%) or more of the
outstanding shares, or (iii) beneficial ownership of such entity.

"You" (or "Your") shall mean an individual or Legal Entity
exercising permissions granted by this License.

"Source" form shall mean the preferred form for making modifications,
including but not limited to software source code, documentation
source, and configuration files.

"Object" form shall mean any form resulting from mechanical
transformation or translation of a Source form, including but
not limited to compiled object code, generated documentation,
and conversions to other media types.

"Work" shall mean the work of authorship, whether in Source or
Object form, made available under the License, as indicated by a
copyright notice that is included in or attached to the work
(an example is provided in the Appendix below).

"Derivative Works" shall mean any work, whether in Source or Object
form, that is based on (or derived from) the Work and for which the
editorial revisions, annotations, elaborations, or other modifications
represent, as a whole, an original work of authorship. For the purposes
of this License, Derivative Works shall not include works that remain
separable from, or merely link (or bind by name) to the interfaces of,
the Work and Derivative Works thereof.

"Contribution" shall mean any work of authorship, including
the original version of the Work and any modifications or additions
to that Work or Derivative Works thereof, that is intentionally
submitted to Licensor for inclusion in the Work by the copyright owner
or by an individual or Legal Entity authorized to submit on behalf of
the copyright owner. For the purposes of this definition, "submitted"
means any form of electronic, verbal, or written communication sent
to the Licensor or its representatives, including but not limited to
communication on electronic mailing lists, source code control systems,
and issue tracking systems that are managed by, or on behalf of, the
Licensor for the purpose of discussing and improving the Work, but
excluding communication that is conspicuously marked or otherwise
designated in writing by the copyright owner as "Not a Contribution."

"Contributor" shall mean Licensor and any individual or Legal Entity
on behalf of whom a Contribution has been received by Licensor and
subsequently incorporated within the Work.

2. Grant of Copyright License. Subject to the terms and conditions of
this License, each Contributor hereby grants to You a perpetual,
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
copyright license to reproduce, prepare Derivative Works of,
publicly display, publicly perform, sublicense, and distribute the
Work and such Derivative Works in Source or Object form.

3. Grant of Patent License. Subject to the terms and conditions of
this License, each Contributor hereby grants to You a perpetual,
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
(except as stated in this section) patent license to make, have made,
use, offer to sell, sell, import, and otherwise transfer the Work,
where such license applies only to those patent claims licensable
by such Contributor that are necessarily infringed by their
Contribution(s) alone or by combination of their Contribution(s)
with the Work to which such Contribution(s) was submitted. If You
institute patent litigation against any entity (including a
cross-claim or counterclaim in a lawsuit) alleging that the Work
or a Contribution incorporated within the Work constitutes direct
or contributory patent infringement, then any patent licenses
granted to You under this License for that Work shall terminate
as of the date such litigation is filed.

4. Redistribution. You may reproduce and distribute copies of the
Work or Derivative Works thereof in any medium, with or without
modifications, and in Source or Object form, provided that You
meet the following conditions:

(a) You must give any other recipients of the Work or
Derivative Works a copy of this License; and

(b) You must cause any modified files to carry prominent notices
stating that You changed the files; and

(c) You must retain, in the Source form of any Derivative Works
that You distribute, all copyright, patent, trademark, and
attribution notices from the Source form of the Work,
excluding those notices that do not pertain to any part of
the Derivative Works; and

(d) If the Work includes a "NOTICE" text file as part of its
distribution, then any Derivative Works that You distribute must
include a readable copy of the attribution notices contained
within such NOTICE file, excluding those notices that do not
pertain to any part of the Derivative Works, in at least one
of the following places: within a NOTICE text file distributed
as part of the Derivative Works; within the Source form or
documentation, if provided along with the Derivative Works; or,
within a display generated by the Derivative Works, if and
wherever such third-party notices normally appear. The contents
of the NOTICE file are for informational purposes only and
do not modify the License. You may add Your own attribution
notices within Derivative Works that You distribute, alongside
or as an addendum to the NOTICE text from the Work, provided
that such additional attribution notices cannot be construed
as modifying the License.

You may add Your own copyright statement to Your modifications and
may provide additional or different license terms and conditions
for use, reproduction, or distribution of Your modifications, or
for any such Derivative Works as a whole, provided Your use,
reproduction, and distribution of the Work otherwise complies with
the conditions stated in this License.

5. Submission of Contributions. Unless You explicitly state otherwise,
any Contribution intentionally submitted for inclusion in the Work
by You to the Licensor shall be under the terms and conditions of
this License, without any additional terms or conditions.
Notwithstanding the above, nothing herein shall supersede or modify
the terms of any separate license agreement you may have executed
with Licensor regarding such Contributions.

6. Trademarks. This License does not grant permission to use the trade
names, trademarks, service marks, or product names of the Licensor,
except as required for reasonable and customary use in describing the
origin of the Work and reproducing the content of the NOTICE file.

7. Disclaimer of Warranty. Unless required by applicable law or
agreed to in writing, Licensor provides the Work (and each
Contributor provides its Contributions) on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
implied, including, without limitation, any warranties or conditions
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
PARTICULAR PURPOSE. You are solely responsible for determining the
appropriateness of using or redistributing the Work and assume any
risks associated with Your exercise of permissions under this License.

8. Limitation of Liability. In no event and under no legal theory,
whether in tort (including negligence), contract, or otherwise,
unless required by applicable law (such as deliberate and grossly
negligent acts) or agreed to in writing, shall any Contributor be
liable to You for damages, including any direct, indirect, special,
incidental, or consequential damages of any character arising as a
result of this License or out of the use or inability to use the
Work (including but not limited to damages for loss of goodwill,
work stoppage, computer failure or malfunction, or any and all
other commercial damages or losses), even if such Contributor
has been advised of the possibility of such damages.

9. Accepting Warranty or Additional Liability. While redistributing
the Work or Derivative Works thereof, You may choose to offer,
and charge a fee for, acceptance of support, warranty, indemnity,
or other liability obligations and/or rights consistent with this
License. However, in accepting such obligations, You may act only
on Your own behalf and on Your sole responsibility, not on behalf
of any other Contributor, and only if You agree to indemnify,
defend, and hold each Contributor harmless for any liability
incurred by, or claims asserted against, such Contributor by reason
of your accepting any such warranty or additional liability.

END OF TERMS AND CONDITIONS

APPENDIX: How to apply the Apache License to your work.

To apply the Apache License to your work, attach the following
boilerplate notice, with the fields enclosed by brackets "{}"
replaced with your own identifying information. (Don't include
the brackets!) The text should be enclosed in the appropriate
comment syntax for the file format. We also recommend that a
file or class name and description of purpose be included on the
same "printed page" as the copyright notice for easier
identification within third-party archives.

Copyright 2016 Datadog, Inc.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
24 changes: 24 additions & 0 deletions LICENSE.BSD3
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
Copyright (c) 2016, Datadog <info@datadoghq.com>
All rights reserved.

Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are met:
* Redistributions of source code must retain the above copyright
notice, this list of conditions and the following disclaimer.
* Redistributions in binary form must reproduce the above copyright
notice, this list of conditions and the following disclaimer in the
documentation and/or other materials provided with the distribution.
* Neither the name of Datadog nor the
names of its contributors may be used to endorse or promote products
derived from this software without specific prior written permission.

THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
DISCLAIMED. IN NO EVENT SHALL DATADOG BE LIABLE FOR ANY
DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
4 changes: 4 additions & 0 deletions NOTICE
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
Datadog dd-trace-py
Copyright 2016-Present Datadog, Inc.

This product includes software developed at Datadog, Inc. (https://www.datadoghq.com/).
8 changes: 0 additions & 8 deletions Rakefile
Original file line number Diff line number Diff line change
@@ -1,11 +1,3 @@
desc "build the docs"
task :docs do
sh "pip install sphinx"
Dir.chdir 'docs' do
sh "make html"
end
end

# Deploy tasks
S3_DIR = ENV['S3_DIR']
S3_BUCKET = "pypi.datadoghq.com"
Expand Down
4 changes: 2 additions & 2 deletions conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@

import pytest

PY_DIR_PATTERN = re.compile(r'^py[23][0-9]$')
PY_DIR_PATTERN = re.compile(r"^py[23][0-9]$")


# Determine if the folder should be ignored
Expand Down Expand Up @@ -48,7 +48,7 @@ def pytest_ignore_collect(path, config):
# Directory name match `py[23][0-9]`
if PY_DIR_PATTERN.match(dirname):
# Split out version numbers into a tuple: `py35` -> `(3, 5)`
min_required = tuple((int(v) for v in dirname.strip('py')))
min_required = tuple((int(v) for v in dirname.strip("py")))

# If the current Python version does not meet the minimum required, skip this directory
if sys.version_info[0:2] < min_required:
Expand Down
6 changes: 3 additions & 3 deletions ddtrace/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,10 +27,10 @@
_ORIGINAL_EXCEPTHOOK = sys.excepthook


def _excepthook(type, value, traceback):
tracer.global_excepthook(type, value, traceback)
def _excepthook(tp, value, traceback):
tracer.global_excepthook(tp, value, traceback)
if _ORIGINAL_EXCEPTHOOK:
return _ORIGINAL_EXCEPTHOOK(type, value, traceback)
return _ORIGINAL_EXCEPTHOOK(tp, value, traceback)


def install_excepthook():
Expand Down
4 changes: 3 additions & 1 deletion ddtrace/_worker.py
Original file line number Diff line number Diff line change
Expand Up @@ -32,13 +32,14 @@ def __init__(self, interval=_DEFAULT_INTERVAL, exit_timeout=None, name=None, dae
self._thread = threading.Thread(target=self._target, name=name)
self._thread.daemon = daemon
self._stop = threading.Event()
self.started = False
self.interval = interval
self.exit_timeout = exit_timeout
atexit.register(self._atexit)

def _atexit(self):
self.stop()
if self.exit_timeout is not None:
if self.exit_timeout is not None and self.started:
key = 'ctrl-break' if os.name == 'nt' else 'ctrl-c'
_LOG.debug(
'Waiting %d seconds for %s to finish. Hit %s to quit.',
Expand All @@ -50,6 +51,7 @@ def start(self):
"""Start the periodic worker."""
_LOG.debug('Starting %s thread', self._thread.name)
self._thread.start()
self.started = True

def stop(self):
"""Stop the worker."""
Expand Down
8 changes: 4 additions & 4 deletions ddtrace/api.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
import socket

# project
from .encoding import get_encoder, JSONEncoder
from .encoding import Encoder, JSONEncoder
from .compat import httplib, PYTHON_VERSION, PYTHON_INTERPRETER, get_connection_response
from .internal.logger import get_logger
from .internal.runtime import container
Expand Down Expand Up @@ -84,8 +84,8 @@ def get_json(self):
return

return loads(body)
except (ValueError, TypeError) as err:
log.debug('Unable to parse Datadog Agent JSON response: %s %r', err, body)
except (ValueError, TypeError):
log.debug('Unable to parse Datadog Agent JSON response: %r', body, exc_info=True)

def __repr__(self):
return '{0}(status={1!r}, body={2!r}, reason={3!r}, msg={4!r})'.format(
Expand Down Expand Up @@ -185,7 +185,7 @@ def _set_version(self, version, encoder=None):
if self._compatibility_mode:
self._encoder = JSONEncoder()
else:
self._encoder = encoder or get_encoder()
self._encoder = encoder or Encoder()
# overwrite the Content-type with the one chosen in the Encoder
self._headers.update({'Content-Type': self._encoder.content_type})

Expand Down
Loading