Steganography at scale: Embedding share URLs in Datadog widget screenshots (opens in new tab)
Datadog developed invisible pixel-level watermarks so screenshots can retain the context normally preserved by share links. The system embeds a compact widget snapshot ID into a widget’s border, while the full metadata remains in a Redis cache. This approach preserves screenshots’ convenience while enabling recovery of queries, time ranges, settings, and deep links at Datadog’s scale.
Share Links Versus Screenshots
- Copying a Datadog widget creates a backend record and places a unique share URL in the clipboard.
- Pasting the URL into a dashboard or notebook restores the widget.
- Slack and Teams integrations can render a live preview and link to Graph Explorer.
- Screenshots are easier to use and provide a consistent visual snapshot, but normally lose:
- Time range
- Underlying queries
- Visualization type
- Dashboard state
- Configuration and context
Encoding Only a Snapshot ID
- A complete widget definition averages about 2 kB and may include queries, display settings, legends, time-frame overrides, template variables, dimensions, and deep links.
- Rather than embedding all of that data in the image, Datadog stores it in Redis and embeds only a randomly generated key.
- The frontend generates the snapshot ID optimistically before the cache write completes, allowing watermarking without waiting for a backend response.
- Records are retained for one hour because screenshots are usually shared within seconds or minutes.
- At more than 1 billion widget renders per day, IDs must be compact while avoiding cross-customer collisions.
- Datadog prefixes the cache key with the organization ID. An 8-byte ID provides roughly 2⁶⁴ possible values, producing an estimated collision probability of about 1 in 37 million under the stated usage assumptions.
Watermarking the Widget Border
- Every dashboard widget has a consistent 1-pixel border, making it a reliable location for encoding data regardless of visualization type.
- An initial design represented each bit with a separate colored pixel, but 64 pixels were needed for 8 bytes and could become visible.
- The final design stores data in RGB color adjustments:
- Each pixel encodes up to 9 bits by offsetting the red, green, and blue channels.
- The base color is calculated by subtracting 3 from each channel.
- Channel offsets of up to 7 represent the encoded values.
- Two sentinel pixels, using a
+7/+7/+7offset, mark the beginning and end of the watermark. - Eight pixels between the sentinels encode one byte each:
- 3 bits in red
- 3 bits in green
- 2 highest bits in blue
Design Constraints
- The watermark must remain nearly invisible and avoid adding interface elements.
- It must work across different widget sizes, color profiles, display densities, and copy-paste workflows.
- The border-based method avoids visualization-specific implementations while keeping the encoded region short.
Datadog’s approach combines cached metadata with subtle RGB-level encoding, allowing screenshots to function like context-preserving share links without changing their appearance or the user’s workflow.