Skip to content

Commit 7f5b517

Browse files
authored
feat: add piece_length for download piece span (#1172)
Signed-off-by: Gaius <gaius.qi@gmail.com>
1 parent fe17872 commit 7f5b517

File tree

3 files changed

+23
-16
lines changed

3 files changed

+23
-16
lines changed

Cargo.lock

Lines changed: 8 additions & 8 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Cargo.toml

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ members = [
1212
]
1313

1414
[workspace.package]
15-
version = "0.2.32"
15+
version = "0.2.33"
1616
authors = ["The Dragonfly Developers"]
1717
homepage = "https://d7y.io/"
1818
repository = "https://github.com/dragonflyoss/client.git"
@@ -22,13 +22,13 @@ readme = "README.md"
2222
edition = "2021"
2323

2424
[workspace.dependencies]
25-
dragonfly-client = { path = "dragonfly-client", version = "0.2.32" }
26-
dragonfly-client-core = { path = "dragonfly-client-core", version = "0.2.32" }
27-
dragonfly-client-config = { path = "dragonfly-client-config", version = "0.2.32" }
28-
dragonfly-client-storage = { path = "dragonfly-client-storage", version = "0.2.32" }
29-
dragonfly-client-backend = { path = "dragonfly-client-backend", version = "0.2.32" }
30-
dragonfly-client-util = { path = "dragonfly-client-util", version = "0.2.32" }
31-
dragonfly-client-init = { path = "dragonfly-client-init", version = "0.2.32" }
25+
dragonfly-client = { path = "dragonfly-client", version = "0.2.33" }
26+
dragonfly-client-core = { path = "dragonfly-client-core", version = "0.2.33" }
27+
dragonfly-client-config = { path = "dragonfly-client-config", version = "0.2.33" }
28+
dragonfly-client-storage = { path = "dragonfly-client-storage", version = "0.2.33" }
29+
dragonfly-client-backend = { path = "dragonfly-client-backend", version = "0.2.33" }
30+
dragonfly-client-util = { path = "dragonfly-client-util", version = "0.2.33" }
31+
dragonfly-client-init = { path = "dragonfly-client-init", version = "0.2.33" }
3232
dragonfly-api = "=2.1.39"
3333
thiserror = "2.0"
3434
futures = "0.3.31"

dragonfly-client/src/resource/piece.rs

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -335,6 +335,7 @@ impl Piece {
335335
) -> Result<impl AsyncRead> {
336336
// Span record the piece_id.
337337
Span::current().record("piece_id", piece_id);
338+
Span::current().record("piece_length", length);
338339

339340
// Acquire the upload rate limiter.
340341
if !disable_rate_limit {
@@ -366,6 +367,7 @@ impl Piece {
366367
) -> Result<impl AsyncRead> {
367368
// Span record the piece_id.
368369
Span::current().record("piece_id", piece_id);
370+
Span::current().record("piece_length", length);
369371

370372
// Acquire the download rate limiter.
371373
if !disable_rate_limit {
@@ -409,6 +411,7 @@ impl Piece {
409411
) -> Result<metadata::Piece> {
410412
// Span record the piece_id.
411413
Span::current().record("piece_id", piece_id);
414+
Span::current().record("piece_length", length);
412415

413416
// Record the start of downloading piece.
414417
let piece = self
@@ -513,6 +516,7 @@ impl Piece {
513516
) -> Result<metadata::Piece> {
514517
// Span record the piece_id.
515518
Span::current().record("piece_id", piece_id);
519+
Span::current().record("piece_length", length);
516520

517521
// Record the start of downloading piece.
518522
let piece = self
@@ -696,6 +700,7 @@ impl Piece {
696700
) -> Result<impl AsyncRead> {
697701
// Span record the piece_id.
698702
Span::current().record("piece_id", piece_id);
703+
Span::current().record("piece_length", length);
699704

700705
// Acquire the upload rate limiter.
701706
self.upload_rate_limiter.acquire(length as usize).await;
@@ -725,6 +730,7 @@ impl Piece {
725730
) -> Result<impl AsyncRead> {
726731
// Span record the piece_id.
727732
Span::current().record("piece_id", piece_id);
733+
Span::current().record("piece_length", length);
728734

729735
// Acquire the download rate limiter.
730736
if !disable_rate_limit {
@@ -769,6 +775,7 @@ impl Piece {
769775
) -> Result<metadata::Piece> {
770776
// Span record the piece_id.
771777
Span::current().record("piece_id", piece_id);
778+
Span::current().record("piece_length", length);
772779

773780
if is_prefetch {
774781
// Acquire the prefetch rate limiter.

0 commit comments

Comments
 (0)