Datadog
medium 27 minDatadog is a hosted monitoring platform.
See it run
The way of a measurement, the flush, the buffer, merged percentiles, sampled traces and counted tags.
Operations
From code to chart
A request is measured, and a person is called.
Step 1 of 5
Measure
The service sends one small UDP packet to the Agent on the same host, and answers the customer.
Step 1: Measure
def handle(request): start = now() answer = work(request) statsd.distribution("request_ms", now() - start, TAGS) return answerdef agent_every_10s(): https_post(site, compress(flush()))- How often
- About every 10 s
- What it costs
- Tags and points
The connection always starts at the Agent.
In the real world
The same datadog doing real jobs. Pick one and step through it.
Many nodes, one API server.
Step 1 of 3
Ask once
1 client
The Cluster Agent asks for services, pods and events.
Step 1: Ask once
Common mistakes
The bugs interviewers watch for, with the fix beside each.
An id as a tag
criticalEvery value is a new combination, and it is billed and slow to query.
Wrongstatsd.increment("orders", tags=[f"user:{user_id}"])Rightstatsd.increment("orders", tags=["tier:paid"])log.info("order", extra={"user": user_id})Average of p95
majorPercentiles of hosts cannot be averaged.
Wrongavg:request_ms.95percentile{*}Rightp95:request_ms{*}# a distribution with percentiles onThe wrong site
majorKeys belong to one site. Data for another is refused and charts stay empty.
Wrong# account on EU1site: datadoghq.comRight# account on EU1site: datadoghq.euNo rule for missing data
majorWhen the Agents cannot send, a threshold is never crossed.
Wrongmissing data: show OKfor every monitorRightmissing data: notifyfor the heartbeat of each host groupIndex everything
minorHealth checks and debug lines fill the index and hit the daily quota.
Wrongexclusion filters: noneRightexclude 100% of /healthkeep 5% of 2xx, all errorsarchive everything
Interview tips
How to explain it
- One Agent per host collects.
- It pushes out over HTTPS.
- The service stores, shows and alerts.
Where state lives
- Seconds of data: the Agent.
- Everything else: one Datadog site.
- Raw logs: your own archive.
Reach for it when
- A small team needs all signals.
- Data may leave the network.
- The bill is below the cost of running it.
Before production
- env, service, version everywhere.
- Budget alerts on usage.
- One independent probe.