Skip to content

Commit bd58761

Browse files
chore: remove unwanted error and warning logs
1. on fresh deployment - server startup - when alerts and targets load 2. on delete stream - at query node - delete stats 3. on delete stream - at query node - delete staging 4. get_objects in object store
1 parent 37dbeb6 commit bd58761

8 files changed

Lines changed: 51 additions & 32 deletions

File tree

src/handlers/http/modal/ingest/ingestor_logstream.rs

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@ use actix_web::{
2626
use bytes::Bytes;
2727
use tracing::warn;
2828

29+
use crate::option::Mode;
2930
use crate::{
3031
catalog::remove_manifest_from_snapshot,
3132
handlers::http::logstream::error::StreamError,
@@ -77,7 +78,12 @@ pub async fn delete(
7778
let tenant_id = get_tenant_id_from_request(&req);
7879
// Delete from staging
7980
let stream_dir = PARSEABLE.get_stream(&stream_name, &tenant_id)?;
80-
if let Err(err) = fs::remove_dir_all(&stream_dir.data_path) {
81+
82+
// delete staging only for ingest server or standalone server
83+
// else skip
84+
if (PARSEABLE.options.mode == Mode::Ingest || PARSEABLE.options.mode == Mode::All)
85+
&& let Err(err) = fs::remove_dir_all(&stream_dir.data_path)
86+
{
8187
warn!(
8288
"failed to delete local data for stream {} with error {err}. Clean {} manually",
8389
stream_name,

src/handlers/http/modal/mod.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -130,7 +130,7 @@ pub trait ParseableServer {
130130
.backlog(PARSEABLE.options.connection_backlog)
131131
.max_connections(PARSEABLE.options.max_connections)
132132
.shutdown_timeout(60);
133-
tracing::warn!(
133+
tracing::info!(
134134
"Starting server with-\nNum workers: {}\nKeep Alive: {}\nRequest timeout: {}\nConnection backlog: {}\nMax connections: {}",
135135
PARSEABLE.options.num_workers,
136136
PARSEABLE.options.keep_alive,

src/metastore/metastores/object_store_metastore.rs

Lines changed: 23 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -65,6 +65,14 @@ pub struct ObjectStoreMetastore {
6565
pub storage: Arc<dyn ObjectStorage>,
6666
}
6767

68+
fn is_missing_optional_dir(err: &ObjectStorageError) -> bool {
69+
match err {
70+
ObjectStorageError::NoSuchKey(_) => true,
71+
ObjectStorageError::IoError(err) => err.kind() == std::io::ErrorKind::NotFound,
72+
_ => false,
73+
}
74+
}
75+
6876
#[async_trait]
6977
impl Metastore for ObjectStoreMetastore {
7078
/// Since Parseable already starts with a connection to an object store, no need to implement this
@@ -263,7 +271,7 @@ impl Metastore for ObjectStoreMetastore {
263271
let mut all_alerts = HashMap::new();
264272
for mut tenant in base_paths {
265273
let alerts_path = RelativePathBuf::from_iter([&tenant, ALERTS_ROOT_DIRECTORY]);
266-
let alerts = self
274+
let alerts = match self
267275
.storage
268276
.get_objects(
269277
Some(&alerts_path),
@@ -272,7 +280,12 @@ impl Metastore for ObjectStoreMetastore {
272280
}),
273281
&Some(tenant.clone()),
274282
)
275-
.await?;
283+
.await
284+
{
285+
Ok(alerts) => alerts,
286+
Err(err) if is_missing_optional_dir(&err) => Vec::new(),
287+
Err(err) => return Err(MetastoreError::ObjectStorageError(err)),
288+
};
276289
if tenant.is_empty() {
277290
tenant.clone_from(&DEFAULT_TENANT.to_string());
278291
}
@@ -1122,14 +1135,20 @@ impl Metastore for ObjectStoreMetastore {
11221135
SETTINGS_ROOT_DIRECTORY,
11231136
TARGETS_ROOT_DIRECTORY,
11241137
]);
1125-
let targets = self
1138+
let target_bytes = match self
11261139
.storage
11271140
.get_objects(
11281141
Some(&targets_path),
11291142
Box::new(|file_name| file_name.ends_with(".json")),
11301143
&Some(tenant.clone()),
11311144
)
1132-
.await?
1145+
.await
1146+
{
1147+
Ok(targets) => targets,
1148+
Err(err) if is_missing_optional_dir(&err) => Vec::new(),
1149+
Err(err) => return Err(MetastoreError::ObjectStorageError(err)),
1150+
};
1151+
let targets = target_bytes
11331152
.iter()
11341153
.filter_map(|bytes| {
11351154
serde_json::from_slice(bytes)

src/stats.rs

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,8 @@ use crate::metrics::{
3131
EVENTS_STORAGE_SIZE_DATE, LIFETIME_EVENTS_INGESTED, LIFETIME_EVENTS_INGESTED_SIZE,
3232
LIFETIME_EVENTS_STORAGE_SIZE, STORAGE_SIZE,
3333
};
34-
use crate::parseable::DEFAULT_TENANT;
34+
use crate::option::Mode;
35+
use crate::parseable::{DEFAULT_TENANT, PARSEABLE};
3536
use crate::storage::{ObjectStorage, ObjectStorageError, ObjectStoreFormat};
3637

3738
/// Helper struct type created by copying stats values from metadata
@@ -187,6 +188,11 @@ pub fn delete_stats(
187188
format: &'static str,
188189
tenant_id: &Option<String>,
189190
) -> prometheus::Result<()> {
191+
// delete stats only for ingest server or standalone server
192+
// else skip
193+
if PARSEABLE.options.mode != Mode::Ingest && PARSEABLE.options.mode != Mode::All {
194+
return Ok(());
195+
}
190196
let event_labels = event_labels(stream_name, format, tenant_id);
191197
let storage_size_labels = storage_size_labels(stream_name, tenant_id);
192198

src/storage/azure_blob.rs

Lines changed: 4 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -320,8 +320,7 @@ impl BlobStore {
320320
#[tracing::instrument(
321321
name = "azure.get_object",
322322
skip(self),
323-
fields(path = %path, tenant = ?tenant_id, bytes = tracing::field::Empty),
324-
err
323+
fields(path = %path, tenant = ?tenant_id, bytes = tracing::field::Empty)
325324
)]
326325
async fn _get_object(
327326
&self,
@@ -446,8 +445,7 @@ impl BlobStore {
446445
#[tracing::instrument(
447446
name = "azure.list_dates",
448447
skip(self),
449-
fields(stream = %stream, tenant = ?tenant_id, dates = tracing::field::Empty),
450-
err
448+
fields(stream = %stream, tenant = ?tenant_id, dates = tracing::field::Empty)
451449
)]
452450
async fn _list_dates(
453451
&self,
@@ -651,8 +649,7 @@ impl ObjectStorage for BlobStore {
651649
#[tracing::instrument(
652650
name = "azure.head",
653651
skip(self),
654-
fields(path = %path, tenant = ?tenant_id),
655-
err
652+
fields(path = %path, tenant = ?tenant_id)
656653
)]
657654
async fn head(
658655
&self,
@@ -827,8 +824,7 @@ impl ObjectStorage for BlobStore {
827824
#[tracing::instrument(
828825
name = "azure.check",
829826
skip(self),
830-
fields(tenant = ?tenant_id, ok = tracing::field::Empty),
831-
err
827+
fields(tenant = ?tenant_id, ok = tracing::field::Empty)
832828
)]
833829
async fn check(&self, tenant_id: &Option<String>) -> Result<(), ObjectStorageError> {
834830
let result = self

src/storage/field_stats.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -453,7 +453,7 @@ impl FieldCountState {
453453

454454
if !self.approximate {
455455
self.approximate = true;
456-
warn!(
456+
debug!(
457457
"Field stats cardinality cap reached for stream {} field {}. Tracking bounded top-value candidates with max_tracked_values={}",
458458
self.stream_name, self.field_name, self.max_tracked_values
459459
);

src/storage/gcs.rs

Lines changed: 4 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -287,8 +287,7 @@ impl Gcs {
287287
#[tracing::instrument(
288288
name = "gcs.get_object",
289289
skip(self),
290-
fields(path = %path, tenant = ?tenant_id, bytes = tracing::field::Empty),
291-
err
290+
fields(path = %path, tenant = ?tenant_id, bytes = tracing::field::Empty)
292291
)]
293292
async fn _get_object(
294293
&self,
@@ -412,8 +411,7 @@ impl Gcs {
412411
#[tracing::instrument(
413412
name = "gcs.list_dates",
414413
skip(self),
415-
fields(stream = %stream, tenant = ?tenant_id, dates = tracing::field::Empty),
416-
err
414+
fields(stream = %stream, tenant = ?tenant_id, dates = tracing::field::Empty)
417415
)]
418416
async fn _list_dates(
419417
&self,
@@ -633,8 +631,7 @@ impl ObjectStorage for Gcs {
633631
#[tracing::instrument(
634632
name = "gcs.head",
635633
skip(self),
636-
fields(path = %path, tenant = ?tenant_id),
637-
err
634+
fields(path = %path, tenant = ?tenant_id)
638635
)]
639636
async fn head(
640637
&self,
@@ -809,8 +806,7 @@ impl ObjectStorage for Gcs {
809806
#[tracing::instrument(
810807
name = "gcs.check",
811808
skip(self),
812-
fields(tenant = ?tenant_id, ok = tracing::field::Empty),
813-
err
809+
fields(tenant = ?tenant_id, ok = tracing::field::Empty)
814810
)]
815811
async fn check(&self, tenant_id: &Option<String>) -> Result<(), ObjectStorageError> {
816812
let result = self

src/storage/s3.rs

Lines changed: 4 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -477,8 +477,7 @@ impl S3 {
477477
#[tracing::instrument(
478478
name = "s3.get_object",
479479
skip(self),
480-
fields(path = %path, tenant = ?tenant_id, bytes = tracing::field::Empty),
481-
err
480+
fields(path = %path, tenant = ?tenant_id, bytes = tracing::field::Empty)
482481
)]
483482
async fn _get_object(
484483
&self,
@@ -615,8 +614,7 @@ impl S3 {
615614
#[tracing::instrument(
616615
name = "s3.list_dates",
617616
skip(self),
618-
fields(stream = %stream, tenant = ?tenant_id, dates = tracing::field::Empty),
619-
err
617+
fields(stream = %stream, tenant = ?tenant_id, dates = tracing::field::Empty)
620618
)]
621619
async fn _list_dates(
622620
&self,
@@ -848,8 +846,7 @@ impl ObjectStorage for S3 {
848846
#[tracing::instrument(
849847
name = "s3.head",
850848
skip(self),
851-
fields(path = %path, tenant = ?tenant_id),
852-
err
849+
fields(path = %path, tenant = ?tenant_id)
853850
)]
854851
async fn head(
855852
&self,
@@ -1046,8 +1043,7 @@ impl ObjectStorage for S3 {
10461043
#[tracing::instrument(
10471044
name = "s3.check",
10481045
skip(self),
1049-
fields(tenant = ?tenant_id, ok = tracing::field::Empty),
1050-
err
1046+
fields(tenant = ?tenant_id, ok = tracing::field::Empty)
10511047
)]
10521048
async fn check(&self, tenant_id: &Option<String>) -> Result<(), ObjectStorageError> {
10531049
let tenant_str = tenant_id.as_deref().unwrap_or(DEFAULT_TENANT);

0 commit comments

Comments
 (0)