采集器「火山引擎 - 云账单(实例维度)」配置手册¶
阅读本文前,请先阅读:
Tip
使用本采集器前,必须安装「集成 Core 核心包」及其配套的第三方依赖包
Tip
为了保证数据的完整性,所采集的的账单日期为当前日期前一天,例如:2022-07-03 00:00:00 ~ 23:59:59 期间采集的都是 2022-07-02 的数据
1. 配置结构¶
本采集器无需配置
2. 数据上报格式¶
数据正常同步后,可以在 观测云 的「云账单查看器」中查看数据。
上报的数据示例如下:
{
"category": "cloud_billing",
"fields": {
"amount": 0.96,
"cash_amount": 0.96,
"coupon_amount": 0.0,
"message": "{\"BillCategory\": \"\\u6d88\\u8d39-\\u4f7f\\u7528\", \"BillDetailId\": \"-\", \"BillID\": \"\", \"BillPeriod\": \"2024-11\", \"BillingFunction\": \"-\", \"BillingMethodCode\": \"-\", \"BillingMode\": \"\\u6309\\u91cf\\u8ba1\\u8d39\", \"BusiPeriod\": \"2024-11\", \"BusinessMode\": \"\\u666e\\u901a\\u4e1a\\u52a1\", \"ConfigName\": \"\", \"ConfigurationCode\": \"-\", \"Count\": \"\", \"CouponAmount\": \"0.00\", \"CreditCarriedAmount\": \"0.00\", \"Currency\": \"CNY\", \"DeductionCount\": \"\", \"DeductionUseDuration\": \"0.0000000000\", \"DiscountBillAmount\": \"0.96\", \"DiscountBizBillingFunction\": \"-\", \"DiscountBizMeasureInterval\": \"-\", \"DiscountBizUnitPrice\": \"-\", \"DiscountBizUnitPriceInterval\": \"-\", \"EffectiveFactor\": \"0\", \"Element\": \"\", \"ElementCode\": \"-\", \"ExpandField\": \"\", \"ExpenseBeginTime\": \"2024-11-26\", \"ExpenseDate\": \"2024-11-26\", \"ExpenseEndTime\": \"\", \"Factor\": \"-\", \"FactorCode\": \"-\", \"Formula\": \"-\", \"InstanceName\": \"vol-3w0hzxh70x3xv7kew2lg\", \"InstanceNo\": \"vol-3w0hzxh70x3xv7kew2lg\", \"MarketPrice\": \"\", \"MeasureInterval\": \"-\", \"OriginalBillAmount\": \"1.008000\", \"OwnerCustomerName\": \"\\u4e0a\\u6d77\\u89c2\\u6d4b\\u672a\\u6765\\u4fe1\\u606f\\u6280\\u672f\\u6709\\u9650\\u516c\\u53f8\", \"OwnerID\": \"2100061056\", \"OwnerUserName\": \"livesite\", \"PaidAmount\": \"0.96\", \"PayableAmount\": \"0.96\", \"PayerCustomerName\": \"\\u4e0a\\u6d77\\u89c2\\u6d4b\\u672a\\u6765\\u4fe1\\u606f\\u6280\\u672f\\u6709\\u9650\\u516c\\u53f8\", \"PayerID\": \"2100061056\", \"PayerUserName\": \"livesite\", \"PreferentialBillAmount\": \"0.000000\", \"Price\": \"\", \"PriceInterval\": \"-\", \"PriceUnit\": \"\", \"Product\": \"volume\", \"ProductZh\": \"\\u5f39\\u6027\\u5757\\u5b58\\u50a8\", \"Project\": \"default\", \"ProjectDisplayName\": \"\\u9ed8\\u8ba4\\u9879\\u76ee\", \"Region\": \"\\u534e\\u4e1c2\\uff08\\u4e0a\\u6d77\\uff09\", \"RegionCode\": \"R000310\", \"ReservationInstance\": \"0\", \"RoundAmount\": 0.048, \"SellerCustomerName\": \"\\u5317\\u4eac\\u706b\\u5c71\\u5f15\\u64ce\\u79d1\\u6280\\u6709\\u9650\\u516c\\u53f8\", \"SellerID\": \"3423\", \"SellerUserName\": \"\\u706b\\u5c71\\u5f15\\u64ce\", \"SellingMode\": \"0\", \"SettlementType\": \"\\u7ed3\\u7b97\", \"SolutionZh\": \"\", \"SubjectName\": \"\\u5317\\u4eac\\u706b\\u5c71\\u5f15\\u64ce\\u79d1\\u6280\\u6709\\u9650\\u516c\\u53f8\", \"Tag\": \"\", \"TradeTime\": \"\", \"Unit\": \"\", \"UnpaidAmount\": \"0.00\", \"UseDuration\": \"\", \"UseDurationUnit\": \"\", \"Zone\": \"\\u53ef\\u7528\\u533aA\", \"ZoneCode\": \"cn-shanghai-a\"}",
"offical_amount": 1.008,
"round_amount": 0.048
},
"measurement": "cloud_billing",
"tags": {
"account_id": "2100061056",
"account_name": "livesite",
"billing_date": "2024-11-26",
"billing_id": "b3ee4e5ee94835c1579c53b078201f490d8e4c83bd41248919cca45d3258ce41",
"billing_timestamp": "1732636799",
"instance_id": "vol-3w0hzxh70x3xv7kew2lg",
"name": "vol-3w0hzxh70x3xv7kew2lg",
"product_code": "volume",
"product_name": "弹性块存储",
"region_name": "华东2(上海)",
"zone": "cn-shanghai-a"
},
"timestamp": 1732636799
}
Note
tags、fields 中的字段可能会随后续更新有所变动
3. 字段说明¶
上报字段 | API 返回字段 | API 字段含义 | 说明 | |
---|---|---|---|---|
账单 ID | billing_id |
账单唯一 ID | ||
产品代码 | product_code |
Product |
云服务类型编码 | |
产品名称 | product_name |
ProductZh |
云服务类型名称 | |
实付金额 | amount |
amount |
用户支付金额 | |
抹零金额 | round_amount |
RoundAmount |
抹零金额 | |
代金券抵扣 | coupon_amount |
CouponAmount |
代金券抵扣 | |
现金支付 | cash_amount |
PaidAmount |
现金支付 | |
官网价 | offical_amount |
OriginalBillAmount |
原价 | |
账期 | billing_date |
ExpenseDate |
资源消费记录的日期。格式:YYYY-MM-DD | |
地域 | region_name |
Region |
地域名称 | |
实例 ID | instance_id |
InstanceNo |
实例 ID | |
支付账号ID | account_id |
PayerID |
支付账号ID | |
支付账户名 | account_name |
PayerUserName |
支付账户名 |
Tip
脚本每次运行时数据统计颗粒度为 资源(实例)id:InstanceNo;相同实例的账单消费金额会合并计算,具体可以查看下面火山引擎 API 原始数据和脚本汇总后的数据对比
火山引擎 API 接口原始数据¶
{
"ResponseMetadata": {
"RequestId": "20241127150034FD324E583EA1CB61F7F0",
"Action": "ListBillDetail",
"Version": "2022-01-01",
"Service": "billing",
"Region": "cn-beijing"
},
"Result": {
"List": [
{
"BillPeriod": "2024-11",
"ExpenseDate": "2024-11-17",
"PayerID": "2100061056",
"PayerUserName": "livesite",
"PayerCustomerName": "xxxxx",
"SellerID": "3423",
"SellerUserName": "火山引擎",
"SellerCustomerName": "北京火山引擎科技有限公司",
"OwnerID": "2100061056",
"OwnerUserName": "livesite",
"OwnerCustomerName": "xxxxx",
"BusinessMode": "xxx",
"Product": "ECS",
"ProductZh": "xxx",
"BillingMode": "PrePay",
"ExpenseBeginTime": "2024-11-17",
"ExpenseEndTime": "",
"UseDuration": "",
"UseDurationUnit": "",
"TradeTime": "",
"BillID": "",
"BillCategory": "xxx",
"InstanceNo": "i-ydiq2kjoqok36d16srt3",
"InstanceName": "ECS-func",
"ConfigName": "",
"Element": "",
"Region": "华东2(上海)",
"Zone": "可用区A",
"Factor": "-",
"ExpandField": "",
"Price": "",
"PriceUnit": "",
"Count": "",
"Unit": "",
"DeductionCount": "",
"OriginalBillAmount": "10.908680",
"PreferentialBillAmount": "0.000000",
"DiscountBillAmount": "10.71",
"CouponAmount": "0.00",
"PayableAmount": "10.71",
"PaidAmount": "10.71",
"UnpaidAmount": "0.00",
"Currency": "CNY",
"SettlementType": "xxx",
"Project": "default",
"Tag": "",
"SellingMode": "0",
"SolutionZh": "",
"SubjectName": "北京火山引擎科技有限公司",
"RoundAmount": 0.19868,
"BusiPeriod": "2024-11",
"ReservationInstance": "0",
"BillDetailId": "-",
"ElementCode": "-",
"RegionCode": "R000310",
"ZoneCode": "cn-shanghai-a",
"FactorCode": "-",
"ConfigurationCode": "-",
"DeductionUseDuration": "0.0000000000",
"CreditCarriedAmount": "0.00",
"BillingFunction": "-",
"MarketPrice": "",
"DiscountBizBillingFunction": "-",
"DiscountBizUnitPrice": "-",
"DiscountBizUnitPriceInterval": "-",
"DiscountBizMeasureInterval": "-",
"EffectiveFactor": "0",
"PriceInterval": "-",
"MeasureInterval": "-",
"BillingMethodCode": "-",
"ProjectDisplayName": "默认项目",
"Formula": "-"
}
],
"Total": 1,
"Limit": 100,
"Offset": 0
}
}
脚本汇总后¶
{
"category": "cloud_billing",
"fields": {
"amount": 0.96,
"cash_amount": 0.96,
"coupon_amount": 0.0,
"message": "{\"BillCategory\": \"\\u6d88\\u8d39-\\u4f7f\\u7528\", \"BillDetailId\": \"-\", \"BillID\": \"\", \"BillPeriod\": \"2024-11\", \"BillingFunction\": \"-\", \"BillingMethodCode\": \"-\", \"BillingMode\": \"\\u6309\\u91cf\\u8ba1\\u8d39\", \"BusiPeriod\": \"2024-11\", \"BusinessMode\": \"\\u666e\\u901a\\u4e1a\\u52a1\", \"ConfigName\": \"\", \"ConfigurationCode\": \"-\", \"Count\": \"\", \"CouponAmount\": \"0.00\", \"CreditCarriedAmount\": \"0.00\", \"Currency\": \"CNY\", \"DeductionCount\": \"\", \"DeductionUseDuration\": \"0.0000000000\", \"DiscountBillAmount\": \"0.96\", \"DiscountBizBillingFunction\": \"-\", \"DiscountBizMeasureInterval\": \"-\", \"DiscountBizUnitPrice\": \"-\", \"DiscountBizUnitPriceInterval\": \"-\", \"EffectiveFactor\": \"0\", \"Element\": \"\", \"ElementCode\": \"-\", \"ExpandField\": \"\", \"ExpenseBeginTime\": \"2024-11-26\", \"ExpenseDate\": \"2024-11-26\", \"ExpenseEndTime\": \"\", \"Factor\": \"-\", \"FactorCode\": \"-\", \"Formula\": \"-\", \"InstanceName\": \"vol-3w0hzxh70x3xv7kew2lg\", \"InstanceNo\": \"vol-3w0hzxh70x3xv7kew2lg\", \"MarketPrice\": \"\", \"MeasureInterval\": \"-\", \"OriginalBillAmount\": \"1.008000\", \"OwnerCustomerName\": \"\\u4e0a\\u6d77\\u89c2\\u6d4b\\u672a\\u6765\\u4fe1\\u606f\\u6280\\u672f\\u6709\\u9650\\u516c\\u53f8\", \"OwnerID\": \"2100061056\", \"OwnerUserName\": \"livesite\", \"PaidAmount\": \"0.96\", \"PayableAmount\": \"0.96\", \"PayerCustomerName\": \"\\u4e0a\\u6d77\\u89c2\\u6d4b\\u672a\\u6765\\u4fe1\\u606f\\u6280\\u672f\\u6709\\u9650\\u516c\\u53f8\", \"PayerID\": \"2100061056\", \"PayerUserName\": \"livesite\", \"PreferentialBillAmount\": \"0.000000\", \"Price\": \"\", \"PriceInterval\": \"-\", \"PriceUnit\": \"\", \"Product\": \"volume\", \"ProductZh\": \"\\u5f39\\u6027\\u5757\\u5b58\\u50a8\", \"Project\": \"default\", \"ProjectDisplayName\": \"\\u9ed8\\u8ba4\\u9879\\u76ee\", \"Region\": \"\\u534e\\u4e1c2\\uff08\\u4e0a\\u6d77\\uff09\", \"RegionCode\": \"R000310\", \"ReservationInstance\": \"0\", \"RoundAmount\": 0.048, \"SellerCustomerName\": \"\\u5317\\u4eac\\u706b\\u5c71\\u5f15\\u64ce\\u79d1\\u6280\\u6709\\u9650\\u516c\\u53f8\", \"SellerID\": \"3423\", \"SellerUserName\": \"\\u706b\\u5c71\\u5f15\\u64ce\", \"SellingMode\": \"0\", \"SettlementType\": \"\\u7ed3\\u7b97\", \"SolutionZh\": \"\", \"SubjectName\": \"\\u5317\\u4eac\\u706b\\u5c71\\u5f15\\u64ce\\u79d1\\u6280\\u6709\\u9650\\u516c\\u53f8\", \"Tag\": \"\", \"TradeTime\": \"\", \"Unit\": \"\", \"UnpaidAmount\": \"0.00\", \"UseDuration\": \"\", \"UseDurationUnit\": \"\", \"Zone\": \"\\u53ef\\u7528\\u533aA\", \"ZoneCode\": \"cn-shanghai-a\"}",
"offical_amount": 1.008,
"round_amount": 0.048
},
"measurement": "cloud_billing",
"tags": {
"account_id": "2100061056",
"account_name": "livesite",
"billing_date": "2024-11-26",
"billing_id": "b3ee4e5ee94835c1579c53b078201f490d8e4c83bd41248919cca45d3258ce41",
"billing_timestamp": "1732636799",
"instance_id": "vol-3w0hzxh70x3xv7kew2lg",
"name": "vol-3w0hzxh70x3xv7kew2lg",
"product_code": "volume",
"product_name": "弹性块存储",
"region_name": "华东2(上海)",
"zone": "cn-shanghai-a"
},
"timestamp": 1732636799
}
X. 附录¶
火山引擎 - 账单管理「分页查询账单明细」¶
请参考火山引擎官方文档: