Datadog Fake Intake
Exposes a catch-all API for Datadog Agent POST requests.
Requirements
How to run
Locally
- cd to fake-intake root folder
cd ~/dd/datadog-agent/test/fake-intake
- Build the fake-intake app
go build
- Run the fake-intake
./fake-intake
- Configure Datadog Agent to use fake intake
# datadog.yaml
DD_DD_URL: "http://localhost:8080"
Docker
- cd to fake-intake root folder
cd ~/dd/datadog-agent/test/fake-intake
- Start the docker container
docker compose up
- Configure Datadog Agent to use fake intake
# datadog.yaml
DD_DD_URL: "http://localhost:8080"
How to build
🐳 Docker, locally
- Ensure you are using buildx
desktop-linux
driver
docker buildx create --use desktop-linux
- Build a new multi-arch image using
buildx
. This will allow the container to run on both MacOS M1 (arm64) and Linux (amd64).
docker buildx build --push --platform linux/arm64/v8,linux/amd64 --tag <repo_name>/fake-intake:<tag> .
API
Get payloads
Returns all payloads submitted to a POST endpoint as byte arrays, encoded in base64.
Response
{
"payloads": [][]byte
}
Example:
{
"payloads": [
"dG90b3JvfDI1fG93bmVyOmtpa2k=" // use `b64.StdEncoding.DecodeString(str)` in golang or base64.b64decode(str) in python
]
}
curl
curl ${SERVICE_IP}/fake/payloads/{post_endpoint_path}
Example:
curl ${SERVICE_IP}/fake/payloads/api/V2/series
Juniper Notebook
Play with fake-intake in a Juniper Notebook
# POST payloads
import base64
import requests
import json
data = "totoro|25|owner:kiki"
response = requests.post("http://localhost:8080/api/v2/series", data)
json_content = response.content.decode('utf8')
print(json_content)
# GET payloads
import base64
import requests
import json
response = requests.get("http://localhost:8080/fake/payloads/api/v2/series")
json_content = response.content.decode('utf8')
data = json.loads(json_content)
print(data)
print("==== Payloads ====")
for payload in data["payloads"]:
print(base64.b64decode(payload))
Development in VSCode
This is a sub-module within datadog-agent
. VSCode will complain about the multiple go.mod
files. While waiting for a full repo migration to go workspaces, create a go workspace file and add test/fake-intake
to workspaces
go work init
go work use . ./test/fake-intake
Note
go.work
file is currently ignored in datadog-agent