The CDL Python SDK implements logging for the
Credentials classes. All other logging originates fro the underlying
urllib3 libraries. Additionally, the
HTTPClient and upstream API gateway include support for cross-application tracing.
If you're interested in seeing only the CDL Python SDK and underlying library debug logs, add the following to your project:
Add the following to your project to enable HTTP debugging that includes request headers and payloads:
Full HTTP Debugging
Full debugging logging works best when dealing with relatively small responses.
Interested in seeing both HTTP request and response payloads? Make sure you keep your
Installing Requests Toolbelt
Start, by install the
requests toolbelt library:
Define Logging Hook
Now, add the following somewhere in your CDL Python SDK client code:
Invoke Logging Hook
Next, let's pass our
logging_hook function to our
QueryService object so we can watch the magic happen:
Brace yourself for the flood of data coming your way!
So, there you have it - probably all the debug logging you'll ever need, and somehow more.
For more information on Envoy distributed tracing, see the following documentation.
Distributed tracing allows developers to track call flows in order to better understand serialization, parallelism, sources of latency and, most of all, to aid in troubleshooting. Luckily, the Cortex Data Lake API and the CDL Python SDK come equipped with cross-application tracing capabilities.
The CDL API implements tracing internally, by default. Although it's possible to (painfully?) correlate your client calls with backend calls, sometimes it's preferred to force them to appear in your debug logs so you can refer to them directly. This could, potentially, help speed up the troubleshooting process - should an issue arise that requires our backend engineers to investigate.
Ok, let's cut to the chase. Here's how to force tracing using the CDL Python SDK:
That's it, really. Now, you'll notice your response headers all include an
x-request-id, that can be used to reference a particular call.