Add Prometheus metrics relabeling (#2238)

Co-authored-by: Jan Grewe <jan.grewe@flixbus.com>
This commit is contained in:
Jan Grewe 2022-08-30 00:55:58 +02:00 committed by GitHub
parent 2e34f4772b
commit c588816013
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -29,6 +29,7 @@ Configuration variables:
- **id** (*Optional*, :ref:`config-id`): Manually specify the ID used for code generation. - **id** (*Optional*, :ref:`config-id`): Manually specify the ID used for code generation.
- **include_internal** (*Optional*, boolean): Whether ``internal`` entities should be displayed on the - **include_internal** (*Optional*, boolean): Whether ``internal`` entities should be displayed on the
web interface. Defaults to ``false``. web interface. Defaults to ``false``.
- **relabel** (*Optional*): Override metric labels. See :ref:`prometheus-relabel`
.. note:: .. note::
@ -41,6 +42,32 @@ Configuration variables:
static_configs: static_configs:
- targets: [<ip or node_name.local>] - targets: [<ip or node_name.local>]
Metric Relabeling
-----------------
ESPHome allows you to do some basic relabeling of Prometheus metrics.
This is useful if you want to have different metric names or IDs than those shown in Home Assistant or the web interface.
You can relabel metric name or ID labels by adding a ``relabel`` block in the ``prometheus`` configuration,
and then adding a block with ``id`` and/or ``name`` fields for each sensor whose labels your want to override.
.. _prometheus-relabel:
``relabel``
***********
Set the the ``id`` and ``name`` label values of the Prometheus metric for the sensor with the specified ID.
.. code-block:: yaml
# Example configuration entry
prometheus:
relabel:
my_voltage_sensor:
id: angry_pixies
name: "Angry Pixies"
See Also See Also
-------- --------