watchdog-go: 最新のメッセージに追従

This commit is contained in:
usbharu 2024-03-11 16:36:08 +09:00
parent 5eacd02502
commit cd72516eac
Signed by: usbharu
GPG Key ID: 6556747BF94EEBC8
2 changed files with 23 additions and 13 deletions

View File

@ -85,6 +85,7 @@ type Metric struct {
Status Status `protobuf:"varint,4,opt,name=status,proto3,enum=watchdog.Status" json:"status,omitempty"`
Value string `protobuf:"bytes,5,opt,name=value,proto3" json:"value,omitempty"`
Timestamp *timestamppb.Timestamp `protobuf:"bytes,6,opt,name=timestamp,proto3" json:"timestamp,omitempty"`
Message string `protobuf:"bytes,7,opt,name=message,proto3" json:"message,omitempty"`
}
func (x *Metric) Reset() {
@ -161,6 +162,13 @@ func (x *Metric) GetTimestamp() *timestamppb.Timestamp {
return nil
}
func (x *Metric) GetMessage() string {
if x != nil {
return x.Message
}
return ""
}
var File_watchdog_push_metrics_proto protoreflect.FileDescriptor
var file_watchdog_push_metrics_proto_rawDesc = []byte{
@ -170,7 +178,7 @@ var file_watchdog_push_metrics_proto_rawDesc = []byte{
0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2f, 0x65, 0x6d, 0x70, 0x74, 0x79, 0x2e, 0x70,
0x72, 0x6f, 0x74, 0x6f, 0x1a, 0x1f, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2f, 0x70, 0x72, 0x6f,
0x74, 0x6f, 0x62, 0x75, 0x66, 0x2f, 0x74, 0x69, 0x6d, 0x65, 0x73, 0x74, 0x61, 0x6d, 0x70, 0x2e,
0x70, 0x72, 0x6f, 0x74, 0x6f, 0x22, 0xcb, 0x01, 0x0a, 0x06, 0x4d, 0x65, 0x74, 0x72, 0x69, 0x63,
0x70, 0x72, 0x6f, 0x74, 0x6f, 0x22, 0xe5, 0x01, 0x0a, 0x06, 0x4d, 0x65, 0x74, 0x72, 0x69, 0x63,
0x12, 0x12, 0x0a, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04,
0x6e, 0x61, 0x6d, 0x65, 0x12, 0x1b, 0x0a, 0x09, 0x6f, 0x62, 0x6a, 0x65, 0x63, 0x74, 0x5f, 0x69,
0x64, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x08, 0x6f, 0x62, 0x6a, 0x65, 0x63, 0x74, 0x49,
@ -183,18 +191,19 @@ var file_watchdog_push_metrics_proto_rawDesc = []byte{
0x65, 0x73, 0x74, 0x61, 0x6d, 0x70, 0x18, 0x06, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1a, 0x2e, 0x67,
0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x54,
0x69, 0x6d, 0x65, 0x73, 0x74, 0x61, 0x6d, 0x70, 0x52, 0x09, 0x74, 0x69, 0x6d, 0x65, 0x73, 0x74,
0x61, 0x6d, 0x70, 0x2a, 0x35, 0x0a, 0x06, 0x53, 0x74, 0x61, 0x74, 0x75, 0x73, 0x12, 0x06, 0x0a,
0x02, 0x4f, 0x4b, 0x10, 0x00, 0x12, 0x08, 0x0a, 0x04, 0x44, 0x45, 0x41, 0x44, 0x10, 0x01, 0x12,
0x0b, 0x0a, 0x07, 0x55, 0x4e, 0x4b, 0x4e, 0x4f, 0x57, 0x4e, 0x10, 0x02, 0x12, 0x0c, 0x0a, 0x08,
0x4e, 0x4f, 0x54, 0x5f, 0x47, 0x4f, 0x4f, 0x44, 0x10, 0x03, 0x32, 0x46, 0x0a, 0x12, 0x50, 0x75,
0x73, 0x68, 0x4d, 0x65, 0x74, 0x72, 0x69, 0x63, 0x73, 0x53, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65,
0x12, 0x30, 0x0a, 0x04, 0x50, 0x75, 0x73, 0x68, 0x12, 0x10, 0x2e, 0x77, 0x61, 0x74, 0x63, 0x68,
0x64, 0x6f, 0x67, 0x2e, 0x4d, 0x65, 0x74, 0x72, 0x69, 0x63, 0x1a, 0x16, 0x2e, 0x67, 0x6f, 0x6f,
0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x45, 0x6d, 0x70,
0x74, 0x79, 0x42, 0x27, 0x5a, 0x25, 0x67, 0x69, 0x74, 0x2e, 0x75, 0x73, 0x62, 0x68, 0x61, 0x72,
0x75, 0x2e, 0x64, 0x65, 0x76, 0x2f, 0x75, 0x73, 0x62, 0x68, 0x61, 0x72, 0x75, 0x2f, 0x75, 0x6e,
0x6f, 0x73, 0x2f, 0x77, 0x61, 0x74, 0x63, 0x68, 0x64, 0x6f, 0x67, 0x62, 0x06, 0x70, 0x72, 0x6f,
0x74, 0x6f, 0x33,
0x61, 0x6d, 0x70, 0x12, 0x18, 0x0a, 0x07, 0x6d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x18, 0x07,
0x20, 0x01, 0x28, 0x09, 0x52, 0x07, 0x6d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x2a, 0x35, 0x0a,
0x06, 0x53, 0x74, 0x61, 0x74, 0x75, 0x73, 0x12, 0x06, 0x0a, 0x02, 0x4f, 0x4b, 0x10, 0x00, 0x12,
0x08, 0x0a, 0x04, 0x44, 0x45, 0x41, 0x44, 0x10, 0x01, 0x12, 0x0b, 0x0a, 0x07, 0x55, 0x4e, 0x4b,
0x4e, 0x4f, 0x57, 0x4e, 0x10, 0x02, 0x12, 0x0c, 0x0a, 0x08, 0x4e, 0x4f, 0x54, 0x5f, 0x47, 0x4f,
0x4f, 0x44, 0x10, 0x03, 0x32, 0x46, 0x0a, 0x12, 0x50, 0x75, 0x73, 0x68, 0x4d, 0x65, 0x74, 0x72,
0x69, 0x63, 0x73, 0x53, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x12, 0x30, 0x0a, 0x04, 0x50, 0x75,
0x73, 0x68, 0x12, 0x10, 0x2e, 0x77, 0x61, 0x74, 0x63, 0x68, 0x64, 0x6f, 0x67, 0x2e, 0x4d, 0x65,
0x74, 0x72, 0x69, 0x63, 0x1a, 0x16, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72,
0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x45, 0x6d, 0x70, 0x74, 0x79, 0x42, 0x27, 0x5a, 0x25,
0x67, 0x69, 0x74, 0x2e, 0x75, 0x73, 0x62, 0x68, 0x61, 0x72, 0x75, 0x2e, 0x64, 0x65, 0x76, 0x2f,
0x75, 0x73, 0x62, 0x68, 0x61, 0x72, 0x75, 0x2f, 0x75, 0x6e, 0x6f, 0x73, 0x2f, 0x77, 0x61, 0x74,
0x63, 0x68, 0x64, 0x6f, 0x67, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33,
}
var (

View File

@ -86,6 +86,7 @@ func usedMemory(stat mem.VirtualMemoryStat, config Config) watchdog.Metric {
Status: watchdog.Status_OK,
Value: usedMemory,
Timestamp: timestamppb.Now(),
Message: "",
}
}