PEPAI / tools

dd-metric-bill

Estimate how many billable Datadog custom metrics a sample produces, offline, before the bill arrives.

The problem

Datadog bills custom metrics per unique combination of metric name and tag values. One tag with many values, such as user_id, can raise the metric count and the bill, and a team usually sees that only afterwards.

dd-metric-bill shows beforehand, locally, which metric and which tag drives the count. It reads DogStatsD, JSON lines or Prometheus text.

Example output

$ dd-metric-bill count tests/fixtures/b1-count.dogstatsd
total: 4

request.Latency type: count combinations: 4 count: 4 rule: D3
  tag: endpoint values: 2 added: 1
  tag: host values: 2 added: 1
  tag: status values: 2 added: 1

estimate: Datadog bills the hourly average over the month; this is one snapshot (source: B1)

Real output on the worked example from the Datadog documentation, as included in the repository's test fixtures.

Install

cargo install --locked dd-metric-bill

Needs Rust 1.85 or newer. Ready-made binaries for Linux, Windows and macOS are on the releases page.

What it deliberately does not do

Links

GitHubcrates.ioQuality
← Back to all tools