-
Notifications
You must be signed in to change notification settings - Fork 1.4k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Adds ability to Trace "check" function with DD APM #2079
Changes from all commits
f3ec6eb
c9db207
03de80c
b292353
d32c71e
a7929c0
bd5cda1
3542d64
30ea20e
9c290e8
5dc1d65
795a955
67bd02b
5dc4ae7
a4272b4
b78c054
6d5def7
278f38c
1a7945f
e827bd5
55e85e5
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,12 @@ | ||
# (C) Datadog, Inc. 2018 | ||
# All rights reserved | ||
# Licensed under a 3-clause BSD style license (see LICENSE) | ||
|
||
try: | ||
import datadog_agent | ||
if datadog_agent.get_config('integration_tracing'): | ||
from ddtrace import patch | ||
patch(requests=True) | ||
except ImportError: | ||
# Tracing Integrations is only available with Agent 6 | ||
pass |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
# (C) Datadog, Inc. 2018 | ||
# All rights reserved | ||
# Licensed under Simplified BSD License (see LICENSE) | ||
|
||
from ..config import is_affirmative | ||
from ddtrace import tracer | ||
|
||
import wrapt | ||
|
||
try: | ||
import datadog_agent | ||
except ImportError: | ||
# Integration Tracing is only available with Agent 6 | ||
datadog_agent = None | ||
|
||
|
||
_tracing_config = set() | ||
|
||
def add_trace_check(check_object): | ||
_tracing_config.add(check_object) | ||
|
||
@wrapt.decorator | ||
def traced(wrapped, instance, args, kwargs): | ||
if datadog_agent is None: | ||
return wrapped(*args, **kwargs) | ||
|
||
trace_check = instance in _tracing_config | ||
integration_tracing = is_affirmative(datadog_agent.get_config('integration_tracing')) | ||
|
||
if integration_tracing and trace_check: | ||
with tracer.trace('integration.check', service='integrations-tracing', resource=instance.name): | ||
return wrapped(*args, **kwargs) | ||
|
||
return wrapped(*args, **kwargs) |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,8 @@ | ||
ddtrace==0.13.0 | ||
prometheus-client==0.3.0 | ||
requests==2.19.1 | ||
protobuf==3.5.1 | ||
requests==2.19.1 | ||
simplejson==3.6.5 | ||
six==1.11.0 | ||
uptime==3.0.1 | ||
uuid==1.30 | ||
six==1.11.0 |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -12,10 +12,15 @@ chardet==3.0.4 \ | |
--hash=sha256:84ab92ed1c4d4f16916e05906b6b75a6c0fb5db821cc65e70cbd64a3e2a5eaae \ | ||
--hash=sha256:fc323ffcaeaed0e0a02bf4d117757b98aed530d9ed4531e3e15460124c106691 \ | ||
# via requests | ||
ddtrace==0.12.1 \ | ||
--hash=sha256:f77a7367c43e3d58cb106519a61b3a137d774835f37f768979726a47e18ba11c | ||
idna==2.7 \ | ||
--hash=sha256:156a6814fb5ac1fc6850fb002e0852d56c0c8d2531923a51032d1b70760e186e \ | ||
--hash=sha256:684a38a6f903c1d71d6d5fac066b58d7768af4de2b832e426ec79c30daa94a16 \ | ||
# via requests | ||
msgpack-python==0.5.6 \ | ||
--hash=sha256:378cc8a6d3545b532dfd149da715abae4fda2a3adb6d74e525d0d5e51f46909b \ | ||
# via ddtrace | ||
prometheus-client==0.3.0 \ | ||
--hash=sha256:69494dc1ac967c0f626c8193e439755c2b95dd4ed22ef31c277601778a50c7ff | ||
protobuf==3.5.1 \ | ||
|
@@ -42,3 +47,6 @@ urllib3==1.23 \ | |
# via requests | ||
uuid==1.30 \ | ||
--hash=sha256:1f87cc004ac5120466f36c5beae48b4c48cc411968eed0eaecd3da82aa96193f | ||
wrapt==1.10.11 \ | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Since it's here, I'd use it.
No need for There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I'll give that a look, thanks! |
||
--hash=sha256:d4d560d479f2c21e1b5443bbd15fe7ec4b37fe7e53d335d3b9b0a7b1226fe3c6 \ | ||
# via ddtrace |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +0,0 @@ | ||
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do we plan to make this configurable? Or we just add the modules we want auto-instrumentation for as long as we need them? (to be clear, potentially having in the future something like
patch(requests=True, psycopg=True, redis=True)
orpatch_all()
directly)There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thats what I had in mind with this. We can always make it configurable later from datadog.yaml by having something like:
But for now I think this is OK to just include the things we need globally here.