Datadog renders about a billion dashboard widgets a day, and people screenshot
// the short version
Datadog renders about a billion dashboard widgets a day, and people screenshot
// what to take away
- A screenshot normally loses the query, time range and dashboard state that produced it.
- Datadog encodes a short Redis key into tiny color changes along the widget border.
- Sentinel pixels locate the payload so a decoder can recover the link from an ordinary screenshot.
// transcript
Screenshots of dashboards are super helpful in the moment for making a point over Slack or Teams, but what if someone wants to take a live look with the same query? Sure, a hyperlink to the dashboard may do the trick, but screenshotting is often an impulse, so what if there was a way to incorporate that link into the image? Datadog found a way to do this with their dashboard widgets. Every widget has a one pixel border in a single flat colour, the only region that's identical across all of them. But a widget definition is 2 kilobytes, far too big to hide. So they hide an 8 byte key instead, and keep the rest in Redis. Version one spent one pixel per bit. Wide enough that you could see the speckle along the border. So they packed 3 bits per pixel, offsetting red, green and blue by 7. And screenshots started decoding wrong because a screenshot isn't the pixels you drew. Open it on a MacBook, where the display remaps to a wider gamut, and every channel shifts by 1. The decoder can't tell a shifted 7 from an 8, so the key comes back corrupt. The fix is to stop decoding exactly. Offset by 3, not 7, then read anything from 1 to 5 as a one, and anything negative as a zero. A remap that shifts by 1 can't push a 3 out of that window. Red and green carry 2 bits per pixel. Blue does something else. Blue marks where the watermark starts and stops. Two sentinel pixels, a fixed distance apart, offset on blue alone. The decoder scans for that pair, because it has no idea what colour to expect: dark mode, high contrast, a screenshot somebody tinted orange. Whatever colour the sentinels are is the baseline everything between them is measured against. A billion widgets render a day, each one watermarked. Paste the screenshot back into Datadog and it resolves to the live widget using the same query, time range and dashboard. Just like clicking the hyperlink would.
// source
This explainer is based on Steganography at scale: Embedding share URLs in Datadog widget screenshots by Datadog ↗. The original reporting and technical work belong to its publisher.