mirror of
https://github.com/sigp/lighthouse.git
synced 2026-03-03 00:31:50 +00:00
Add global metrics registry, pass to BeaconState
This commit is contained in:
@@ -6,6 +6,7 @@ use beacon_chain::{BeaconChain, BeaconChainTypes};
|
||||
use futures::Future;
|
||||
use iron::prelude::*;
|
||||
use network::NetworkMessage;
|
||||
use prometheus::Registry;
|
||||
use router::Router;
|
||||
use slog::{info, o, warn};
|
||||
use std::sync::Arc;
|
||||
@@ -31,13 +32,14 @@ impl Default for HttpServerConfig {
|
||||
/// Build the `iron` HTTP server, defining the core routes.
|
||||
pub fn create_iron_http_server<T: BeaconChainTypes + 'static>(
|
||||
beacon_chain: Arc<BeaconChain<T>>,
|
||||
metrics_registry: Registry,
|
||||
) -> Iron<Router> {
|
||||
let mut router = Router::new();
|
||||
|
||||
// A `GET` request to `/metrics` is handled by the `metrics` module.
|
||||
router.get(
|
||||
"/metrics",
|
||||
metrics::build_handler(beacon_chain.clone()),
|
||||
metrics::build_handler(beacon_chain.clone(), metrics_registry),
|
||||
"metrics",
|
||||
);
|
||||
|
||||
@@ -53,6 +55,7 @@ pub fn start_service<T: BeaconChainTypes + 'static>(
|
||||
executor: &TaskExecutor,
|
||||
_network_chan: crossbeam_channel::Sender<NetworkMessage>,
|
||||
beacon_chain: Arc<BeaconChain<T>>,
|
||||
metrics_registry: Registry,
|
||||
log: &slog::Logger,
|
||||
) -> exit_future::Signal {
|
||||
let log = log.new(o!("Service"=>"HTTP"));
|
||||
@@ -63,7 +66,7 @@ pub fn start_service<T: BeaconChainTypes + 'static>(
|
||||
let (shutdown_trigger, wait_for_shutdown) = exit_future::signal();
|
||||
|
||||
// Create an `iron` http, without starting it yet.
|
||||
let iron = create_iron_http_server(beacon_chain);
|
||||
let iron = create_iron_http_server(beacon_chain, metrics_registry);
|
||||
|
||||
// Create a HTTP server future.
|
||||
//
|
||||
|
||||
Reference in New Issue
Block a user