如何估算当前的伐木成本?

发布于 2025-01-11 21:44:40 字数 960 浏览 2 评论 0原文

DataDog 全新。我很失望我的“使用”控制台没有显示我花了多少钱。所以,我正在尝试创建一个仪表板。现在我试图简单地说明本月我们为日志支付的费用。

我有“以字节为单位的日志总和”(我认为),但我在将其转换为 $.这是由于我在数学方面的弱点以及我对 DataDog 接口缺乏了解。以下是我目前的努力。我将除以 1024 三次来转换 GB,然后除以 10(因为不能乘以 0.10)来调整每 GB 10 美分,并希望最终得到每字节的价格。结果是2.05e-3,我显然对这是正确的有信心。

{
    "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"
    }
}

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"
    }
}

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

貪欢 2025-01-18 21:44:40

所以我在心里做了一些简单的数学计算。

如果1GB = 10 美分,则100MB = 1 美分10MB = 0.1 美分

所以我拥有的 21MB 日志应该花费 0.21 美分。

从答案开始,我想出了这个公式:

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

这导致了我认为正确的结果:

在此处输入图像描述

注意,我还使用 clamp_min 来防止它在以下情况下显示科学记数法:我们在月初的时候非常低。

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.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文