Skip to content

PrometheusResource

PrometheusResource

Prometheus metrics export for PiKVM.

Source code in src/aiopikvm/resources/prometheus.py
class PrometheusResource(BaseResource):
    """Prometheus metrics export for PiKVM."""

    async def get_metrics(self) -> str:
        """Get Prometheus metrics in text exposition format.

        Returns:
            Prometheus metrics as plain text.
        """
        response = await self._get_raw(
            "/api/export/prometheus/metrics",
            accept="text/plain",
        )
        return response.text

get_metrics() async

Get Prometheus metrics in text exposition format.

Returns:

Type Description
str

Prometheus metrics as plain text.

Source code in src/aiopikvm/resources/prometheus.py
async def get_metrics(self) -> str:
    """Get Prometheus metrics in text exposition format.

    Returns:
        Prometheus metrics as plain text.
    """
    response = await self._get_raw(
        "/api/export/prometheus/metrics",
        accept="text/plain",
    )
    return response.text