How to estimate current cost for logging?

Viewed 80

Brand new to DataDog. I'm disappointed that my "usage" console doesn't give any indication of how much money I'm spending. So, I'm trying to create a dashboard. Right now I'm trying to simply show how much we are paying for logs this month.

I have the "sum of logs in bytes" (I think) but I'm having trouble converting that to $. This is due to my weakness in math as well as my lack of understanding of the DataDog interface. Below is my current effort. I'm dividing by 1024 three times to convert GB, then dividing by 10 (because you can't multiply by .10) to adjust for the 10 cents per gigabyte and hopefully end up with price per byte. The result is 2.05e-3 and I obviously have zero confidence that this is right.

{
    "viz": "query_value",
    "requests": [
        {
            "formulas": [
                {
                    "formula": "(query1 / 1024 / 1024 / 1024) / 10"
                }
            ],
            "response_format": "scalar",
            "queries": [
                {
                    "data_source": "metrics",
                    "name": "query1",
                    "query": "sum:datadog.estimated_usage.logs.ingested_bytes{*}.as_count()",
                    "aggregator": "sum"
                }
            ]
        }
    ],
    "autoscale": true,
    "precision": 2,
    "timeseries_background": {
        "type": "bars"
    }
}
1 Answers

So I did some simple math in my head.

if 1GB = 10 cents then 100MB = 1 cent and 10MB = .1 cent.

So the 21MB of logs I have should be costing .21 cents.

Working backwards from the answer, I came up with this formula:

"clamp_min((query1 / 1024 / 1024 / 1024) * 10, 0.1)"

Which results in something that looks right to me:

enter image description here

Note I also used clamp_min to keep it from showing scientific notation when we are very low at the beginning of the month.

Related