themis/gauge

Functions

pub fn insert_record(
  store store: Store,
  gauge_name name_string: String,
  labels labels_dict: Dict(String, String),
  value value: Number,
) -> Result(Store, StoreError)

Records a value for a gauge metric with the given labels.

Arguments

  • store: The metrics store containing the gauge
  • gauge_name: The name of the gauge to record a value for
  • labels: A dictionary of labels
  • value: The numeric value to record

Examples

let labels = dict.from_list([#("instance", "localhost:9090")])
let assert Ok(store) = insert_gauge_record(
  store,
  "process_cpu_seconds_total",
  labels,
  int(42),
)
pub fn register(
  store store: Store,
  name name_string: String,
  description description: String,
) -> Result(Store, StoreError)

Registers a new gauge metric to the store.

Arguments

  • store: The metrics store to add the gauge to
  • name: The name of the gauge metric (must be a valid Prometheus metric name)
  • description: A human-readable description of what the gauge measures

Examples

let assert Ok(store) = register(
  store,
  "process_cpu_seconds_total",
  "Total user and system CPU time spent in seconds",
)
pub fn unregister(
  store store: Store,
  gauge_name name_string: String,
) -> Result(Store, StoreError)

Removes a gauge metric and all its recorded values from the store.

Arguments

  • store: The metrics store containing the gauge
  • gauge_name: The name of the gauge to delete

Examples

let assert Ok(store) = unregister(store, "process_cpu_seconds_total")
Search Document