Skip to content
Join our SlackContact usGet started

Get Pricing Metric

pricing_metrics.retrieve(strpricing_metric_id) -> PricingMetricResource
get/pricing-metrics/{pricing_metric_id}

Get Pricing Metric

ParametersExpand Collapse
pricing_metric_id: str
ReturnsExpand Collapse
class PricingMetricResource:
id: str

The ID of the pricing metric.

aggregation: Aggregation

The aggregation function used to compute the value of the pricing metric.

Accepts one of the following:
class AggregationSumAggregationPricingMetricResource:
aggregation_type: Literal["sum"]
Accepts one of the following:
"sum"
value_field: str

The field to sum over.

class AggregationCountAggregationPricingMetricResource:
aggregation_type: Literal["count"]
Accepts one of the following:
"count"
class AggregationMaxAggregationPricingMetricResource:
aggregation_type: Literal["max"]
Accepts one of the following:
"max"
value_field: str

The field to get the max value of.

class AggregationLastAggregationPricingMetricResource:
aggregation_type: Literal["last"]
Accepts one of the following:
"last"
value_field: str

The field to get the last value of.

event_name: str

The event name that the pricing metric is computed on.

name: str

The name of the pricing metric.

unit: str

The unit of the value computed by the pricing metric.

dimensions: Optional[List[str]]

The dimensions by which the events are grouped to compute the pricing metric.

Get Pricing Metric
from lark import Lark

client = Lark(
    api_key="My API Key",
)
pricing_metric_resource = client.pricing_metrics.retrieve(
    "pricing_metric_id",
)
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"
  ]
}