Metering

Metering API

AsyncCogniteClient.metering.list([filter, ...])

List all meters.

AsyncCogniteClient.metering.retrieve(id[, ...])

Retrieve one or more meters by id.

Metering Data Classes

class cognite.client.data_classes.metering.MeteringData(
meter_id: str,
datapoints: list[MeteringDataPoint] | None = None,
)

Bases: CogniteResource

A singular representation of the current consumption.

Metering is identified by an id containing the service name and a service-scoped metering name. For instance atlas.monthly_ai_tokens is the id of the atlas service metering monthly_ai_tokens. Service and metering names are always in lower_snake_case.

Parameters:
  • meter_id (str) – The metering ID, e.g. atlas.monthly_ai_tokens.

  • datapoints (list[MeteringDataPoint] | None) – Timestamped data points with average values. Empty unless both start and number_of_datapoints are provided in the request.

as_id() str

Returns the meter ID.

dump(camel_case: bool = True) dict[str, Any]

Dump the instance into a json serializable Python data type.

Parameters:

camel_case (bool) – Use camelCase for attribute names. Defaults to True.

Returns:

A dictionary representation of the instance.

Return type:

dict[str, Any]

class cognite.client.data_classes.metering.MeteringDataList(
resources: Sequence[T_CogniteResource],
)

Bases: CogniteResourceList[MeteringData]

as_ids() list[str]

Returns a list of meter IDs.

class cognite.client.data_classes.metering.MeteringDataPoint(timestamp: int, average: float)

Bases: CogniteResource

A single timestamped data point with average value.

Parameters:
  • timestamp (int) – The timestamp for this data point, in milliseconds since epoch.

  • average (float) – The average metric value for this time bucket.