Current section
Files
Jump to
Current section
Files
README.md
# ThemisPrometheus client in pure Gleam](https://hex.pm/packages/themis)[](https://hexdocs.pm/themis/)```shgleam add themis```## Quick Start```gleamimport themisimport gleam/dictimport gleam/iopub fn main() { // Create a new themis store let store = themis.new() // Add a gauge metric let assert Ok(store) = themis.add_gauge( store, "process_memory_bytes", "Current memory usage in bytes", ) // Record some values with labels let labels = dict.from_list([ #("process", "web_server"), #("instance", "prod-1"), ]) let assert Ok(store) = themis.insert_gauge_record( store, "process_memory_bytes", labels, metrics.int(1_234_567), ) // Export metrics in Prometheus format io.println(metrics.print(store))}```Further documentation can be found at <https://hexdocs.pm/themis>.## Usage### Working with Different Numeric TypesThemis metric values are set using the dedicated `Number` type. There are 5 number types available:```gleamimport themis// Integer valueslet memory = themis.int(1_234_567)// Decimal (float) valueslet temperature = themis.dec(23.5)// Special valueslet and_beyond = themis.pos_inf()let lower_bound = themis.neg_inf()let unknown = themis.nan()```## Output FormatThe metrics are exported in the standard Prometheus text format:```# # HELP process_memory_bytes Current memory usage in bytes# # TYPE process_memory_bytes gaugeprocess_memory_bytes{process="web_server",instance="prod-1"} 1234567```## LicenseMIT