Skip to content
Join our SlackContact usGet started

List Pricing Metrics

client.PricingMetrics.List(ctx, query) (*PricingMetricListResponse, error)
get/pricing-metrics

List Pricing Metrics

ParametersExpand Collapse
query PricingMetricListParams
Limit param.Field[int64]optional
maximum100
minimum1
ReturnsExpand Collapse
type PricingMetricListResponse struct{…}
HasMore bool
PricingMetrics []PricingMetricResource
ID string

The ID of the pricing metric.

Aggregation PricingMetricResourceAggregationUnion

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

Accepts one of the following:
type PricingMetricResourceAggregationSum struct{…}
AggregationType Sum
Accepts one of the following:
const SumSum Sum = "sum"
ValueField string

The field to sum over.

type PricingMetricResourceAggregationCount struct{…}
AggregationType Count
Accepts one of the following:
const CountCount Count = "count"
type PricingMetricResourceAggregationMax struct{…}
AggregationType Max
Accepts one of the following:
const MaxMax Max = "max"
ValueField string

The field to get the max value of.

type PricingMetricResourceAggregationLast struct{…}
AggregationType Last
Accepts one of the following:
const LastLast Last = "last"
ValueField string

The field to get the last value of.

EventName string

The event name that the pricing metric is computed on.

Name string

The name of the pricing metric.

Unit string

The unit of the value computed by the pricing metric.

Dimensions []stringoptional

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

List Pricing Metrics
package main

import (
  "context"
  "fmt"

  "github.com/stainless-sdks/-go"
  "github.com/stainless-sdks/-go/option"
)

func main() {
  client := lark.NewClient(
    option.WithAPIKey("My API Key"),
  )
  pricingMetrics, err := client.PricingMetrics.List(context.TODO(), lark.PricingMetricListParams{

  })
  if err != nil {
    panic(err.Error())
  }
  fmt.Printf("%+v\n", pricingMetrics.HasMore)
}
{
  "has_more": true,
  "pricing_metrics": [
    {
      "id": "pmtr_GlX5Tcm2HOn00CoRTFxw2Amw",
      "aggregation": {
        "aggregation_type": "sum",
        "value_field": "compute_hours"
      },
      "event_name": "job_completed",
      "name": "Compute Hours",
      "unit": "hours",
      "dimensions": [
        "string"
      ]
    }
  ]
}
Returns Examples
{
  "has_more": true,
  "pricing_metrics": [
    {
      "id": "pmtr_GlX5Tcm2HOn00CoRTFxw2Amw",
      "aggregation": {
        "aggregation_type": "sum",
        "value_field": "compute_hours"
      },
      "event_name": "job_completed",
      "name": "Compute Hours",
      "unit": "hours",
      "dimensions": [
        "string"
      ]
    }
  ]
}