feat: local_only specifies whether to query task information from local client only (#513)

Signed-off-by: Gaius <gaius.qi@gmail.com>
This commit is contained in:
Gaius 2025-07-23 11:53:20 +08:00 committed by GitHub
parent 8165c4bff1
commit c619a3c8ac
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
8 changed files with 41 additions and 9 deletions

2
Cargo.lock generated
View File

@ -190,7 +190,7 @@ dependencies = [
[[package]]
name = "dragonfly-api"
version = "2.1.47"
version = "2.1.48"
dependencies = [
"prost 0.13.5",
"prost-types 0.14.1",

View File

@ -1,6 +1,6 @@
[package]
name = "dragonfly-api"
version = "2.1.47"
version = "2.1.48"
authors = ["Gaius <gaius.qi@gmail.com>"]
edition = "2021"
license = "Apache-2.0"

View File

@ -593,6 +593,11 @@ type StatTaskRequest struct {
TaskId string `protobuf:"bytes,1,opt,name=task_id,json=taskId,proto3" json:"task_id,omitempty"`
// Remote IP represents the IP address of the client initiating the stat request.
RemoteIp *string `protobuf:"bytes,2,opt,name=remote_ip,json=remoteIp,proto3,oneof" json:"remote_ip,omitempty"`
// local_only specifies whether to query task information from local client only.
// If true, the query will be restricted to the local client.
// By default (false), the query may be forwarded to the scheduler
// for a cluster-wide search.
LocalOnly bool `protobuf:"varint,3,opt,name=local_only,json=localOnly,proto3" json:"local_only,omitempty"`
}
func (x *StatTaskRequest) Reset() {
@ -641,6 +646,13 @@ func (x *StatTaskRequest) GetRemoteIp() string {
return ""
}
func (x *StatTaskRequest) GetLocalOnly() bool {
if x != nil {
return x.LocalOnly
}
return false
}
// ListTaskEntriesRequest represents request of ListTaskEntries.
type ListTaskEntriesRequest struct {
state protoimpl.MessageState
@ -2154,13 +2166,15 @@ var file_pkg_apis_dfdaemon_v2_dfdaemon_proto_rawDesc = []byte{
0x2d, 0x66, 0x41, 0x2d, 0x46, 0x30, 0x2d, 0x39, 0x5d, 0x7b, 0x36, 0x34, 0x7d, 0x7c, 0x63, 0x72,
0x63, 0x33, 0x32, 0x3a, 0x5b, 0x61, 0x2d, 0x66, 0x41, 0x2d, 0x46, 0x30, 0x2d, 0x39, 0x5d, 0x2b,
0x29, 0x24, 0xd0, 0x01, 0x01, 0x48, 0x00, 0x52, 0x06, 0x64, 0x69, 0x67, 0x65, 0x73, 0x74, 0x88,
0x01, 0x01, 0x42, 0x09, 0x0a, 0x07, 0x5f, 0x64, 0x69, 0x67, 0x65, 0x73, 0x74, 0x22, 0x6f, 0x0a,
0x0f, 0x53, 0x74, 0x61, 0x74, 0x54, 0x61, 0x73, 0x6b, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74,
0x12, 0x20, 0x0a, 0x07, 0x74, 0x61, 0x73, 0x6b, 0x5f, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28,
0x09, 0x42, 0x07, 0xfa, 0x42, 0x04, 0x72, 0x02, 0x10, 0x01, 0x52, 0x06, 0x74, 0x61, 0x73, 0x6b,
0x49, 0x64, 0x12, 0x2c, 0x0a, 0x09, 0x72, 0x65, 0x6d, 0x6f, 0x74, 0x65, 0x5f, 0x69, 0x70, 0x18,
0x02, 0x20, 0x01, 0x28, 0x09, 0x42, 0x0a, 0xfa, 0x42, 0x07, 0x72, 0x05, 0x70, 0x01, 0xd0, 0x01,
0x01, 0x48, 0x00, 0x52, 0x08, 0x72, 0x65, 0x6d, 0x6f, 0x74, 0x65, 0x49, 0x70, 0x88, 0x01, 0x01,
0x01, 0x01, 0x42, 0x09, 0x0a, 0x07, 0x5f, 0x64, 0x69, 0x67, 0x65, 0x73, 0x74, 0x22, 0x8e, 0x01,
0x0a, 0x0f, 0x53, 0x74, 0x61, 0x74, 0x54, 0x61, 0x73, 0x6b, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73,
0x74, 0x12, 0x20, 0x0a, 0x07, 0x74, 0x61, 0x73, 0x6b, 0x5f, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01,
0x28, 0x09, 0x42, 0x07, 0xfa, 0x42, 0x04, 0x72, 0x02, 0x10, 0x01, 0x52, 0x06, 0x74, 0x61, 0x73,
0x6b, 0x49, 0x64, 0x12, 0x2c, 0x0a, 0x09, 0x72, 0x65, 0x6d, 0x6f, 0x74, 0x65, 0x5f, 0x69, 0x70,
0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x42, 0x0a, 0xfa, 0x42, 0x07, 0x72, 0x05, 0x70, 0x01, 0xd0,
0x01, 0x01, 0x48, 0x00, 0x52, 0x08, 0x72, 0x65, 0x6d, 0x6f, 0x74, 0x65, 0x49, 0x70, 0x88, 0x01,
0x01, 0x12, 0x1d, 0x0a, 0x0a, 0x6c, 0x6f, 0x63, 0x61, 0x6c, 0x5f, 0x6f, 0x6e, 0x6c, 0x79, 0x18,
0x03, 0x20, 0x01, 0x28, 0x08, 0x52, 0x09, 0x6c, 0x6f, 0x63, 0x61, 0x6c, 0x4f, 0x6e, 0x6c, 0x79,
0x42, 0x0c, 0x0a, 0x0a, 0x5f, 0x72, 0x65, 0x6d, 0x6f, 0x74, 0x65, 0x5f, 0x69, 0x70, 0x22, 0xa8,
0x04, 0x0a, 0x16, 0x4c, 0x69, 0x73, 0x74, 0x54, 0x61, 0x73, 0x6b, 0x45, 0x6e, 0x74, 0x72, 0x69,
0x65, 0x73, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x20, 0x0a, 0x07, 0x74, 0x61, 0x73,

View File

@ -1294,6 +1294,8 @@ func (m *StatTaskRequest) validate(all bool) error {
errors = append(errors, err)
}
// no validation rules for LocalOnly
if m.RemoteIp != nil {
if m.GetRemoteIp() != "" {

View File

@ -115,6 +115,11 @@ message StatTaskRequest {
string task_id = 1 [(validate.rules).string.min_len = 1];
// Remote IP represents the IP address of the client initiating the stat request.
optional string remote_ip = 2 [(validate.rules).string = {ip: true, ignore_empty: true}];
// local_only specifies whether to query task information from local client only.
// If true, the query will be restricted to the local client.
// By default (false), the query may be forwarded to the scheduler
// for a cluster-wide search.
bool local_only = 3;
}
// ListTaskEntriesRequest represents request of ListTaskEntries.

View File

@ -110,6 +110,11 @@ message StatTaskRequest {
string task_id = 1;
// Remote IP represents the IP address of the client initiating the stat request.
optional string remote_ip = 2;
// local_only specifies whether to query task information from local client only.
// If true, the query will be restricted to the local client.
// By default (false), the query may be forwarded to the scheduler
// for a cluster-wide search.
bool local_only = 3;
}
// ListTaskEntriesRequest represents request of ListTaskEntries.

Binary file not shown.

View File

@ -137,6 +137,12 @@ pub struct StatTaskRequest {
/// Remote IP represents the IP address of the client initiating the stat request.
#[prost(string, optional, tag = "2")]
pub remote_ip: ::core::option::Option<::prost::alloc::string::String>,
/// local_only specifies whether to query task information from local client only.
/// If true, the query will be restricted to the local client.
/// By default (false), the query may be forwarded to the scheduler
/// for a cluster-wide search.
#[prost(bool, tag = "3")]
pub local_only: bool,
}
/// ListTaskEntriesRequest represents request of ListTaskEntries.
#[derive(serde::Serialize, serde::Deserialize)]