feat(metric): add dragonfly-client-metric module (#1362)
* feat(metric): add dragonfly-client-metric module Signed-off-by: Gaius <gaius.qi@gmail.com> * chore(deps): update dragonfly-client versions to 1.0.22 Signed-off-by: Gaius <gaius.qi@gmail.com> --------- Signed-off-by: Gaius <gaius.qi@gmail.com>
This commit is contained in:
parent
160f51396f
commit
c4fb049aac
|
|
@ -986,7 +986,7 @@ dependencies = [
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "dragonfly-client"
|
name = "dragonfly-client"
|
||||||
version = "1.0.21"
|
version = "1.0.22"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"anyhow",
|
"anyhow",
|
||||||
"bytes",
|
"bytes",
|
||||||
|
|
@ -999,6 +999,7 @@ dependencies = [
|
||||||
"dragonfly-client-backend",
|
"dragonfly-client-backend",
|
||||||
"dragonfly-client-config",
|
"dragonfly-client-config",
|
||||||
"dragonfly-client-core",
|
"dragonfly-client-core",
|
||||||
|
"dragonfly-client-metric",
|
||||||
"dragonfly-client-storage",
|
"dragonfly-client-storage",
|
||||||
"dragonfly-client-util",
|
"dragonfly-client-util",
|
||||||
"fastrand",
|
"fastrand",
|
||||||
|
|
@ -1025,7 +1026,6 @@ dependencies = [
|
||||||
"path-absolutize",
|
"path-absolutize",
|
||||||
"percent-encoding",
|
"percent-encoding",
|
||||||
"pprof",
|
"pprof",
|
||||||
"prometheus",
|
|
||||||
"prost-wkt-types",
|
"prost-wkt-types",
|
||||||
"rcgen",
|
"rcgen",
|
||||||
"reqwest",
|
"reqwest",
|
||||||
|
|
@ -1060,7 +1060,7 @@ dependencies = [
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "dragonfly-client-backend"
|
name = "dragonfly-client-backend"
|
||||||
version = "1.0.21"
|
version = "1.0.22"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"dragonfly-api",
|
"dragonfly-api",
|
||||||
"dragonfly-client-core",
|
"dragonfly-client-core",
|
||||||
|
|
@ -1091,7 +1091,7 @@ dependencies = [
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "dragonfly-client-config"
|
name = "dragonfly-client-config"
|
||||||
version = "1.0.21"
|
version = "1.0.22"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"bytesize",
|
"bytesize",
|
||||||
"bytesize-serde",
|
"bytesize-serde",
|
||||||
|
|
@ -1121,7 +1121,7 @@ dependencies = [
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "dragonfly-client-core"
|
name = "dragonfly-client-core"
|
||||||
version = "1.0.21"
|
version = "1.0.22"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"headers 0.4.1",
|
"headers 0.4.1",
|
||||||
"hyper 1.6.0",
|
"hyper 1.6.0",
|
||||||
|
|
@ -1140,7 +1140,7 @@ dependencies = [
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "dragonfly-client-init"
|
name = "dragonfly-client-init"
|
||||||
version = "1.0.21"
|
version = "1.0.22"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"anyhow",
|
"anyhow",
|
||||||
"clap",
|
"clap",
|
||||||
|
|
@ -1155,9 +1155,24 @@ dependencies = [
|
||||||
"url",
|
"url",
|
||||||
]
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "dragonfly-client-metric"
|
||||||
|
version = "1.0.22"
|
||||||
|
dependencies = [
|
||||||
|
"dragonfly-api",
|
||||||
|
"dragonfly-client-config",
|
||||||
|
"dragonfly-client-util",
|
||||||
|
"fs2",
|
||||||
|
"lazy_static",
|
||||||
|
"prometheus",
|
||||||
|
"tokio",
|
||||||
|
"tracing",
|
||||||
|
"warp",
|
||||||
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "dragonfly-client-storage"
|
name = "dragonfly-client-storage"
|
||||||
version = "1.0.21"
|
version = "1.0.22"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"bincode",
|
"bincode",
|
||||||
"bytes",
|
"bytes",
|
||||||
|
|
@ -1168,6 +1183,7 @@ dependencies = [
|
||||||
"dragonfly-api",
|
"dragonfly-api",
|
||||||
"dragonfly-client-config",
|
"dragonfly-client-config",
|
||||||
"dragonfly-client-core",
|
"dragonfly-client-core",
|
||||||
|
"dragonfly-client-metric",
|
||||||
"dragonfly-client-util",
|
"dragonfly-client-util",
|
||||||
"fs2",
|
"fs2",
|
||||||
"leaky-bucket",
|
"leaky-bucket",
|
||||||
|
|
@ -1186,7 +1202,7 @@ dependencies = [
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "dragonfly-client-util"
|
name = "dragonfly-client-util"
|
||||||
version = "1.0.21"
|
version = "1.0.22"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"base64 0.22.1",
|
"base64 0.22.1",
|
||||||
"bytesize",
|
"bytesize",
|
||||||
|
|
@ -1597,7 +1613,7 @@ dependencies = [
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "hdfs"
|
name = "hdfs"
|
||||||
version = "1.0.21"
|
version = "1.0.22"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"dragonfly-client-backend",
|
"dragonfly-client-backend",
|
||||||
"dragonfly-client-core",
|
"dragonfly-client-core",
|
||||||
|
|
|
||||||
18
Cargo.toml
18
Cargo.toml
|
|
@ -9,10 +9,11 @@ members = [
|
||||||
"dragonfly-client-storage",
|
"dragonfly-client-storage",
|
||||||
"dragonfly-client-util",
|
"dragonfly-client-util",
|
||||||
"dragonfly-client-backend/examples/plugin",
|
"dragonfly-client-backend/examples/plugin",
|
||||||
|
"dragonfly-client-metric",
|
||||||
]
|
]
|
||||||
|
|
||||||
[workspace.package]
|
[workspace.package]
|
||||||
version = "1.0.21"
|
version = "1.0.22"
|
||||||
authors = ["The Dragonfly Developers"]
|
authors = ["The Dragonfly Developers"]
|
||||||
homepage = "https://d7y.io/"
|
homepage = "https://d7y.io/"
|
||||||
repository = "https://github.com/dragonflyoss/client.git"
|
repository = "https://github.com/dragonflyoss/client.git"
|
||||||
|
|
@ -22,13 +23,14 @@ readme = "README.md"
|
||||||
edition = "2021"
|
edition = "2021"
|
||||||
|
|
||||||
[workspace.dependencies]
|
[workspace.dependencies]
|
||||||
dragonfly-client = { path = "dragonfly-client", version = "1.0.21" }
|
dragonfly-client = { path = "dragonfly-client", version = "1.0.22" }
|
||||||
dragonfly-client-core = { path = "dragonfly-client-core", version = "1.0.21" }
|
dragonfly-client-core = { path = "dragonfly-client-core", version = "1.0.22" }
|
||||||
dragonfly-client-config = { path = "dragonfly-client-config", version = "1.0.21" }
|
dragonfly-client-config = { path = "dragonfly-client-config", version = "1.0.22" }
|
||||||
dragonfly-client-storage = { path = "dragonfly-client-storage", version = "1.0.21" }
|
dragonfly-client-storage = { path = "dragonfly-client-storage", version = "1.0.22" }
|
||||||
dragonfly-client-backend = { path = "dragonfly-client-backend", version = "1.0.21" }
|
dragonfly-client-backend = { path = "dragonfly-client-backend", version = "1.0.22" }
|
||||||
dragonfly-client-util = { path = "dragonfly-client-util", version = "1.0.21" }
|
dragonfly-client-metric = { path = "dragonfly-client-metric", version = "1.0.22" }
|
||||||
dragonfly-client-init = { path = "dragonfly-client-init", version = "1.0.21" }
|
dragonfly-client-util = { path = "dragonfly-client-util", version = "1.0.22" }
|
||||||
|
dragonfly-client-init = { path = "dragonfly-client-init", version = "1.0.22" }
|
||||||
dragonfly-api = "=2.1.68"
|
dragonfly-api = "=2.1.68"
|
||||||
thiserror = "2.0"
|
thiserror = "2.0"
|
||||||
futures = "0.3.31"
|
futures = "0.3.31"
|
||||||
|
|
|
||||||
|
|
@ -29,6 +29,9 @@ COPY dragonfly-client-backend/src ./dragonfly-client-backend/src
|
||||||
COPY dragonfly-client-backend/examples/plugin/Cargo.toml ./dragonfly-client-backend/examples/plugin/Cargo.toml
|
COPY dragonfly-client-backend/examples/plugin/Cargo.toml ./dragonfly-client-backend/examples/plugin/Cargo.toml
|
||||||
COPY dragonfly-client-backend/examples/plugin/src ./dragonfly-client-backend/examples/plugin/src
|
COPY dragonfly-client-backend/examples/plugin/src ./dragonfly-client-backend/examples/plugin/src
|
||||||
|
|
||||||
|
COPY dragonfly-client-metric/Cargo.toml ./dragonfly-client-metric/Cargo.toml
|
||||||
|
COPY dragonfly-client-metric/src ./dragonfly-client-backend/src
|
||||||
|
|
||||||
COPY dragonfly-client-util/Cargo.toml ./dragonfly-client-util/Cargo.toml
|
COPY dragonfly-client-util/Cargo.toml ./dragonfly-client-util/Cargo.toml
|
||||||
COPY dragonfly-client-util/src ./dragonfly-client-util/src
|
COPY dragonfly-client-util/src ./dragonfly-client-util/src
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -29,6 +29,9 @@ COPY dragonfly-client-backend/src ./dragonfly-client-backend/src
|
||||||
COPY dragonfly-client-backend/examples/plugin/Cargo.toml ./dragonfly-client-backend/examples/plugin/Cargo.toml
|
COPY dragonfly-client-backend/examples/plugin/Cargo.toml ./dragonfly-client-backend/examples/plugin/Cargo.toml
|
||||||
COPY dragonfly-client-backend/examples/plugin/src ./dragonfly-client-backend/examples/plugin/src
|
COPY dragonfly-client-backend/examples/plugin/src ./dragonfly-client-backend/examples/plugin/src
|
||||||
|
|
||||||
|
COPY dragonfly-client-metric/Cargo.toml ./dragonfly-client-metric/Cargo.toml
|
||||||
|
COPY dragonfly-client-metric/src ./dragonfly-client-backend/src
|
||||||
|
|
||||||
COPY dragonfly-client-util/Cargo.toml ./dragonfly-client-util/Cargo.toml
|
COPY dragonfly-client-util/Cargo.toml ./dragonfly-client-util/Cargo.toml
|
||||||
COPY dragonfly-client-util/src ./dragonfly-client-util/src
|
COPY dragonfly-client-util/src ./dragonfly-client-util/src
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -29,6 +29,9 @@ COPY dragonfly-client-backend/src ./dragonfly-client-backend/src
|
||||||
COPY dragonfly-client-backend/examples/plugin/Cargo.toml ./dragonfly-client-backend/examples/plugin/Cargo.toml
|
COPY dragonfly-client-backend/examples/plugin/Cargo.toml ./dragonfly-client-backend/examples/plugin/Cargo.toml
|
||||||
COPY dragonfly-client-backend/examples/plugin/src ./dragonfly-client-backend/examples/plugin/src
|
COPY dragonfly-client-backend/examples/plugin/src ./dragonfly-client-backend/examples/plugin/src
|
||||||
|
|
||||||
|
COPY dragonfly-client-metric/Cargo.toml ./dragonfly-client-metric/Cargo.toml
|
||||||
|
COPY dragonfly-client-metric/src ./dragonfly-client-backend/src
|
||||||
|
|
||||||
COPY dragonfly-client-util/Cargo.toml ./dragonfly-client-util/Cargo.toml
|
COPY dragonfly-client-util/Cargo.toml ./dragonfly-client-util/Cargo.toml
|
||||||
COPY dragonfly-client-util/src ./dragonfly-client-util/src
|
COPY dragonfly-client-util/src ./dragonfly-client-util/src
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -0,0 +1,22 @@
|
||||||
|
[package]
|
||||||
|
name = "dragonfly-client-metric"
|
||||||
|
description = "Metric collection for the dragonfly client"
|
||||||
|
version.workspace = true
|
||||||
|
authors.workspace = true
|
||||||
|
homepage.workspace = true
|
||||||
|
repository.workspace = true
|
||||||
|
keywords.workspace = true
|
||||||
|
license.workspace = true
|
||||||
|
readme.workspace = true
|
||||||
|
edition.workspace = true
|
||||||
|
|
||||||
|
[dependencies]
|
||||||
|
dragonfly-api.workspace = true
|
||||||
|
dragonfly-client-config.workspace = true
|
||||||
|
dragonfly-client-util.workspace = true
|
||||||
|
lazy_static.workspace = true
|
||||||
|
tokio.workspace = true
|
||||||
|
tracing.workspace = true
|
||||||
|
warp.workspace = true
|
||||||
|
fs2.workspace = true
|
||||||
|
prometheus = { version = "0.13", features = ["process"] }
|
||||||
|
|
@ -1,5 +1,5 @@
|
||||||
/*
|
/*
|
||||||
* Copyright 2023 The Dragonfly Authors
|
* Copyright 2025 The Dragonfly Authors
|
||||||
*
|
*
|
||||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
* you may not use this file except in compliance with the License.
|
* you may not use this file except in compliance with the License.
|
||||||
|
|
@ -12,6 +12,7 @@ edition.workspace = true
|
||||||
[dependencies]
|
[dependencies]
|
||||||
dragonfly-client-core.workspace = true
|
dragonfly-client-core.workspace = true
|
||||||
dragonfly-client-config.workspace = true
|
dragonfly-client-config.workspace = true
|
||||||
|
dragonfly-client-metric.workspace = true
|
||||||
dragonfly-client-util.workspace = true
|
dragonfly-client-util.workspace = true
|
||||||
dragonfly-api.workspace = true
|
dragonfly-api.workspace = true
|
||||||
chrono.workspace = true
|
chrono.workspace = true
|
||||||
|
|
|
||||||
|
|
@ -18,6 +18,9 @@ use crate::Storage;
|
||||||
use bytes::{Bytes, BytesMut};
|
use bytes::{Bytes, BytesMut};
|
||||||
use dragonfly_api::common::v2::TrafficType;
|
use dragonfly_api::common::v2::TrafficType;
|
||||||
use dragonfly_client_core::{Error as ClientError, Result as ClientResult};
|
use dragonfly_client_core::{Error as ClientError, Result as ClientResult};
|
||||||
|
use dragonfly_client_metric::{
|
||||||
|
collect_upload_piece_failure_metrics, collect_upload_piece_started_metrics,
|
||||||
|
};
|
||||||
use dragonfly_client_util::{id_generator::IDGenerator, shutdown};
|
use dragonfly_client_util::{id_generator::IDGenerator, shutdown};
|
||||||
use leaky_bucket::RateLimiter;
|
use leaky_bucket::RateLimiter;
|
||||||
use std::net::SocketAddr;
|
use std::net::SocketAddr;
|
||||||
|
|
@ -157,7 +160,11 @@ impl TCPServerHandler {
|
||||||
Span::current().record("remote_address", remote_address.as_str());
|
Span::current().record("remote_address", remote_address.as_str());
|
||||||
Span::current().record("task_id", task_id);
|
Span::current().record("task_id", task_id);
|
||||||
Span::current().record("piece_id", piece_id.as_str());
|
Span::current().record("piece_id", piece_id.as_str());
|
||||||
|
|
||||||
|
// Collect upload piece started metrics.
|
||||||
|
collect_upload_piece_started_metrics();
|
||||||
info!("start upload piece content");
|
info!("start upload piece content");
|
||||||
|
|
||||||
match self.handle_piece(piece_id.as_str(), task_id).await {
|
match self.handle_piece(piece_id.as_str(), task_id).await {
|
||||||
Ok((piece_content, mut content_reader)) => {
|
Ok((piece_content, mut content_reader)) => {
|
||||||
let piece_content_bytes: Bytes = piece_content.into();
|
let piece_content_bytes: Bytes = piece_content.into();
|
||||||
|
|
@ -174,6 +181,9 @@ impl TCPServerHandler {
|
||||||
self.write_stream(&mut content_reader, &mut writer).await?;
|
self.write_stream(&mut content_reader, &mut writer).await?;
|
||||||
}
|
}
|
||||||
Err(err) => {
|
Err(err) => {
|
||||||
|
// Collect upload piece failure metrics.
|
||||||
|
collect_upload_piece_failure_metrics();
|
||||||
|
|
||||||
let error_response: Bytes =
|
let error_response: Bytes =
|
||||||
Vortex::Error(Header::new_error(err.len() as u32), err).into();
|
Vortex::Error(Header::new_error(err.len() as u32), err).into();
|
||||||
self.write_response(error_response, &mut writer).await?;
|
self.write_response(error_response, &mut writer).await?;
|
||||||
|
|
@ -203,7 +213,11 @@ impl TCPServerHandler {
|
||||||
Span::current().record("remote_address", remote_address.as_str());
|
Span::current().record("remote_address", remote_address.as_str());
|
||||||
Span::current().record("task_id", task_id);
|
Span::current().record("task_id", task_id);
|
||||||
Span::current().record("piece_id", piece_id.as_str());
|
Span::current().record("piece_id", piece_id.as_str());
|
||||||
|
|
||||||
|
// Collect upload piece started metrics.
|
||||||
|
collect_upload_piece_started_metrics();
|
||||||
info!("start upload persistent cache piece content");
|
info!("start upload persistent cache piece content");
|
||||||
|
|
||||||
match self
|
match self
|
||||||
.handle_persistent_cache_piece(piece_id.as_str(), task_id)
|
.handle_persistent_cache_piece(piece_id.as_str(), task_id)
|
||||||
.await
|
.await
|
||||||
|
|
@ -227,6 +241,9 @@ impl TCPServerHandler {
|
||||||
self.write_stream(&mut content_reader, &mut writer).await?;
|
self.write_stream(&mut content_reader, &mut writer).await?;
|
||||||
}
|
}
|
||||||
Err(err) => {
|
Err(err) => {
|
||||||
|
// Collect upload piece failure metrics.
|
||||||
|
collect_upload_piece_failure_metrics();
|
||||||
|
|
||||||
let error_response: Bytes =
|
let error_response: Bytes =
|
||||||
Vortex::Error(Header::new_error(err.len() as u32), err).into();
|
Vortex::Error(Header::new_error(err.len() as u32), err).into();
|
||||||
self.write_response(error_response, &mut writer).await?;
|
self.write_response(error_response, &mut writer).await?;
|
||||||
|
|
|
||||||
|
|
@ -27,6 +27,7 @@ dragonfly-client-core.workspace = true
|
||||||
dragonfly-client-config.workspace = true
|
dragonfly-client-config.workspace = true
|
||||||
dragonfly-client-storage.workspace = true
|
dragonfly-client-storage.workspace = true
|
||||||
dragonfly-client-backend.workspace = true
|
dragonfly-client-backend.workspace = true
|
||||||
|
dragonfly-client-metric.workspace = true
|
||||||
dragonfly-client-util.workspace = true
|
dragonfly-client-util.workspace = true
|
||||||
dragonfly-api.workspace = true
|
dragonfly-api.workspace = true
|
||||||
rcgen.workspace = true
|
rcgen.workspace = true
|
||||||
|
|
@ -75,7 +76,6 @@ opentelemetry_sdk = { version = "0.29.0", default-features = false, features = [
|
||||||
opentelemetry-semantic-conventions = { version = "0.30.0", features = ["semconv_experimental"] }
|
opentelemetry-semantic-conventions = { version = "0.30.0", features = ["semconv_experimental"] }
|
||||||
rolling-file = "0.2.0"
|
rolling-file = "0.2.0"
|
||||||
pprof = { version = "0.15", features = ["flamegraph", "protobuf-codec"] }
|
pprof = { version = "0.15", features = ["flamegraph", "protobuf-codec"] }
|
||||||
prometheus = { version = "0.13", features = ["process"] }
|
|
||||||
tonic-health = "0.12.3"
|
tonic-health = "0.12.3"
|
||||||
tower = { version = "0.4.13", features = ["limit", "load-shed", "buffer"] }
|
tower = { version = "0.4.13", features = ["limit", "load-shed", "buffer"] }
|
||||||
indicatif = "0.18.0"
|
indicatif = "0.18.0"
|
||||||
|
|
|
||||||
|
|
@ -23,13 +23,13 @@ use dragonfly_client::grpc::{
|
||||||
manager::ManagerClient, scheduler::SchedulerClient,
|
manager::ManagerClient, scheduler::SchedulerClient,
|
||||||
};
|
};
|
||||||
use dragonfly_client::health::Health;
|
use dragonfly_client::health::Health;
|
||||||
use dragonfly_client::metrics::Metrics;
|
|
||||||
use dragonfly_client::proxy::Proxy;
|
use dragonfly_client::proxy::Proxy;
|
||||||
use dragonfly_client::resource::{persistent_cache_task::PersistentCacheTask, task::Task};
|
use dragonfly_client::resource::{persistent_cache_task::PersistentCacheTask, task::Task};
|
||||||
use dragonfly_client::stats::Stats;
|
use dragonfly_client::stats::Stats;
|
||||||
use dragonfly_client::tracing::init_tracing;
|
use dragonfly_client::tracing::init_tracing;
|
||||||
use dragonfly_client_backend::BackendFactory;
|
use dragonfly_client_backend::BackendFactory;
|
||||||
use dragonfly_client_config::{dfdaemon, VersionValueParser};
|
use dragonfly_client_config::{dfdaemon, VersionValueParser};
|
||||||
|
use dragonfly_client_metric::Metrics;
|
||||||
use dragonfly_client_storage::{server::tcp::TCPServer, Storage};
|
use dragonfly_client_storage::{server::tcp::TCPServer, Storage};
|
||||||
use dragonfly_client_util::{id_generator::IDGenerator, net::Interface, shutdown};
|
use dragonfly_client_util::{id_generator::IDGenerator, net::Interface, shutdown};
|
||||||
use leaky_bucket::RateLimiter;
|
use leaky_bucket::RateLimiter;
|
||||||
|
|
|
||||||
|
|
@ -14,15 +14,6 @@
|
||||||
* limitations under the License.
|
* limitations under the License.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
use crate::metrics::{
|
|
||||||
collect_delete_host_failure_metrics, collect_delete_host_started_metrics,
|
|
||||||
collect_delete_task_failure_metrics, collect_delete_task_started_metrics,
|
|
||||||
collect_download_task_failure_metrics, collect_download_task_finished_metrics,
|
|
||||||
collect_download_task_started_metrics, collect_list_task_entries_failure_metrics,
|
|
||||||
collect_list_task_entries_started_metrics, collect_stat_task_failure_metrics,
|
|
||||||
collect_stat_task_started_metrics, collect_upload_task_failure_metrics,
|
|
||||||
collect_upload_task_finished_metrics, collect_upload_task_started_metrics,
|
|
||||||
};
|
|
||||||
use crate::resource::{persistent_cache_task, task};
|
use crate::resource::{persistent_cache_task, task};
|
||||||
use dragonfly_api::common::v2::{CacheTask, PersistentCacheTask, Priority, Task, TaskType};
|
use dragonfly_api::common::v2::{CacheTask, PersistentCacheTask, Priority, Task, TaskType};
|
||||||
use dragonfly_api::dfdaemon::v2::{
|
use dragonfly_api::dfdaemon::v2::{
|
||||||
|
|
@ -44,6 +35,15 @@ use dragonfly_client_core::{
|
||||||
error::{ErrorType, OrErr},
|
error::{ErrorType, OrErr},
|
||||||
Error as ClientError, Result as ClientResult,
|
Error as ClientError, Result as ClientResult,
|
||||||
};
|
};
|
||||||
|
use dragonfly_client_metric::{
|
||||||
|
collect_delete_host_failure_metrics, collect_delete_host_started_metrics,
|
||||||
|
collect_delete_task_failure_metrics, collect_delete_task_started_metrics,
|
||||||
|
collect_download_task_failure_metrics, collect_download_task_finished_metrics,
|
||||||
|
collect_download_task_started_metrics, collect_list_task_entries_failure_metrics,
|
||||||
|
collect_list_task_entries_started_metrics, collect_stat_task_failure_metrics,
|
||||||
|
collect_stat_task_started_metrics, collect_upload_task_failure_metrics,
|
||||||
|
collect_upload_task_finished_metrics, collect_upload_task_started_metrics,
|
||||||
|
};
|
||||||
use dragonfly_client_util::{
|
use dragonfly_client_util::{
|
||||||
digest::{verify_file_digest, Digest},
|
digest::{verify_file_digest, Digest},
|
||||||
http::{get_range, hashmap_to_headermap, headermap_to_hashmap},
|
http::{get_range, hashmap_to_headermap, headermap_to_hashmap},
|
||||||
|
|
|
||||||
|
|
@ -14,14 +14,6 @@
|
||||||
* limitations under the License.
|
* limitations under the License.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
use crate::metrics::{
|
|
||||||
collect_delete_task_failure_metrics, collect_delete_task_started_metrics,
|
|
||||||
collect_download_task_failure_metrics, collect_download_task_finished_metrics,
|
|
||||||
collect_download_task_started_metrics, collect_stat_task_failure_metrics,
|
|
||||||
collect_stat_task_started_metrics, collect_update_task_failure_metrics,
|
|
||||||
collect_update_task_started_metrics, collect_upload_piece_failure_metrics,
|
|
||||||
collect_upload_piece_finished_metrics, collect_upload_piece_started_metrics,
|
|
||||||
};
|
|
||||||
use crate::resource::{persistent_cache_task, task};
|
use crate::resource::{persistent_cache_task, task};
|
||||||
use dragonfly_api::common::v2::{
|
use dragonfly_api::common::v2::{
|
||||||
CacheTask, Host, Network, PersistentCacheTask, Piece, Priority, Task, TaskType,
|
CacheTask, Host, Network, PersistentCacheTask, Piece, Priority, Task, TaskType,
|
||||||
|
|
@ -46,6 +38,14 @@ use dragonfly_client_core::{
|
||||||
error::{ErrorType, OrErr},
|
error::{ErrorType, OrErr},
|
||||||
Error as ClientError, Result as ClientResult,
|
Error as ClientError, Result as ClientResult,
|
||||||
};
|
};
|
||||||
|
use dragonfly_client_metric::{
|
||||||
|
collect_delete_task_failure_metrics, collect_delete_task_started_metrics,
|
||||||
|
collect_download_task_failure_metrics, collect_download_task_finished_metrics,
|
||||||
|
collect_download_task_started_metrics, collect_stat_task_failure_metrics,
|
||||||
|
collect_stat_task_started_metrics, collect_update_task_failure_metrics,
|
||||||
|
collect_update_task_started_metrics, collect_upload_piece_failure_metrics,
|
||||||
|
collect_upload_piece_finished_metrics, collect_upload_piece_started_metrics,
|
||||||
|
};
|
||||||
use dragonfly_client_util::{
|
use dragonfly_client_util::{
|
||||||
http::{get_range, hashmap_to_headermap, headermap_to_hashmap},
|
http::{get_range, hashmap_to_headermap, headermap_to_hashmap},
|
||||||
id_generator::TaskIDParameter,
|
id_generator::TaskIDParameter,
|
||||||
|
|
|
||||||
|
|
@ -14,11 +14,11 @@
|
||||||
* limitations under the License.
|
* limitations under the License.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
use crate::metrics::{
|
|
||||||
collect_prefetch_task_failure_metrics, collect_prefetch_task_started_metrics,
|
|
||||||
};
|
|
||||||
use dragonfly_api::dfdaemon::v2::DownloadTaskRequest;
|
use dragonfly_api::dfdaemon::v2::DownloadTaskRequest;
|
||||||
use dragonfly_client_core::{Error as ClientError, Result as ClientResult};
|
use dragonfly_client_core::{Error as ClientError, Result as ClientResult};
|
||||||
|
use dragonfly_client_metric::{
|
||||||
|
collect_prefetch_task_failure_metrics, collect_prefetch_task_started_metrics,
|
||||||
|
};
|
||||||
use std::path::PathBuf;
|
use std::path::PathBuf;
|
||||||
use std::time::Duration;
|
use std::time::Duration;
|
||||||
use tonic::Request;
|
use tonic::Request;
|
||||||
|
|
|
||||||
|
|
@ -19,7 +19,6 @@ pub mod dynconfig;
|
||||||
pub mod gc;
|
pub mod gc;
|
||||||
pub mod grpc;
|
pub mod grpc;
|
||||||
pub mod health;
|
pub mod health;
|
||||||
pub mod metrics;
|
|
||||||
pub mod proxy;
|
pub mod proxy;
|
||||||
pub mod resource;
|
pub mod resource;
|
||||||
pub mod stats;
|
pub mod stats;
|
||||||
|
|
|
||||||
|
|
@ -15,10 +15,6 @@
|
||||||
*/
|
*/
|
||||||
|
|
||||||
use crate::grpc::{dfdaemon_download::DfdaemonDownloadClient, REQUEST_TIMEOUT};
|
use crate::grpc::{dfdaemon_download::DfdaemonDownloadClient, REQUEST_TIMEOUT};
|
||||||
use crate::metrics::{
|
|
||||||
collect_proxy_request_failure_metrics, collect_proxy_request_started_metrics,
|
|
||||||
collect_proxy_request_via_dfdaemon_metrics,
|
|
||||||
};
|
|
||||||
use crate::resource::{piece::MIN_PIECE_LENGTH, task::Task};
|
use crate::resource::{piece::MIN_PIECE_LENGTH, task::Task};
|
||||||
use bytes::Bytes;
|
use bytes::Bytes;
|
||||||
use dragonfly_api::common::v2::{Download, TaskType};
|
use dragonfly_api::common::v2::{Download, TaskType};
|
||||||
|
|
@ -29,6 +25,10 @@ use dragonfly_api::errordetails::v2::Backend;
|
||||||
use dragonfly_client_config::dfdaemon::{Config, Rule};
|
use dragonfly_client_config::dfdaemon::{Config, Rule};
|
||||||
use dragonfly_client_core::error::{ErrorType, OrErr};
|
use dragonfly_client_core::error::{ErrorType, OrErr};
|
||||||
use dragonfly_client_core::{Error as ClientError, Result as ClientResult};
|
use dragonfly_client_core::{Error as ClientError, Result as ClientResult};
|
||||||
|
use dragonfly_client_metric::{
|
||||||
|
collect_proxy_request_failure_metrics, collect_proxy_request_started_metrics,
|
||||||
|
collect_proxy_request_via_dfdaemon_metrics,
|
||||||
|
};
|
||||||
use dragonfly_client_util::{
|
use dragonfly_client_util::{
|
||||||
http::{hashmap_to_headermap, headermap_to_hashmap},
|
http::{hashmap_to_headermap, headermap_to_hashmap},
|
||||||
shutdown,
|
shutdown,
|
||||||
|
|
|
||||||
|
|
@ -15,16 +15,16 @@
|
||||||
*/
|
*/
|
||||||
|
|
||||||
use super::*;
|
use super::*;
|
||||||
use crate::metrics::{
|
|
||||||
collect_backend_request_failure_metrics, collect_backend_request_finished_metrics,
|
|
||||||
collect_backend_request_started_metrics, collect_download_piece_traffic_metrics,
|
|
||||||
collect_upload_piece_traffic_metrics,
|
|
||||||
};
|
|
||||||
use chrono::Utc;
|
use chrono::Utc;
|
||||||
use dragonfly_api::common::v2::{Hdfs, ObjectStorage, Range, TrafficType};
|
use dragonfly_api::common::v2::{Hdfs, ObjectStorage, Range, TrafficType};
|
||||||
use dragonfly_client_backend::{BackendFactory, GetRequest};
|
use dragonfly_client_backend::{BackendFactory, GetRequest};
|
||||||
use dragonfly_client_config::dfdaemon::Config;
|
use dragonfly_client_config::dfdaemon::Config;
|
||||||
use dragonfly_client_core::{error::BackendError, Error, Result};
|
use dragonfly_client_core::{error::BackendError, Error, Result};
|
||||||
|
use dragonfly_client_metric::{
|
||||||
|
collect_backend_request_failure_metrics, collect_backend_request_finished_metrics,
|
||||||
|
collect_backend_request_started_metrics, collect_download_piece_traffic_metrics,
|
||||||
|
collect_upload_piece_traffic_metrics,
|
||||||
|
};
|
||||||
use dragonfly_client_storage::{metadata, Storage};
|
use dragonfly_client_storage::{metadata, Storage};
|
||||||
use dragonfly_client_util::id_generator::IDGenerator;
|
use dragonfly_client_util::id_generator::IDGenerator;
|
||||||
use leaky_bucket::RateLimiter;
|
use leaky_bucket::RateLimiter;
|
||||||
|
|
|
||||||
|
|
@ -15,10 +15,6 @@
|
||||||
*/
|
*/
|
||||||
|
|
||||||
use crate::grpc::{scheduler::SchedulerClient, REQUEST_TIMEOUT};
|
use crate::grpc::{scheduler::SchedulerClient, REQUEST_TIMEOUT};
|
||||||
use crate::metrics::{
|
|
||||||
collect_backend_request_failure_metrics, collect_backend_request_finished_metrics,
|
|
||||||
collect_backend_request_started_metrics,
|
|
||||||
};
|
|
||||||
use dragonfly_api::common::v2::{
|
use dragonfly_api::common::v2::{
|
||||||
Download, Hdfs, ObjectStorage, Peer, Piece, SizeScope, Task as CommonTask, TaskType,
|
Download, Hdfs, ObjectStorage, Peer, Piece, SizeScope, Task as CommonTask, TaskType,
|
||||||
TrafficType,
|
TrafficType,
|
||||||
|
|
@ -43,6 +39,10 @@ use dragonfly_client_core::{
|
||||||
error::{BackendError, DownloadFromParentFailed, ErrorType, OrErr},
|
error::{BackendError, DownloadFromParentFailed, ErrorType, OrErr},
|
||||||
Error, Result as ClientResult,
|
Error, Result as ClientResult,
|
||||||
};
|
};
|
||||||
|
use dragonfly_client_metric::{
|
||||||
|
collect_backend_request_failure_metrics, collect_backend_request_finished_metrics,
|
||||||
|
collect_backend_request_started_metrics,
|
||||||
|
};
|
||||||
use dragonfly_client_storage::{metadata, Storage};
|
use dragonfly_client_storage::{metadata, Storage};
|
||||||
use dragonfly_client_util::{
|
use dragonfly_client_util::{
|
||||||
http::{hashmap_to_headermap, headermap_to_hashmap},
|
http::{hashmap_to_headermap, headermap_to_hashmap},
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue