Return to index

metrics functions

bool = metric_add(name,n)

top

Add n to a counter metric. Returns false if not found, wrong type, or metrics not enabled.

Example:

# Example for metric_add
println metric_add("counter", "test", 1)


bool = metric_deregister(name)

top

Deregister and remove a custom metric. Returns false if not found or metrics not enabled.

Example:

# Example for metric_deregister
println metric_deregister("test")


bool = metric_enabled()

top

Returns true if the metrics server is enabled (started with -M or ZA_PROMETHEUS env var).

Example:

# Example for metric_enabled
println metric_enabled()


bool = metric_inc(name)

top

Increment a counter metric by 1. Returns false if not found, wrong type, or metrics not enabled.

Example:

# Example for metric_inc
println metric_inc("test")


bool = metric_observe(name,value)

top

Record an observation in a summary metric. Returns false if not found, wrong type, or metrics not enabled.

Example:

# Example for metric_observe
println metric_observe("test", 1.0)


bool = metric_register(name,type)

top

Register a custom metric with type 'counter', 'gauge', or 'summary'. Returns false if already registered or metrics not enabled.

Example:

# Example for metric_register
println metric_register("counter", "test", "help")


bool = metric_set(name,value)

top

Set a gauge metric to a value. Returns false if not found, wrong type, or metrics not enabled.

Example:

# Example for metric_set
println metric_set("test", 42)