Skip to content

Commit 487dbea

Browse files
committed
downgrade some logs
1 parent f410c52 commit 487dbea

5 files changed

Lines changed: 18 additions & 18 deletions

File tree

src/bin/operator.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ use kube::{
1313
};
1414
use prometheus::Encoder;
1515
use tower_http::trace::TraceLayer;
16-
use tracing::{info, warn};
16+
use tracing::{debug, info, warn};
1717

1818
use postgres_restore_operator::{
1919
context::Context,
@@ -243,7 +243,7 @@ async fn livez(State(state): State<ProbeState>) -> (StatusCode, &'static str) {
243243
let last = state.heartbeat.load(Ordering::Relaxed);
244244
let age = chrono::Utc::now().timestamp() - last;
245245
if age <= 30 {
246-
info!(heartbeat_age_secs = age, "livez ok");
246+
debug!(heartbeat_age_secs = age, "livez ok");
247247
(StatusCode::OK, "ok")
248248
} else {
249249
tracing::warn!(
@@ -259,7 +259,7 @@ async fn readyz(State(state): State<ProbeState>) -> (StatusCode, &'static str) {
259259
let last = state.heartbeat.load(Ordering::Relaxed);
260260
let age = chrono::Utc::now().timestamp() - last;
261261
if age <= 30 {
262-
info!(heartbeat_age_secs = age, "readyz ok");
262+
debug!(heartbeat_age_secs = age, "readyz ok");
263263
(StatusCode::OK, "ok")
264264
} else {
265265
tracing::warn!(

src/controllers/overlay.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ use kube::{
1616
};
1717

1818
use kube_quantity::ParsedQuantity;
19-
use tracing::{info, warn};
19+
use tracing::{debug, info, warn};
2020

2121
use super::env_from_secret;
2222
use crate::{
@@ -343,7 +343,7 @@ pub async fn ensure_cnpg_cluster(
343343
.unwrap_or_default();
344344

345345
if status.is_ready() {
346-
info!(
346+
debug!(
347347
replica = replica_name,
348348
cluster = cluster_name,
349349
"overlay CNPG cluster is ready"
@@ -386,7 +386,7 @@ pub async fn ensure_overlay_service_annotations(
386386
let services: Api<Service> = Api::namespaced(client.clone(), namespace);
387387

388388
if services.get_opt(&svc_name).await?.is_none() {
389-
info!(
389+
debug!(
390390
replica = replica_name,
391391
service = svc_name,
392392
"overlay -rw service not yet created by CNPG, skipping annotation patch"
@@ -412,7 +412,7 @@ pub async fn ensure_overlay_service_annotations(
412412
)
413413
.await?;
414414

415-
info!(
415+
debug!(
416416
replica = replica_name,
417417
service = svc_name,
418418
count = annotations.len(),

src/controllers/replica.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ use kube::{
88
runtime::controller::Action,
99
};
1010
use rand::RngExt;
11-
use tracing::{info, warn};
11+
use tracing::{debug, info, warn};
1212

1313
use super::{overlay, read_job_termination_message};
1414
use crate::{
@@ -420,7 +420,7 @@ pub async fn reconcile(replica: Arc<PostgresPhysicalReplica>, ctx: Arc<Context>)
420420
// 9. Decide whether to trigger a new restore
421421
if let Some(in_progress) = in_progress_restore {
422422
let phase = in_progress.status.as_ref().and_then(|s| s.phase.as_ref());
423-
info!(
423+
debug!(
424424
replica = name,
425425
restore = in_progress.name_any(),
426426
phase = ?phase,
@@ -519,7 +519,7 @@ pub async fn reconcile(replica: Arc<PostgresPhysicalReplica>, ctx: Arc<Context>)
519519

520520
// "{}" means no matching snapshots were found
521521
if raw == "{}" {
522-
info!(
522+
warn!(
523523
replica = name,
524524
"snapshot list job returned no matching snapshots"
525525
);
@@ -536,7 +536,7 @@ pub async fn reconcile(replica: Arc<PostgresPhysicalReplica>, ctx: Arc<Context>)
536536
let current_snapshot_id = active_restore.map(|r| r.spec.snapshot.as_str());
537537

538538
if current_snapshot_id == Some(&snap.id) {
539-
info!(
539+
debug!(
540540
replica = name,
541541
snapshot = snap.id,
542542
"latest snapshot already active, skipping"

src/controllers/replica/scheduling.rs

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ use std::time::Duration;
22

33
use chrono::Utc;
44
use kube::ResourceExt;
5-
use tracing::{info, warn};
5+
use tracing::{debug, info, warn};
66

77
use crate::{types::*, util::parse_duration};
88

@@ -43,7 +43,7 @@ pub fn compute_next_scheduled_restore(schedule: &str) -> Option<chrono::DateTime
4343
pub fn should_trigger_scheduled_restore(replica: &PostgresPhysicalReplica) -> bool {
4444
let name = replica.name_any();
4545
let Some(schedule) = &replica.spec.schedule else {
46-
info!(replica = %name, "no schedule configured, skipping scheduled restore");
46+
debug!(replica = %name, "no schedule configured, skipping scheduled restore");
4747
return false;
4848
};
4949

@@ -58,7 +58,7 @@ pub fn should_trigger_scheduled_restore(replica: &PostgresPhysicalReplica) -> bo
5858
let elapsed = Utc::now().signed_duration_since(last_completed);
5959
if elapsed.to_std().unwrap_or_default() < minimum_ttl {
6060
let remaining = minimum_ttl - elapsed.to_std().unwrap_or_default();
61-
info!(
61+
debug!(
6262
replica = %name,
6363
minimum_ttl_secs = minimum_ttl.as_secs(),
6464
remaining_secs = remaining.as_secs(),
@@ -98,7 +98,7 @@ pub fn should_trigger_scheduled_restore(replica: &PostgresPhysicalReplica) -> bo
9898
);
9999
return true;
100100
}
101-
info!(
101+
debug!(
102102
replica = %name,
103103
next_scheduled = %next,
104104
trigger_at = %trigger_at,
@@ -124,7 +124,7 @@ pub fn should_trigger_scheduled_restore(replica: &PostgresPhysicalReplica) -> bo
124124
return true;
125125
}
126126

127-
info!(
127+
debug!(
128128
replica = %name,
129129
schedule = schedule,
130130
"no nextScheduledRestore set and no cron occurrence in 24h lookback window, skipping"

src/controllers/restore.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ use kube::{
1414
api::{ObjectMeta, Patch, PatchParams, PostParams},
1515
runtime::controller::Action,
1616
};
17-
use tracing::{info, warn};
17+
use tracing::{debug, info, warn};
1818

1919
use super::read_job_termination_message;
2020
use crate::{
@@ -202,7 +202,7 @@ async fn reconcile_restoring(
202202
let failed = job_status.as_ref().and_then(|s| s.failed).unwrap_or(0);
203203

204204
if succeeded > 0 {
205-
info!(restore = name, "restore job succeeded");
205+
debug!(restore = name, "restore job succeeded");
206206

207207
let pg_version =
208208
read_job_termination_message(client, namespace, &job_name, "restore").await;

0 commit comments

Comments
 (0)