Integrations
Datadog
On this page
What is sent
| NanoFlags event | Datadog event | Alert type |
|---|---|---|
| A revision is published (dashboard, API, CLI or schedule) | NanoFlags: published r42 to Production (Shop) | success |
| A flag is turned off with the kill switch | NanoFlags: kill switch turned new-checkout off in Production (Shop) | warning |
| A change is approved or rejected | NanoFlags: change approved: New checkout (Production, Shop) | success / warning |
| A scheduled publish fails | NanoFlags: scheduled publish of Production failed (Shop) | error |
Each event links back to the change (or the activity log) in NanoFlags. A kill switch is sent once, as the kill-switch event.
Set up
- In Datadog, open Organization Settings → API Keys and create a key (32 characters). Use an API key, not an application key: an API key can only submit data.
- In NanoFlags, open Settings → Integrations → Datadog as an owner or admin.
- Add a destination: a name, your Datadog site (the address you use:
app.datadoghq.comis US1,app.datadoghq.euis EU, also US3, US5, AP1, AP2 and US1-FED), the API key, the events, and optionally the environments and project it covers. - NanoFlags checks the key against the site and posts a test event. Test connection repeats the check at any time.
A destination covers this project or every project of the organization. An organization can have up to 10 destinations, for example one per Datadog organization or per environment.
Tags
| Tag | Example | Meaning |
|---|---|---|
integration:nanoflags | Every NanoFlags event | |
nanoflags_event | nanoflags_event:publish.completed | The kind of event |
service | service:checkout | The destination's service tag (default nanoflags), so events appear next to that service |
env | env:production | The environment key |
project | project:shop | The project key |
revision | revision:42 | The published revision |
flag | flag:new-checkout | One tag per flag in the change (up to 10) |
change_id | change_id:… | The NanoFlags change |
Add your own tags per destination, such as team:payments.
Deployment markers on dashboards
On a timeseries widget, open Event overlays and search:
tags:integration:nanoflags env:production
tags:integration:nanoflags service:checkout nanoflags_event:publish.completedKill switches and failed scheduled publishes can also drive monitors: an event monitor on tags:integration:nanoflags nanoflags_event:flag.killed notifies your on-call channel.
Propagation latency metric
Optionally, each publish also sends the gauge nanoflags.publish.propagation_ms: the time from the database commit of the revision to its distribution to connected SDKs, with the same env, project and service tags. It is sent two minutes after the publish, once measured; a publish that was not distributed within a few minutes sends no point.
Delivery and retries
- Events are queued when they happen and sent within a minute. Failed attempts are retried 5 times (after 1, 2, 4, 8 and 16 minutes) for rate limits, Datadog server errors and timeouts.
- A refused key (HTTP 403) or an invalid request is not retried: the delivery log on the Datadog settings page shows the answer, and three failures in a row mark the destination as failing.
- Delivery is at least once: a retry after a lost answer can send an event twice.
How the API key is stored
The key is sent once from your browser to NanoFlags and encrypted (AES-256-GCM) by the NanoFlags notify service with a key the database does not hold. It is never shown again, returned by any API or sent to a browser; the settings page shows only its last four characters. Removing a destination deletes its key. See Security.