]> git.ipfire.org Git - thirdparty/pdns.git/commitdiff
Document initMetric
authorJess Bees <jesse@toomanybees.com>
Wed, 29 Oct 2025 16:58:00 +0000 (12:58 -0400)
committerJess Bees <jesse@toomanybees.com>
Wed, 29 Oct 2025 17:47:42 +0000 (13:47 -0400)
Signed-off-by: Jess Bees <jesse@toomanybees.com>
pdns/recursordist/docs/lua-scripting/statistics.rst

index eafbf1be52b79636fedd93c77fba8d8c37484022..1362e312f9fe024a0bbaa409be030831a90848fd 100644 (file)
@@ -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