Guides
...
Getting started
Amberflo SDKs

Go

18min

Links

Quick Start

Text


Ingesting meters



📘 Cancel an ingested meter

A meter can be cancelled by resending the same ingestion event and setting metering.CancelMeter dimension to "true". See code below.

Cancel ingested meter


Query usage

Go


Manage customers

Custom logger

By default, metering-go uses the default GO logger. You can inject your own logger by implementing the following interface Logger:

Go


Define the custom logger:

Go


Instantiate metering client with custom logger:

Go


Query usage cost with paging

Pricing plans

Go


Prepaid Client

Signals

Batching Records

Amberflo.io libraries are built to support high throughput environments. That means you can safely send hundreds of meter records per second. For example, you can chose to deploy it on a web server that is serving hundreds of requests per second.

However, every call does not result in a HTTP request, but is queued in memory instead. Messages are batched and flushed in the background, allowing for much faster operation. The size of batch and rate of flush can be customized.

Defaults: The library will flush every 100 messages (configuration parameter: BatchSize ) or if 1 second has passed since the last flush (configuration parameter: IntervalSeconds) There is a maximum of 500KB per batch request and 32KB per call.

Flush on demand (Blocking call)

You can flush on demand. For example, at the end of your program, you’ll want to flush to make sure there’s nothing left in the queue. Just call the flush method:

metering.Flush()

Please note: Calling this method will block the calling thread until there are no messages left in the queue. So, you’ll want to use it as part of your cleanup scripts and avoid using it as part of the request lifecycle.