Back to

Command gauges

Latest Go to latest
Published: Jun 17, 2020 | License: Apache-2.0 | Module:


This example shows how to use gauge metrics. The program records two gauges, one to demonstrate a gauge with int64 value and the other to demonstrate a gauge with float64 value.


1. process_heap_alloc (int64): Total bytes used by objects allocated in the heap. It includes objects currently used and objects that are freed but not garbage collected.

2. process_heap_idle_to_alloc_ratio (float64): It is the ratio of Idle bytes to allocated bytes in the heap.

It periodically runs a function that retrieves the memory stats and updates the above two metrics. These metrics are then exported using log exporter. The program lets you choose the amount of memory (in MB) to consume. Choose different values and query the metrics to see the change in metrics.

Documentation was rendered with GOOS=linux and GOARCH=amd64.

Jump to identifier

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to identifier