Skip to content

Commit

Permalink
Remove remi.service from event kv in tracing
Browse files Browse the repository at this point in the history
  • Loading branch information
auguwu committed Oct 21, 2024
1 parent e9c90bb commit d105829
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 23 deletions.
16 changes: 3 additions & 13 deletions crates/azure/src/service.rs
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,8 @@ impl remi::StorageService for StorageService {
name = "remi.azure.init",
skip_all,
fields(
remi.service = "azure"
remi.service = "azure",
container = self.config.container,
)
)
)]
Expand All @@ -98,11 +99,7 @@ impl remi::StorageService for StorageService {
}

#[cfg(feature = "tracing")]
::tracing::info!(
remi.service = "azure",
container = self.config.container,
"creating blob container as it doesn't exist"
);
::tracing::info!("creating blob container as it doesn't exist");

#[cfg(feature = "log")]
::log::info!(
Expand All @@ -129,7 +126,6 @@ impl remi::StorageService for StorageService {

#[cfg(feature = "tracing")]
::tracing::info!(
remi.service = "azure",
container = self.config.container,
path = %path.display(),
"opening blob in container"
Expand Down Expand Up @@ -166,7 +162,6 @@ impl remi::StorageService for StorageService {

#[cfg(feature = "tracing")]
::tracing::info!(
remi.service = "azure",
container = self.config.container,
path = %path.display(),
"opening blob in container"
Expand Down Expand Up @@ -242,7 +237,6 @@ impl remi::StorageService for StorageService {
if let Some(path) = path {
#[cfg(feature = "tracing")]
::tracing::warn!(
remi.service = "gridfs",
file = %path.as_ref().display(),
"using blobs() with a given file name is not supported",
);
Expand Down Expand Up @@ -322,7 +316,6 @@ impl remi::StorageService for StorageService {

#[cfg(feature = "tracing")]
::tracing::info!(
remi.service = "azure",
container = self.config.container,
path = %path.display(),
"deleting blob in container"
Expand Down Expand Up @@ -359,7 +352,6 @@ impl remi::StorageService for StorageService {

#[cfg(feature = "tracing")]
::tracing::info!(
remi.service = "azure",
container = self.config.container,
path = %path.display(),
"checking if blob is in container"
Expand Down Expand Up @@ -391,7 +383,6 @@ impl remi::StorageService for StorageService {

#[cfg(feature = "tracing")]
::tracing::info!(
remi.service = "azure",
container = self.config.container,
path = %path.display(),
"uploading blob to container"
Expand All @@ -408,7 +399,6 @@ impl remi::StorageService for StorageService {
if client.exists().await? {
#[cfg(feature = "tracing")]
::tracing::warn!(
remi.service = "azure",
container = self.config.container,
path = %path.display(),
"blob with path already exists in container, skipping"
Expand Down
16 changes: 6 additions & 10 deletions crates/gridfs/src/service.rs
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@ fn document_to_blob(bytes: Bytes, doc: &RawDocument) -> Result<File, mongodb::er
metadata: map,
created_at: if created_at.timestamp_millis() < 0 {
#[cfg(feature = "tracing")]
::tracing::warn!(remi.service = "gridfs", %filename, "`created_at` timestamp was negative");
::tracing::warn!(%filename, "`created_at` timestamp was negative");

#[cfg(feature = "log")]
::log::warn!("`created_at` for file {filename} was negative");
Expand Down Expand Up @@ -197,7 +197,7 @@ impl remi::StorageService for StorageService {
let path = self.resolve_path(path)?;

#[cfg(feature = "tracing")]
::tracing::info!(remi.service = "gridfs", file = %path, "opening file");
::tracing::info!(file = %path, "opening file");

#[cfg(feature = "log")]
::log::info!("opening file [{}]", path);
Expand All @@ -207,7 +207,6 @@ impl remi::StorageService for StorageService {
if !advanced {
#[cfg(feature = "tracing")]
::tracing::warn!(
remi.service = "gridfs",
file = %path,
"file doesn't exist in GridFS"
);
Expand Down Expand Up @@ -257,7 +256,6 @@ impl remi::StorageService for StorageService {

#[cfg(feature = "tracing")]
::tracing::info!(
remi.service = "gridfs",
file = %path,
"getting file metadata for file"
);
Expand All @@ -276,7 +274,7 @@ impl remi::StorageService for StorageService {
let has_advanced = cursor.advance().await?;
if !has_advanced {
#[cfg(feature = "tracing")]
::tracing::warn!(remi.service = "gridfs", file = %path, "file doesn't exist");
::tracing::warn!(file = %path, "file doesn't exist");

#[cfg(feature = "log")]
::log::warn!("file [{}] doesn't exist", path);
Expand Down Expand Up @@ -309,7 +307,6 @@ impl remi::StorageService for StorageService {
if let Some(path) = path {
#[cfg(feature = "tracing")]
::tracing::warn!(
remi.service = "gridfs",
file = %path.as_ref().display(),
"using blobs() with a given file name is not supported",
);
Expand Down Expand Up @@ -349,7 +346,7 @@ impl remi::StorageService for StorageService {
#[cfg(any(feature = "tracing", feature = "log"))]
Err(e) => {
#[cfg(feature = "tracing")]
::tracing::error!(remi.service = "gridfs", error = %e, "unable to convert to a file");
::tracing::error!(error = %e, "unable to convert to a file");

#[cfg(feature = "log")]
::log::error!("unable to convert to a file: {e}");
Expand Down Expand Up @@ -378,7 +375,7 @@ impl remi::StorageService for StorageService {
let path = self.resolve_path(path)?;

#[cfg(feature = "tracing")]
::tracing::info!(remi.service = "gridfs", file = %path, "deleting file");
::tracing::info!(file = %path, "deleting file");

#[cfg(feature = "log")]
::log::info!("deleting file [{}]", path);
Expand All @@ -394,7 +391,7 @@ impl remi::StorageService for StorageService {
let has_advanced = cursor.advance().await?;
if !has_advanced {
#[cfg(feature = "tracing")]
::tracing::warn!(remi.service = "gridfs", file = %path, "file doesn't exist");
::tracing::warn!(file = %path, "file doesn't exist");

#[cfg(feature = "log")]
::log::warn!("file [{}] doesn't exist", path);
Expand Down Expand Up @@ -443,7 +440,6 @@ impl remi::StorageService for StorageService {

#[cfg(feature = "tracing")]
::tracing::info!(
remi.service = "gridfs",
file = %path,
"uploading file to GridFS..."
);
Expand Down

0 comments on commit d105829

Please sign in to comment.