bareasgi_prometheus
module bareasgi_prometheus ¶
Summary¶
bareASGI prometheus middleware
Description¶
Provides metrics for requests to a bareASGI web service.
function bareasgi_prometheus.add_prometheus_middleware ¶
Summary¶
Adds prometheus middleware as the first middleware.
bareasgi_prometheus.add_prometheus_middleware(
app: Application,
*,
metric_type: Optional[Type[HttpRequestMetric]],
host: Optional[str],
app_name: Optional[str],
metrics_path: Optional[str]
) -> ApplicationParameters¶
app: ApplicationThe ASGI application
metric_type: Optional[Type[HttpRequestMetric]] (optional)An optional custom request monitor. Defaults to None.
host: Optional[str] (optional)An optional path for the metrics. Defaults to None.
app_name: Optional[str] (optional)The application name. Defaults to None.
metrics_path: Optional[str] (optional)The path from which the metrics will be served. Defaults to '/metrics'.
async function bareasgi_prometheus.prometheus_view ¶
Summary¶
The endpoint for prometheus stats
async bareasgi_prometheus.prometheus_view(
_request: HttpRequest
) -> HttpResponseclass HttpRequestMetric(TimedMetric) ¶
Summary¶
Create an HTTP request metric
bareasgi_prometheus.metrics.HttpRequestMetric(
host: str,
app_name: str,
request: HttpRequest
) -> NoneParameters¶
host: strThe host
app_name: strThe name of the application
request: HttpRequestThe request
class PrometheusHttpRequestMetric(HttpRequestMetric) ¶
Summary¶
Create an HTTP request metric
bareasgi_prometheus.metrics.PrometheusHttpRequestMetric(
host: str,
app_name: str,
request: HttpRequest
) -> NoneParameters¶
host: strThe host
app_name: strThe name of the application
request: HttpRequestThe request
class PrometheusMiddleware ¶
Summary¶
Prometheus middleware
bareasgi_prometheus.PrometheusMiddleware(
*,
metric_type: Type[HttpRequestMetric],
host: Optional[str],
app_name: Optional[str]
) -> NoneParameters¶
metric_type: Type[HttpRequestMetric] (optional)The metric type. Defaults to None.
host: Optional[str] (optional)The host. Defaults to None.
app_name: Optional[str] (optional)The application name. Defaults to None.