Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Metric tap agent #161

Merged
merged 10 commits into from
May 13, 2024
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
2 changes: 1 addition & 1 deletion Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion tap-agent/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ ethereum-types = "0.14.1"
eventuals = "0.6.7"
log = "0.4.19"
prometheus = "0.13.3"
axum = "0.6.18"
axum = "0.7.5"
futures-util = "0.3.28"
indexer-common = { version = "0.1.0", path = "../common" }
jsonrpsee = { version = "0.20.2", features = ["http-client", "macros"] }
Expand Down
5 changes: 3 additions & 2 deletions tap-agent/src/metrics.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@

use std::{net::SocketAddr, panic};

use axum::{http::StatusCode, response::IntoResponse, routing::get, Router, Server};
use axum::{http::StatusCode, response::IntoResponse, routing::get, Router};
use futures_util::FutureExt;
use jsonrpsee::tracing::error;
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hmm I can't remember why I used jsonrpsee::tracing::error here https://github.com/semiotic-ai/timeline-aggregation-protocol/blob/c179dfedee1ed8078b358de3d35f4d051f74c9c1/tap_aggregator/src/metrics.rs#L8
But in any case, it should look less weird with tracing::error instead.

use log::{debug, info};
Expand Down Expand Up @@ -34,7 +34,8 @@ async fn _run_server(port: u16) {
.route("/metrics", get(handler_metrics))
.fallback(handler_404);
let addr = SocketAddr::from(([0, 0, 0, 0], port));
let server = Server::bind(&addr).serve(app.into_make_service());
let listener = tokio::net::TcpListener::bind(addr).await.unwrap();
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

use expect instead of unwrap and add information: "Failed to bind metrics address"

let server = axum::serve(listener, app.into_make_service());

info!("Metrics server listening on {}", addr);

Expand Down