// Copyright 2019 TiKV Project Authors. Licensed under Apache-2.0. use hyper::{ header::CONTENT_TYPE, service::{make_service_fn, service_fn}, Body, Request, Response, Server, }; use prometheus::{Counter, Encoder, Gauge, HistogramVec, TextEncoder}; use lazy_static::lazy_static; use prometheus::{labels, opts, register_counter, register_gauge, register_histogram_vec}; lazy_static! { static ref HTTP_COUNTER: Counter = register_counter!(opts!( "example_http_requests_total", "Number of HTTP requests made.", labels! {"handler" => "all",} )) .unwrap(); static ref HTTP_BODY_GAUGE: Gauge = register_gauge!(opts!( "example_http_response_size_bytes", "The HTTP response sizes in bytes.", labels! {"handler" => "all",} )) .unwrap(); static ref HTTP_REQ_HISTOGRAM: HistogramVec = register_histogram_vec!( "example_http_request_duration_seconds", "The HTTP request latencies in seconds.", &["handler"] ) .unwrap(); } async fn serve_req(_req: Request
) -> Result