Page Menu
Home
Phabricator
Search
Configure Global Search
Log In
Files
F3502475
D6247.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Award Token
Flag For Later
Size
4 KB
Referenced Files
None
Subscribers
None
D6247.diff
View Options
diff --git a/services/backup/Cargo.lock b/services/backup/Cargo.lock
--- a/services/backup/Cargo.lock
+++ b/services/backup/Cargo.lock
@@ -416,6 +416,7 @@
"tonic",
"tonic-build",
"tracing",
+ "tracing-futures",
"tracing-subscriber",
"uuid",
]
@@ -664,6 +665,21 @@
"percent-encoding",
]
+[[package]]
+name = "futures"
+version = "0.3.25"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "38390104763dc37a5145a53c29c63c1290b5d316d6086ec32c293f6736051bb0"
+dependencies = [
+ "futures-channel",
+ "futures-core",
+ "futures-executor",
+ "futures-io",
+ "futures-sink",
+ "futures-task",
+ "futures-util",
+]
+
[[package]]
name = "futures-channel"
version = "0.3.25"
@@ -671,6 +687,7 @@
checksum = "52ba265a92256105f45b719605a571ffe2d1f0fea3807304b522c1d778f79eed"
dependencies = [
"futures-core",
+ "futures-sink",
]
[[package]]
@@ -679,6 +696,23 @@
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "04909a7a7e4633ae6c4a9ab280aeb86da1236243a77b694a49eacd659a4bd3ac"
+[[package]]
+name = "futures-executor"
+version = "0.3.25"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "7acc85df6714c176ab5edf386123fafe217be88c0840ec11f199441134a074e2"
+dependencies = [
+ "futures-core",
+ "futures-task",
+ "futures-util",
+]
+
+[[package]]
+name = "futures-io"
+version = "0.3.25"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "00f5fb52a06bdcadeb54e8d3671f8888a39697dcb0b81b23b55174030427f4eb"
+
[[package]]
name = "futures-macro"
version = "0.3.25"
@@ -708,9 +742,13 @@
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "197676987abd2f9cadff84926f410af1c183608d36641465df73ae8211dc65d6"
dependencies = [
+ "futures-channel",
"futures-core",
+ "futures-io",
"futures-macro",
+ "futures-sink",
"futures-task",
+ "memchr",
"pin-project-lite",
"pin-utils",
"slab",
@@ -1828,6 +1866,8 @@
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "97d095ae15e245a057c8e8451bab9b3ee1e1f68e9ba2b4fbc18d0ac5237835f2"
dependencies = [
+ "futures",
+ "futures-task",
"pin-project",
"tracing",
]
diff --git a/services/backup/Cargo.toml b/services/backup/Cargo.toml
--- a/services/backup/Cargo.toml
+++ b/services/backup/Cargo.toml
@@ -22,6 +22,7 @@
tokio-stream = "0.1"
tonic = "0.8"
tracing = "0.1"
+tracing-futures = { version = "0.2", features = ["futures-03"] }
tracing-subscriber = { version = "0.3", features = ["env-filter"]}
uuid = { version = "1.2", features = ["v4"] }
diff --git a/services/backup/src/service/handlers/pull_backup.rs b/services/backup/src/service/handlers/pull_backup.rs
--- a/services/backup/src/service/handlers/pull_backup.rs
+++ b/services/backup/src/service/handlers/pull_backup.rs
@@ -2,6 +2,7 @@
use tokio_stream::{Stream, StreamExt};
use tonic::Status;
use tracing::{debug, error, trace, warn};
+use tracing_futures::Instrument;
use super::handle_db_error;
use super::proto::{self, PullBackupResponse};
@@ -74,15 +75,17 @@
debug!("Pulling logs...");
for log in self.logs {
trace!("Pulling log ID={}", &log.log_id);
+ let span = tracing::trace_span!("log", log_id = &log.log_id);
if log.persisted_in_blob {
- trace!("Log persisted in blob");
- let log_data_stream = data_stream(&log);
+ trace!(parent: &span, "Log persisted in blob");
+ let log_data_stream = data_stream(&log).instrument(span);
tokio::pin!(log_data_stream);
while let Some(response) = log_data_stream.try_next().await? {
yield response;
}
} else {
+ trace!(parent: &span, "Log persisted in database");
yield proto::PullBackupResponse {
attachment_holders: Some(log.attachment_holders),
id: Some(Id::LogId(log.log_id)),
diff --git a/services/backup/src/service/mod.rs b/services/backup/src/service/mod.rs
--- a/services/backup/src/service/mod.rs
+++ b/services/backup/src/service/mod.rs
@@ -4,7 +4,8 @@
use tokio::sync::mpsc;
use tokio_stream::{wrappers::ReceiverStream, Stream, StreamExt};
use tonic::{Request, Response, Status};
-use tracing::{debug, error, info, instrument, trace, warn, Instrument};
+use tracing::{debug, error, info, instrument, trace, warn};
+use tracing_futures::Instrument;
use crate::{
constants::MPSC_CHANNEL_BUFFER_CAPACITY,
@@ -184,7 +185,7 @@
let handler =
PullBackupHandler::new(&self.db, request.into_inner()).await?;
- let stream = handler.into_response_stream();
+ let stream = handler.into_response_stream().in_current_span();
Ok(Response::new(Box::pin(stream) as Self::PullBackupStream))
}
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Sat, Dec 21, 4:17 AM (18 h, 19 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
2683522
Default Alt Text
D6247.diff (4 KB)
Attached To
Mode
D6247: [services][backup] PullBackup - fix tracing span
Attached
Detach File
Event Timeline
Log In to Comment