Skip to content

Commit

Permalink
chore: added info logs
Browse files Browse the repository at this point in the history
  • Loading branch information
paulobressan committed Jan 4, 2024
1 parent 7a73da0 commit 760e113
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 3 deletions.
4 changes: 3 additions & 1 deletion operator/src/controller.rs
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ use kube::{
use schemars::JsonSchema;
use serde::{Deserialize, Serialize};
use std::{sync::Arc, time::Duration};
use tracing::error;
use tracing::{error, info};

use crate::{
gateway::{handle_reference_grant, handle_tls_route},
Expand Down Expand Up @@ -65,6 +65,8 @@ fn error_policy(crd: Arc<CardanoNodePort>, err: &Error, ctx: Arc<Context>) -> Ac
}

pub async fn run(state: Arc<State>) {
info!("listening crds running");

let client = Client::try_default()
.await
.expect("failed to create kube client");
Expand Down
5 changes: 3 additions & 2 deletions operator/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ use actix_web::{
use dotenv::dotenv;
use prometheus::{Encoder, TextEncoder};
use std::{io, sync::Arc};
use tracing::Level;
use tracing::{info, Level};

use ext_cardano_node::{controller, metrics as metrics_collector, State};

Expand Down Expand Up @@ -42,7 +42,8 @@ async fn main() -> io::Result<()> {
.service(health)
.service(metrics)
})
.bind(addr)?;
.bind(&addr)?;
info!({ addr }, "metrics server running");

tokio::join!(server.run(), controller, metrics_collector).0?;

Expand Down
3 changes: 3 additions & 0 deletions operator/src/metrics.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ use std::{sync::Arc, time::Duration};

use kube::ResourceExt;
use prometheus::{opts, IntCounterVec, Registry};
use tracing::info;

use crate::{CardanoNodePort, Error, State};

Expand Down Expand Up @@ -40,6 +41,8 @@ impl Metrics {
}

pub async fn run_metrics_collector(_state: Arc<State>) {
info!("collecting metrics running");

tokio::spawn(async {
loop {
tokio::time::sleep(Duration::from_secs(6)).await;
Expand Down

0 comments on commit 760e113

Please sign in to comment.