Usage Metering
Meter Event Schema
7 min
the default ingest event schema supported by amberflo is as follows { "customerid" string, "meterapiname" string, "metervalue" number, "metertimeinmillis" number, "uniqueid" string "dimensions" map\<string, string> } amberflo supports the following input formats json ndjson csv amberflo also supports defining a custom schema, which transforms the input into amberflo ingest events this guide explains how to use a custom schema for ingesting meter events json format sample input in json format \[{ "customerid" "customer 123", "meterapiname" "computehours", "metervalue" 5, "metertimeinmillis" 1619445706909, "dimensions" { "region" "us west 2", "az" "az1" } }, { }] ndjson format amberflo also supports the ndjson format , where each record is separated by a new line sample input in ndjson format { "customerid" "customer 123", "meterapiname" "computehours", "metervalue" 5, "metertimeinmillis" 1619445706909 } { "customerid" "customer 321", "meterapiname" "computehours", "metervalue" 4, "metertimeinmillis" 1619445712341 } { "customerid" "customer 123", "meterapiname" "computehours", "metervalue" 1, "metertimeinmillis" 1619445783456 } csv format sample input in csv format meterapiname,metervalue,metertimeinmillis,customerid,region computehours,5,1619445706909,customer 123,us west 2 computehours,4,1619445712341,customer 321,us east 1 computehours,1,1619445783456,customer 123,us west 2 difference in behavior for csv and json inputs if a custom schema is not provided for csv input , any columns that are not part of the amberflo default schema will be automatically treated as dimensions for json input , any keys that do not match the default schema will be ignored (they will not be included as dimensions or stored) the table below illustrates how this behavior works input transformed input csv meterapiname metervalue metertimeinmillis customerid region m1 1 1714070079000 c1 us west 2 { "meterapiname" "m1", "metervalue" 1, "metertimeinmillis" 1714073679000, "customerid" "c1", "dimensions" { region" "us west 2" } } json { "meterapiname" "m1", "metervalue" 1, "metertimeinmillis" 1714073679000, "customerid" "c1", "region" "us west 2" } { "meterapiname" "m1", "metervalue" 1, "metertimeinmillis" 1714073679000, "customerid" "c1" } as shown in the example, the region column/key is not part of the default amberflo schema in the transformed input for csv input , the region column is automatically included as a dimension for json input , the region key is excluded entirely when a custom schema is used, only the fields explicitly mapped in the schema’s sub components are considered all other fields are excluded—this applies to both csv and json inputs defining custom ingest schema the amberflo custom ingest schema api lets you define your own custom schema based on your events this custom schema can be used with both csv and json inputs the schema has sub components that define the mapping of a particular source column name/json key to the amberflo ingest event parameter