Skip to main content

Metering

Monitor and measure user activity to manage product usage.


Flow

Usage record group

[
{
"key": "api_call",
"quantity": 100,
"properties": {
"api": "/api/v1"
},
},
{
"key": "network_traffic",
"quantity": 1000,
"properties": {
"region": "east",
"protocol": "tcp"
"os": "linux",
"cluster": "cluster-1"
},
},
{
"key": "network_traffic",
"quantity": 2000,
"properties": {
"region": "east",
"protocol": "tcp"
"os": "linux",
"cluster": "cluster-2"
},
},
{
"key": "network_traffic",
"quantity": 2000,
"properties": {
"region": "west",
"protocol": "tcp"
"os": "linux",
"cluster": "cluster-2"
},
}
]
  • Sellers report usage records to Suger using the metering API or other channels.
  • When the usage record group is received, the status of the usage record group is updated to created.
  • Suger automatically aggregates the usage records hourly depending on the billable metric configuration and generates the usage record reports.
  • When the usage record report is generated, the status of the usage record group is updated to reported.
  • When the usage record report generation fails, the status of the usage record group is updated to reported_pending.

Usage record report

[
{
"key": "api_call",
"groupBysExpression": "",
"quantity": 100,
"billableMetricInfo": {
"filterGroups": [],
},
"billableMetricAggregationType": "SUM"
},
{
"key": "network_traffic",
"groupBysExpression": "os=linux,cluster=cluster-1",
"quantity": 1000,
"billableMetricInfo": {
"filterGroups": [
{
"filters": [
{
"property": "region",
"operator": "is",
"value": "east",
"valueType": "string"
},
{
"property": "protocol",
"operator": "is",
"value": "tcp",
"valueType": "string"
}
]
}
]
},
"billableMetricAggregationType": "SUM"
},
{
"key": "network_traffic",
"groupBysExpression": "os=linux,cluster=cluster-2",
"quantity": 2000,
"billableMetricInfo": {
"filterGroups": [
{
"filters": [
{
"property": "region",
"operator": "is",
"value": "east",
"valueType": "string"
},
{
"property": "protocol",
"operator": "is",
"value": "tcp",
"valueType": "string"
}
]
}
]
},
"billableMetricAggregationType": "SUM"
}
]
  • When the usage record report is generated, the status of the usage record report is updated to created.
  • Suger automatically generates the daily usage record report every day.
  • When the usage record report is invoiced, the status of the usage record report is updated to invoiced.

Daily Report

[
{
"reportStatus": "CREATED",
"aggregatedRecords": [
{
"key": "api_call",
"groupBysExpression": "",
"quantity": 100,
"billableMetricInfo": {
"filterGroups": []
},
"billableMetricAggregationType": "SUM"
},
{
"key": "network_traffic",
"groupBysExpression": "os=linux,cluster=cluster-1",
"quantity": 1000,
"billableMetricInfo": {
"filterGroups": [
{
"filters": [
{
"property": "region",
"operator": "is",
"value": "east",
"valueType": "string"
},
{
"property": "protocol",
"operator": "is",
"value": "tcp",
"valueType": "string"
}
]
}
]
},
"billableMetricAggregationType": "SUM"
},
{
"key": "network_traffic",
"groupBysExpression": "os=linux,cluster=cluster-2",
"quantity": 2000,
"billableMetricInfo": {
"filterGroups": [
{
"filters": [
{
"property": "region",
"operator": "is",
"value": "east",
"valueType": "string"
},
{
"property": "protocol",
"operator": "is",
"value": "tcp",
"valueType": "string"
}
]
}
]
},
"billableMetricAggregationType": "SUM"
}
]
}
]
  • The daily usage report is used for revenue reporting.

Billable Dimension Usage Daily Revenue

{
"date": "2024-06-01T00:00:00Z",
"quantity": 501,
"billableMetricKey": {
"id": "api_call"
}
},
{
"date": "2024-06-01T00:00:00Z",
"quantity": 15,
"billableMetricKey": {
"id": "network_traffic",
"groupBysExpression": "os=linux,cluster=cluster-2"
}
},
{
"date": "2024-06-02T00:00:00Z",
"quantity": 1026,
"billableMetricKey": {
"id": "network_traffic",
"groupBysExpression": "os=linux,cluster=cluster-2"
}
}
  • The billable dimension usage daily revenue is calculated by the usage record report and is used to generate the invoice.

Billable Dimension Price Model Detail

[
{
"billableMetricKey": {
"id": "api_call"
},
"details": [
{
"descriptions": "$0.01 per unit",
"feeExpressions": "$0.01*4431"
}
],
"amount": 4431,
"discountExpression": ""
},
{
"billableMetricKey": {
"id": "network_traffic",
"groupBysExpression": "os=linux,cluster=cluster-2"
},
"details": [
{
"descriptions": "Tier: 1 - 10",
"feeExpressions": "10 x $1.00 + $10.00 = $20.00"
},
{
"descriptions": "Tier: 11 - ∞",
"feeExpressions": "5 x $0.50 + $5.00 = $7.5"
}
],
"amount": 24.75,
"discountExpression": "90%"
}
]
  • The billable dimension price model detail is used to generate the invoice.