From: Jess Bees Date: Wed, 29 Oct 2025 16:58:00 +0000 (-0400) Subject: Document initMetric X-Git-Tag: rec-5.4.0-alpha1~40^2~7 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=782ab4b61d1917f1f7fc3ed0de65e7023afed385;p=thirdparty%2Fpdns.git Document initMetric Signed-off-by: Jess Bees --- diff --git a/pdns/recursordist/docs/lua-scripting/statistics.rst b/pdns/recursordist/docs/lua-scripting/statistics.rst index eafbf1be52..1362e312f9 100644 --- a/pdns/recursordist/docs/lua-scripting/statistics.rst +++ b/pdns/recursordist/docs/lua-scripting/statistics.rst @@ -24,6 +24,26 @@ Create a custom metric with: :param string prometheusName: The optional Prometheus specific name. +.. function:: initMetric(name [, prometheusName]) -> Metric + initMetric(name [, prometheusTable]) -> Metric + + :param string name: The metric to create + :param string prometheusName: The optional Prometheus specific name + :param table prometheusTable: The optional table of Prometheus specific options + + Creates a new :class:`Metric` object with the name ``name``, and initializes it with optional Prometheus specific details. Calling this function with a string is identical to calling ``getMetric``. Calling this function with a table gives the metric an optional Prometheus name, type, and description. + + The elements of the table can be: + + .. csv-table:: + :delim: space + :header: Keyword, Type, Description + :widths: auto + + ``prometheusName`` ``string`` "The optional Prometheus specific name" + ``type`` ``string`` "The optional Prometheus metric type (``""counter""`` or ``""gauge""``)" + ``description`` ``string`` "The optional Prometheus metric description" + .. class:: Metric Represents a custom metric