Implement target selection, autodiscovery via aggregator, implement listTargets

This commit is contained in:
2026-03-15 05:04:46 +01:00
parent afa65a2b29
commit 7f93466645
16 changed files with 507 additions and 57 deletions

View File

@@ -709,6 +709,138 @@ func (x *Snapshot) GetEntries() []*TopNEntry {
return nil
}
type ListTargetsRequest struct {
state protoimpl.MessageState `protogen:"open.v1"`
unknownFields protoimpl.UnknownFields
sizeCache protoimpl.SizeCache
}
func (x *ListTargetsRequest) Reset() {
*x = ListTargetsRequest{}
mi := &file_logtail_proto_msgTypes[9]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi)
}
func (x *ListTargetsRequest) String() string {
return protoimpl.X.MessageStringOf(x)
}
func (*ListTargetsRequest) ProtoMessage() {}
func (x *ListTargetsRequest) ProtoReflect() protoreflect.Message {
mi := &file_logtail_proto_msgTypes[9]
if x != nil {
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
if ms.LoadMessageInfo() == nil {
ms.StoreMessageInfo(mi)
}
return ms
}
return mi.MessageOf(x)
}
// Deprecated: Use ListTargetsRequest.ProtoReflect.Descriptor instead.
func (*ListTargetsRequest) Descriptor() ([]byte, []int) {
return file_logtail_proto_rawDescGZIP(), []int{9}
}
type TargetInfo struct {
state protoimpl.MessageState `protogen:"open.v1"`
Name string `protobuf:"bytes,1,opt,name=name,proto3" json:"name,omitempty"` // display name (the --source value of the collector)
Addr string `protobuf:"bytes,2,opt,name=addr,proto3" json:"addr,omitempty"` // gRPC address to use as target=; empty means "this endpoint"
unknownFields protoimpl.UnknownFields
sizeCache protoimpl.SizeCache
}
func (x *TargetInfo) Reset() {
*x = TargetInfo{}
mi := &file_logtail_proto_msgTypes[10]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi)
}
func (x *TargetInfo) String() string {
return protoimpl.X.MessageStringOf(x)
}
func (*TargetInfo) ProtoMessage() {}
func (x *TargetInfo) ProtoReflect() protoreflect.Message {
mi := &file_logtail_proto_msgTypes[10]
if x != nil {
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
if ms.LoadMessageInfo() == nil {
ms.StoreMessageInfo(mi)
}
return ms
}
return mi.MessageOf(x)
}
// Deprecated: Use TargetInfo.ProtoReflect.Descriptor instead.
func (*TargetInfo) Descriptor() ([]byte, []int) {
return file_logtail_proto_rawDescGZIP(), []int{10}
}
func (x *TargetInfo) GetName() string {
if x != nil {
return x.Name
}
return ""
}
func (x *TargetInfo) GetAddr() string {
if x != nil {
return x.Addr
}
return ""
}
type ListTargetsResponse struct {
state protoimpl.MessageState `protogen:"open.v1"`
Targets []*TargetInfo `protobuf:"bytes,1,rep,name=targets,proto3" json:"targets,omitempty"`
unknownFields protoimpl.UnknownFields
sizeCache protoimpl.SizeCache
}
func (x *ListTargetsResponse) Reset() {
*x = ListTargetsResponse{}
mi := &file_logtail_proto_msgTypes[11]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi)
}
func (x *ListTargetsResponse) String() string {
return protoimpl.X.MessageStringOf(x)
}
func (*ListTargetsResponse) ProtoMessage() {}
func (x *ListTargetsResponse) ProtoReflect() protoreflect.Message {
mi := &file_logtail_proto_msgTypes[11]
if x != nil {
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
if ms.LoadMessageInfo() == nil {
ms.StoreMessageInfo(mi)
}
return ms
}
return mi.MessageOf(x)
}
// Deprecated: Use ListTargetsResponse.ProtoReflect.Descriptor instead.
func (*ListTargetsResponse) Descriptor() ([]byte, []int) {
return file_logtail_proto_rawDescGZIP(), []int{11}
}
func (x *ListTargetsResponse) GetTargets() []*TargetInfo {
if x != nil {
return x.Targets
}
return nil
}
var File_logtail_proto protoreflect.FileDescriptor
const file_logtail_proto_rawDesc = "" +
@@ -755,7 +887,14 @@ const file_logtail_proto_rawDesc = "" +
"\bSnapshot\x12\x16\n" +
"\x06source\x18\x01 \x01(\tR\x06source\x12\x1c\n" +
"\ttimestamp\x18\x02 \x01(\x03R\ttimestamp\x12,\n" +
"\aentries\x18\x03 \x03(\v2\x12.logtail.TopNEntryR\aentries*:\n" +
"\aentries\x18\x03 \x03(\v2\x12.logtail.TopNEntryR\aentries\"\x14\n" +
"\x12ListTargetsRequest\"4\n" +
"\n" +
"TargetInfo\x12\x12\n" +
"\x04name\x18\x01 \x01(\tR\x04name\x12\x12\n" +
"\x04addr\x18\x02 \x01(\tR\x04addr\"D\n" +
"\x13ListTargetsResponse\x12-\n" +
"\atargets\x18\x01 \x03(\v2\x13.logtail.TargetInfoR\atargets*:\n" +
"\bStatusOp\x12\x06\n" +
"\x02EQ\x10\x00\x12\x06\n" +
"\x02NE\x10\x01\x12\x06\n" +
@@ -774,11 +913,12 @@ const file_logtail_proto_rawDesc = "" +
"\x04W15M\x10\x02\x12\b\n" +
"\x04W60M\x10\x03\x12\a\n" +
"\x03W6H\x10\x04\x12\b\n" +
"\x04W24H\x10\x052\xbf\x01\n" +
"\x04W24H\x10\x052\x89\x02\n" +
"\x0eLogtailService\x123\n" +
"\x04TopN\x12\x14.logtail.TopNRequest\x1a\x15.logtail.TopNResponse\x126\n" +
"\x05Trend\x12\x15.logtail.TrendRequest\x1a\x16.logtail.TrendResponse\x12@\n" +
"\x0fStreamSnapshots\x12\x18.logtail.SnapshotRequest\x1a\x11.logtail.Snapshot0\x01B0Z.git.ipng.ch/ipng/nginx-logtail/proto/logtailpbb\x06proto3"
"\x0fStreamSnapshots\x12\x18.logtail.SnapshotRequest\x1a\x11.logtail.Snapshot0\x01\x12H\n" +
"\vListTargets\x12\x1b.logtail.ListTargetsRequest\x1a\x1c.logtail.ListTargetsResponseB0Z.git.ipng.ch/ipng/nginx-logtail/proto/logtailpbb\x06proto3"
var (
file_logtail_proto_rawDescOnce sync.Once
@@ -793,20 +933,23 @@ func file_logtail_proto_rawDescGZIP() []byte {
}
var file_logtail_proto_enumTypes = make([]protoimpl.EnumInfo, 3)
var file_logtail_proto_msgTypes = make([]protoimpl.MessageInfo, 9)
var file_logtail_proto_msgTypes = make([]protoimpl.MessageInfo, 12)
var file_logtail_proto_goTypes = []any{
(StatusOp)(0), // 0: logtail.StatusOp
(GroupBy)(0), // 1: logtail.GroupBy
(Window)(0), // 2: logtail.Window
(*Filter)(nil), // 3: logtail.Filter
(*TopNRequest)(nil), // 4: logtail.TopNRequest
(*TopNEntry)(nil), // 5: logtail.TopNEntry
(*TopNResponse)(nil), // 6: logtail.TopNResponse
(*TrendRequest)(nil), // 7: logtail.TrendRequest
(*TrendPoint)(nil), // 8: logtail.TrendPoint
(*TrendResponse)(nil), // 9: logtail.TrendResponse
(*SnapshotRequest)(nil), // 10: logtail.SnapshotRequest
(*Snapshot)(nil), // 11: logtail.Snapshot
(StatusOp)(0), // 0: logtail.StatusOp
(GroupBy)(0), // 1: logtail.GroupBy
(Window)(0), // 2: logtail.Window
(*Filter)(nil), // 3: logtail.Filter
(*TopNRequest)(nil), // 4: logtail.TopNRequest
(*TopNEntry)(nil), // 5: logtail.TopNEntry
(*TopNResponse)(nil), // 6: logtail.TopNResponse
(*TrendRequest)(nil), // 7: logtail.TrendRequest
(*TrendPoint)(nil), // 8: logtail.TrendPoint
(*TrendResponse)(nil), // 9: logtail.TrendResponse
(*SnapshotRequest)(nil), // 10: logtail.SnapshotRequest
(*Snapshot)(nil), // 11: logtail.Snapshot
(*ListTargetsRequest)(nil), // 12: logtail.ListTargetsRequest
(*TargetInfo)(nil), // 13: logtail.TargetInfo
(*ListTargetsResponse)(nil), // 14: logtail.ListTargetsResponse
}
var file_logtail_proto_depIdxs = []int32{
0, // 0: logtail.Filter.status_op:type_name -> logtail.StatusOp
@@ -818,17 +961,20 @@ var file_logtail_proto_depIdxs = []int32{
2, // 6: logtail.TrendRequest.window:type_name -> logtail.Window
8, // 7: logtail.TrendResponse.points:type_name -> logtail.TrendPoint
5, // 8: logtail.Snapshot.entries:type_name -> logtail.TopNEntry
4, // 9: logtail.LogtailService.TopN:input_type -> logtail.TopNRequest
7, // 10: logtail.LogtailService.Trend:input_type -> logtail.TrendRequest
10, // 11: logtail.LogtailService.StreamSnapshots:input_type -> logtail.SnapshotRequest
6, // 12: logtail.LogtailService.TopN:output_type -> logtail.TopNResponse
9, // 13: logtail.LogtailService.Trend:output_type -> logtail.TrendResponse
11, // 14: logtail.LogtailService.StreamSnapshots:output_type -> logtail.Snapshot
12, // [12:15] is the sub-list for method output_type
9, // [9:12] is the sub-list for method input_type
9, // [9:9] is the sub-list for extension type_name
9, // [9:9] is the sub-list for extension extendee
0, // [0:9] is the sub-list for field type_name
13, // 9: logtail.ListTargetsResponse.targets:type_name -> logtail.TargetInfo
4, // 10: logtail.LogtailService.TopN:input_type -> logtail.TopNRequest
7, // 11: logtail.LogtailService.Trend:input_type -> logtail.TrendRequest
10, // 12: logtail.LogtailService.StreamSnapshots:input_type -> logtail.SnapshotRequest
12, // 13: logtail.LogtailService.ListTargets:input_type -> logtail.ListTargetsRequest
6, // 14: logtail.LogtailService.TopN:output_type -> logtail.TopNResponse
9, // 15: logtail.LogtailService.Trend:output_type -> logtail.TrendResponse
11, // 16: logtail.LogtailService.StreamSnapshots:output_type -> logtail.Snapshot
14, // 17: logtail.LogtailService.ListTargets:output_type -> logtail.ListTargetsResponse
14, // [14:18] is the sub-list for method output_type
10, // [10:14] is the sub-list for method input_type
10, // [10:10] is the sub-list for extension type_name
10, // [10:10] is the sub-list for extension extendee
0, // [0:10] is the sub-list for field type_name
}
func init() { file_logtail_proto_init() }
@@ -843,7 +989,7 @@ func file_logtail_proto_init() {
GoPackagePath: reflect.TypeOf(x{}).PkgPath(),
RawDescriptor: unsafe.Slice(unsafe.StringData(file_logtail_proto_rawDesc), len(file_logtail_proto_rawDesc)),
NumEnums: 3,
NumMessages: 9,
NumMessages: 12,
NumExtensions: 0,
NumServices: 1,
},