Skip to main content
A transform starts from a sample of the usage your service sends. You map that sample to cost columns and watch the resulting row update as you edit. Read Transforms first for the formats and requirements.

Create the transform

1

Open transforms

In Settings > Organization > Transforms, click New transform. The transform opens on the Mapping tab.Transforms list with each transform's ID, format, mapped columns, and connections.
2

Name it

Click the name at the top of the page and enter a name that says where the usage comes from, such as Gateway token events.
3

Pick the format

In Protocol, select JSON, OpenTelemetry, or Prometheus. The sample payload and mappings change to a starting point for that format. For Prometheus, also select Metric type: Counter or Gauge. Refer to Counters and gauges.Switching Metric type from Counter to Gauge changes the sample payload from increase to value_hours.
4

Paste a sample event

In Sample payload, paste an event your service sends. For OpenTelemetry and Prometheus, the sample is the shape CostGraph gives each data point. Refer to Event fields.
5

Set the event time

For JSON, enter in Event time the field that says when the usage happened, such as event.time. It’s required, and it sets the charge period. An event without it is rejected. OpenTelemetry and Prometheus take the time from the data point.
6

Map the columns

In FOCUS 1.2 columns, choose a source for each column. Required lists the columns every row needs. Mapped lists the ones you have set. Refer to Column sources.
7

Save

Check Resulting row, then click Save transform. The button is enabled when the banner says Ready to save.
Transform editor Mapping tab with the sample payload, the FOCUS 1.2 column mappings, and the resulting row. Next, price the usage. A new transform has no cost yet, so the page shows Set a cost for these events. until you choose one.

Column sources

Each column takes its value from one of these sources: PricingQuantity must be mapped to a number, because CostGraph prices that quantity. Map SubAccountId to your customer or tenant identifier to see cost per customer. CostGraph sets the charge and billing periods, the provider name, and the cost columns BilledCost, EffectiveCost, ListCost, and ContractedCost. A column with a problem shows the error under it, and the banner counts the columns to fix before saving.

Expressions

Expressions use the Common Expression Language (CEL) and read the event as event. The following expressions show the common patterns.

Event fields

For JSON, event is the object you send. For OpenTelemetry and Prometheus, CostGraph builds the event from each data point.
resource holds the resource attributes and attributes the data point attributes. The event time is end.A gauge event has value, the value held, and value_hours, that value times the hours between start and end. Its event time is start. A histogram event has count and sum instead of value.

Edit a transform

Change any tab and click Save transform. Each save creates a new version, shown next to the transform ID. Usage received after the save uses the new version. Usage already recorded keeps its cost. Changing Metric type starts each series again, so its next sample sets the starting value. Deleting a transform from the list refuses any usage sent to it afterward. Cost already recorded stays.