WIP on adding stats to the streams

This commit is contained in:
Dominik Werder
2021-05-01 18:00:05 +02:00
parent 0f9408e9f8
commit 0eb6b3364d
15 changed files with 275 additions and 192 deletions

View File

@@ -1,5 +1,5 @@
use err::Error;
use netpod::NodeConfig;
use netpod::{NodeConfig, NodeConfigCached};
use tokio::io::AsyncReadExt;
#[allow(unused_imports)]
use tracing::{debug, error, info, trace, warn};
@@ -28,10 +28,9 @@ async fn go() -> Result<(), Error> {
let mut buf = vec![];
config_file.read_to_end(&mut buf).await?;
let node_config: NodeConfig = serde_json::from_slice(&buf)?;
let node = node_config
.get_node()
.ok_or(Error::with_msg(format!("nodeid config error {:?}", node_config)))?;
retrieval::run_node(node_config.clone(), node.clone()).await?;
let node_config: Result<NodeConfigCached, Error> = node_config.into();
let node_config = node_config?;
retrieval::run_node(node_config.clone()).await?;
}
SubCmd::Client(client) => match client.client_type {
ClientType::Binned(opts) => {
@@ -93,9 +92,10 @@ fn simple_fetch() {
name: format!("{}:{}", cluster.nodes[0].host, cluster.nodes[0].port),
cluster,
};
let node = node_config.get_node().unwrap();
let node_config: Result<NodeConfigCached, Error> = node_config.into();
let node_config = node_config?;
let query_string = serde_json::to_string(&query).unwrap();
let host = tokio::spawn(httpret::host(node_config.clone(), node.clone()));
let host = tokio::spawn(httpret::host(node_config.clone()));
let req = hyper::Request::builder()
.method(http::Method::POST)
.uri("http://localhost:8360/api/1/parsed_raw")

View File

@@ -1,5 +1,5 @@
use err::Error;
use netpod::{Cluster, Node, NodeConfig};
use netpod::{Cluster, NodeConfig, NodeConfigCached};
use tokio::task::JoinHandle;
#[allow(unused_imports)]
use tracing::{debug, error, info, trace, warn};
@@ -16,13 +16,15 @@ pub fn spawn_test_hosts(cluster: Cluster) -> Vec<JoinHandle<Result<(), Error>>>
cluster: cluster.clone(),
name: format!("{}:{}", node.host, node.port),
};
let h = tokio::spawn(httpret::host(node_config, node.clone()));
let node_config: Result<NodeConfigCached, Error> = node_config.into();
let node_config = node_config.unwrap();
let h = tokio::spawn(httpret::host(node_config));
ret.push(h);
}
ret
}
pub async fn run_node(node_config: NodeConfig, node: Node) -> Result<(), Error> {
httpret::host(node_config, node).await?;
pub async fn run_node(node_config: NodeConfigCached) -> Result<(), Error> {
httpret::host(node_config).await?;
Ok(())
}