Skip to content

Commit

Permalink
chore: Unify autometrics versions
Browse files Browse the repository at this point in the history
  • Loading branch information
klochowicz committed Jun 7, 2023
1 parent bea50ec commit ce8fd73
Show file tree
Hide file tree
Showing 7 changed files with 61 additions and 73 deletions.
122 changes: 55 additions & 67 deletions 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 coordinator/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ edition = "2021"
[dependencies]
anyhow = { version = "1", features = ["backtrace"] }
atty = "0.2.14"
autometrics = { version = "0.4.1", features = ["prometheus-exporter"] }
autometrics = { version = "0.5", features = ["prometheus-exporter"] }
axum = { version = "0.6.7", features = ["ws", "query"] }
bdk = { version = "0.27.0", default-features = false, features = ["key-value-db", "use-esplora-blocking"] }
bitcoin = "0.29"
Expand Down
2 changes: 1 addition & 1 deletion coordinator/src/bin/coordinator.rs
Original file line number Diff line number Diff line change
Expand Up @@ -226,7 +226,7 @@ async fn main() -> Result<()> {
let app = router(node, pool, settings);

// Start the metrics exporter
let _exporter = autometrics::global_metrics_exporter();
autometrics::prometheus_exporter::init();

tracing::debug!("listening on http://{}", http_address);
axum::Server::bind(&http_address)
Expand Down
2 changes: 2 additions & 0 deletions coordinator/src/node/connection.rs
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
use autometrics::autometrics;
use lightning::ln::msgs::NetAddress;
use ln_dlc_node::node::Node;
use ln_dlc_node::node::NodeInfo;
Expand All @@ -10,6 +11,7 @@ use std::sync::Arc;
use std::time::Duration;
use tokio::task::spawn_blocking;

#[autometrics]
pub async fn keep_public_channel_peers_connected(
node: Arc<Node<PaymentMap>>,
check_interval: Duration,
Expand Down
2 changes: 1 addition & 1 deletion coordinator/src/routes.rs
Original file line number Diff line number Diff line change
Expand Up @@ -365,7 +365,7 @@ async fn update_settings(
}

pub async fn get_metrics() -> impl IntoResponse {
match autometrics::encode_global_metrics() {
match autometrics::prometheus_exporter::encode_to_string() {
Ok(metrics) => (StatusCode::OK, metrics),
Err(err) => (StatusCode::INTERNAL_SERVER_ERROR, format!("{:?}", err)),
}
Expand Down
2 changes: 1 addition & 1 deletion crates/ln-dlc-node/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ description = "A common interface for using Lightning and DLC channels side-by-s

[dependencies]
anyhow = { version = "1", features = ["backtrace"] }
autometrics = "0.4.1"
autometrics = "0.5"
bdk = { version = "0.27.0", default-features = false, features = ["key-value-db", "use-esplora-blocking"] }
bip39 = { version = "2", features = ["rand_core"] }
bitcoin = "0.29"
Expand Down
2 changes: 0 additions & 2 deletions crates/ln-dlc-node/src/node/connection.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,14 +3,12 @@ use crate::node::NodeInfo;
use anyhow::bail;
use anyhow::Context;
use anyhow::Result;
use autometrics::autometrics;
use bitcoin::secp256k1::PublicKey;
use futures::Future;
use std::pin::Pin;
use std::time::Duration;

impl<P> Node<P> {
#[autometrics]
pub async fn connect(&self, peer: NodeInfo) -> Result<Pin<Box<impl Future<Output = ()>>>> {
#[allow(clippy::async_yields_async)] // We want to poll this future in a loop elsewhere
let connection_closed_future = tokio::time::timeout(Duration::from_secs(15), async {
Expand Down

0 comments on commit ce8fd73

Please sign in to comment.