datadog-dynamic-instrumentation

This playground provides an environment to showcase: (a) tracing Python micro-services, (b) how adding delay to services (upstream and downstream) affects the latency metric, trace.<SPAN_NAME>, and (c) Datadog's Remote Configuration features.

It spins up three containers, a Redis instance, and a Datadog Agent:

  • upstream which will appear as upstream-flask in Datadog.
  • downstream which will appear as downstream-flask.
  • traffic sends requests to upstream-flask to simulate traffic.

Requirements

Getting Started

There's limited setup, we just need to add and API key:

  1. Head over to the API keys page (US or EU depending on your organizations's Datadog site).
  2. Create a new API key and give it a name of your choice.
  3. Substitute your API key in the command below with the key you just created — it does not require quotation marks.
  4. Similarly, substitute <datadoghq.com|datadoghq.eu> with the respective site (e.g DD_SITE=datadoghq.eu).
make init DD_API_KEY=<your API key> DD_SITE=<datadoghq.com|datadoghq.eu>

Now that we've added an API key, let's double-check that we can start up the services (i.e. containers) defined in our Docker Compose file. To start up the services, run:

make up

About a couple of minutes after doing this, you should see traces coming through in your Datadog account.

If you'd like to take a look at the logs, you can run:

make logs

To stop the services, run:

make destroy

Usage

  • GET http://localhost:8100/delay/<float> — will add a delay of <float> to the upstream service (e.g. GET http://localhost:8100/delay/0.25 will set a delay of 0.25 in the upstream service).
  • GET http://localhost:8110/delay/<float> - same behavior as above but for the downstream service.