Create Pricing Metric
pricing_metrics.create(PricingMetricCreateParams**kwargs) -> PricingMetricResource
/pricing-metrics
Create Pricing Metric
Parameters
event_name: str
The name of the event that the pricing metric is computed on.
name: str
The name of the pricing metric.
unit: str
Unit of measurement for the pricing metric.
dimensions: Optional[SequenceNotStr[str]]
The dimensions by which the events are grouped to compute the pricing metric.
Returns
Create Pricing Metric
from lark import Lark
client = Lark(
api_key="My API Key",
)
pricing_metric_resource = client.pricing_metrics.create(
aggregation={
"aggregation_type": "sum",
"value_field": "compute_hours",
},
event_name="job_completed",
name="Compute Hours",
unit="hours",
)
print(pricing_metric_resource.id)
{
"id": "pmtr_GlX5Tcm2HOn00CoRTFxw2Amw",
"aggregation": {
"aggregation_type": "sum",
"value_field": "compute_hours"
},
"event_name": "job_completed",
"name": "Compute Hours",
"unit": "hours",
"dimensions": [
"string"
]
}Returns Examples
{
"id": "pmtr_GlX5Tcm2HOn00CoRTFxw2Amw",
"aggregation": {
"aggregation_type": "sum",
"value_field": "compute_hours"
},
"event_name": "job_completed",
"name": "Compute Hours",
"unit": "hours",
"dimensions": [
"string"
]
}