Skip to content

prometheus

InferenceInstrumentator

Class responsible for managing the Prometheus metrics for the inference server.

This class inititalizes the Prometheus Instrumentator and exposes the metrics endpoint.

Source code in inference/core/managers/prometheus.py
14
15
16
17
18
19
20
21
22
23
24
25
26
class InferenceInstrumentator:
    """
    Class responsible for managing the Prometheus metrics for the inference server.

    This class inititalizes the Prometheus Instrumentator and exposes the metrics endpoint.

    """

    def __init__(self, app, model_manager, endpoint: str = "/metrics"):
        self.instrumentator = Instrumentator()
        self.instrumentator.instrument(app).expose(app, endpoint)
        self.collector = CustomCollector(model_manager)
        REGISTRY.register(self.collector)