Usage Metering

Meter Event Schema

6min
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 https //docs amberflo io/docs/meter ingestion event schema 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 used, then for csv input the columns not part of amberflo default schema will be converted to dimensions, whereas for json input keys that are not part of amberflo default schema are excluded let's take a look at the below table to understand this 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 we can see the region column/key in csv and json inputs does not belong to the default amberflo schema so we can see in the transformed input that the region column has been transformed into dimensions for csv input whereas it is excluded for the json input if a custom schema is used then only the columns/key mapped in the schema sub components will be considered rest will be excluded for both csv and json defining custom ingest schema the amberflo create or update ingest schema docid\ nwqs8fuude7p0ns 2i6io 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