如何估算当前的伐木成本?
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 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
所以我在心里做了一些简单的数学计算。
如果
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
then100MB = 1 cent
and10MB = .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:
Note I also used
clamp_min
to keep it from showing scientific notation when we are very low at the beginning of the month.