Browse Source

move DiskStatus and MemStatus to protobuf

pull/753/head
Chris Lu 6 years ago
parent
commit
46eb77f9bb
  1. 24
      weed/pb/volume_server.proto
  2. 250
      weed/pb/volume_server_pb/volume_server.pb.go
  3. 3
      weed/server/volume_server_handlers_admin.go
  4. 3
      weed/server/volume_server_handlers_ui.go
  5. 13
      weed/stats/disk.go
  6. 4
      weed/stats/disk_notsupported.go
  7. 4
      weed/stats/disk_supported.go
  8. 19
      weed/stats/memory.go
  9. 4
      weed/stats/memory_notsupported.go
  10. 4
      weed/stats/memory_supported.go

24
weed/pb/volume_server.proto

@ -34,6 +34,8 @@ service VolumeServer {
rpc VolumeUnmount (VolumeUnmountRequest) returns (VolumeUnmountResponse) { rpc VolumeUnmount (VolumeUnmountRequest) returns (VolumeUnmountResponse) {
} }
// rpc VolumeUiPage (VolumeUiPageRequest) returns (VolumeUiPageResponse) {}
} }
////////////////////////////////////////////////// //////////////////////////////////////////////////
@ -138,3 +140,25 @@ message VolumeUnmountRequest {
} }
message VolumeUnmountResponse { message VolumeUnmountResponse {
} }
message VolumeUiPageRequest {
}
message VolumeUiPageResponse {
}
message DiskStatus {
string dir = 1;
uint64 all = 2;
uint64 used = 3;
uint64 free = 4;
}
message MemStatus {
int32 goroutines = 1;
uint64 all = 2;
uint64 used = 3;
uint64 free = 4;
uint64 self = 5;
uint64 heap = 6;
uint64 stack = 7;
}

250
weed/pb/volume_server_pb/volume_server.pb.go

@ -35,6 +35,10 @@ It has these top-level messages:
VolumeMountResponse VolumeMountResponse
VolumeUnmountRequest VolumeUnmountRequest
VolumeUnmountResponse VolumeUnmountResponse
VolumeUiPageRequest
VolumeUiPageResponse
DiskStatus
MemStatus
*/ */
package volume_server_pb package volume_server_pb
@ -546,6 +550,126 @@ func (m *VolumeUnmountResponse) String() string { return proto.Compac
func (*VolumeUnmountResponse) ProtoMessage() {} func (*VolumeUnmountResponse) ProtoMessage() {}
func (*VolumeUnmountResponse) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{25} } func (*VolumeUnmountResponse) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{25} }
type VolumeUiPageRequest struct {
}
func (m *VolumeUiPageRequest) Reset() { *m = VolumeUiPageRequest{} }
func (m *VolumeUiPageRequest) String() string { return proto.CompactTextString(m) }
func (*VolumeUiPageRequest) ProtoMessage() {}
func (*VolumeUiPageRequest) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{26} }
type VolumeUiPageResponse struct {
}
func (m *VolumeUiPageResponse) Reset() { *m = VolumeUiPageResponse{} }
func (m *VolumeUiPageResponse) String() string { return proto.CompactTextString(m) }
func (*VolumeUiPageResponse) ProtoMessage() {}
func (*VolumeUiPageResponse) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{27} }
type DiskStatus struct {
Dir string `protobuf:"bytes,1,opt,name=dir" json:"dir,omitempty"`
All uint64 `protobuf:"varint,2,opt,name=all" json:"all,omitempty"`
Used uint64 `protobuf:"varint,3,opt,name=used" json:"used,omitempty"`
Free uint64 `protobuf:"varint,4,opt,name=free" json:"free,omitempty"`
}
func (m *DiskStatus) Reset() { *m = DiskStatus{} }
func (m *DiskStatus) String() string { return proto.CompactTextString(m) }
func (*DiskStatus) ProtoMessage() {}
func (*DiskStatus) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{28} }
func (m *DiskStatus) GetDir() string {
if m != nil {
return m.Dir
}
return ""
}
func (m *DiskStatus) GetAll() uint64 {
if m != nil {
return m.All
}
return 0
}
func (m *DiskStatus) GetUsed() uint64 {
if m != nil {
return m.Used
}
return 0
}
func (m *DiskStatus) GetFree() uint64 {
if m != nil {
return m.Free
}
return 0
}
type MemStatus struct {
Goroutines int32 `protobuf:"varint,1,opt,name=goroutines" json:"goroutines,omitempty"`
All uint64 `protobuf:"varint,2,opt,name=all" json:"all,omitempty"`
Used uint64 `protobuf:"varint,3,opt,name=used" json:"used,omitempty"`
Free uint64 `protobuf:"varint,4,opt,name=free" json:"free,omitempty"`
Self uint64 `protobuf:"varint,5,opt,name=self" json:"self,omitempty"`
Heap uint64 `protobuf:"varint,6,opt,name=heap" json:"heap,omitempty"`
Stack uint64 `protobuf:"varint,7,opt,name=stack" json:"stack,omitempty"`
}
func (m *MemStatus) Reset() { *m = MemStatus{} }
func (m *MemStatus) String() string { return proto.CompactTextString(m) }
func (*MemStatus) ProtoMessage() {}
func (*MemStatus) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{29} }
func (m *MemStatus) GetGoroutines() int32 {
if m != nil {
return m.Goroutines
}
return 0
}
func (m *MemStatus) GetAll() uint64 {
if m != nil {
return m.All
}
return 0
}
func (m *MemStatus) GetUsed() uint64 {
if m != nil {
return m.Used
}
return 0
}
func (m *MemStatus) GetFree() uint64 {
if m != nil {
return m.Free
}
return 0
}
func (m *MemStatus) GetSelf() uint64 {
if m != nil {
return m.Self
}
return 0
}
func (m *MemStatus) GetHeap() uint64 {
if m != nil {
return m.Heap
}
return 0
}
func (m *MemStatus) GetStack() uint64 {
if m != nil {
return m.Stack
}
return 0
}
func init() { func init() {
proto.RegisterType((*BatchDeleteRequest)(nil), "volume_server_pb.BatchDeleteRequest") proto.RegisterType((*BatchDeleteRequest)(nil), "volume_server_pb.BatchDeleteRequest")
proto.RegisterType((*BatchDeleteResponse)(nil), "volume_server_pb.BatchDeleteResponse") proto.RegisterType((*BatchDeleteResponse)(nil), "volume_server_pb.BatchDeleteResponse")
@ -573,6 +697,10 @@ func init() {
proto.RegisterType((*VolumeMountResponse)(nil), "volume_server_pb.VolumeMountResponse") proto.RegisterType((*VolumeMountResponse)(nil), "volume_server_pb.VolumeMountResponse")
proto.RegisterType((*VolumeUnmountRequest)(nil), "volume_server_pb.VolumeUnmountRequest") proto.RegisterType((*VolumeUnmountRequest)(nil), "volume_server_pb.VolumeUnmountRequest")
proto.RegisterType((*VolumeUnmountResponse)(nil), "volume_server_pb.VolumeUnmountResponse") proto.RegisterType((*VolumeUnmountResponse)(nil), "volume_server_pb.VolumeUnmountResponse")
proto.RegisterType((*VolumeUiPageRequest)(nil), "volume_server_pb.VolumeUiPageRequest")
proto.RegisterType((*VolumeUiPageResponse)(nil), "volume_server_pb.VolumeUiPageResponse")
proto.RegisterType((*DiskStatus)(nil), "volume_server_pb.DiskStatus")
proto.RegisterType((*MemStatus)(nil), "volume_server_pb.MemStatus")
} }
// Reference imports to suppress errors if they are not otherwise used. // Reference imports to suppress errors if they are not otherwise used.
@ -1015,61 +1143,69 @@ var _VolumeServer_serviceDesc = grpc.ServiceDesc{
func init() { proto.RegisterFile("volume_server.proto", fileDescriptor0) } func init() { proto.RegisterFile("volume_server.proto", fileDescriptor0) }
var fileDescriptor0 = []byte{ var fileDescriptor0 = []byte{
// 892 bytes of a gzipped FileDescriptorProto
0x1f, 0x8b, 0x08, 0x00, 0x00, 0x09, 0x6e, 0x88, 0x02, 0xff, 0x94, 0x56, 0xdd, 0x6e, 0xeb, 0x44,
0x10, 0x8e, 0x9b, 0xdf, 0x4e, 0x12, 0x4e, 0xd8, 0xf4, 0x34, 0x3e, 0x3e, 0x70, 0x08, 0x0b, 0xb4,
0xe9, 0x0f, 0x45, 0xb4, 0x02, 0x8a, 0xb8, 0x01, 0x5a, 0x40, 0xb9, 0x40, 0x95, 0x5c, 0xd1, 0x1b,
0x2a, 0x59, 0x8e, 0xbd, 0x69, 0xad, 0x3a, 0xb6, 0x6b, 0xaf, 0xab, 0x96, 0x37, 0xe0, 0x11, 0x78,
0x03, 0xde, 0x89, 0x97, 0x41, 0xde, 0x5d, 0xbb, 0xfe, 0x4b, 0xed, 0x73, 0xe7, 0x9d, 0x9d, 0xf9,
0xbe, 0x99, 0xf1, 0xf8, 0x1b, 0xc3, 0xf8, 0xc1, 0xb5, 0xc3, 0x15, 0xd1, 0x02, 0xe2, 0x3f, 0x10,
0xff, 0xc8, 0xf3, 0x5d, 0xea, 0xa2, 0x51, 0xc6, 0xa8, 0x79, 0x0b, 0xfc, 0x15, 0xa0, 0x9f, 0x75,
0x6a, 0xdc, 0x9e, 0x13, 0x9b, 0x50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, 0x49,
0x59, 0x52, 0xd1, 0xc1, 0xba, 0xdf, 0x79, 0x15, 0xc5, 0xb6, 0x1e, 0xb5, 0x31, 0xcd, 0xc8, 0x16,
0x30, 0xca, 0x0b, 0x1f, 0xaa, 0x69, 0xba, 0x1a, 0x09, 0xb7, 0x1e, 0x34, 0x99, 0xe5, 0xb3, 0x29,
0x0b, 0x61, 0x5d, 0x36, 0x6b, 0x54, 0xb6, 0x2e, 0x9b, 0x75, 0xba, 0x6a, 0x6f, 0xa0, 0x4b, 0xb8,
0x53, 0x52, 0x18, 0x34, 0x7f, 0x57, 0x80, 0xbc, 0x76, 0x59, 0x07, 0x2d, 0x2c, 0x33, 0x26, 0x02,
0xff, 0x2b, 0x8e, 0x79, 0xf4, 0xf0, 0x5d, 0xee, 0x39, 0x8d, 0xb2, 0xe6, 0xcd, 0x86, 0x19, 0xcd,
0x6b, 0x18, 0xe6, 0xa6, 0x7b, 0xdd, 0xe0, 0xa8, 0xea, 0x45, 0xdd, 0xe0, 0xa8, 0x93, 0x88, 0x0d,
0x74, 0x0e, 0xe3, 0xc2, 0xbc, 0x47, 0x0f, 0xd6, 0x79, 0x16, 0x55, 0xc4, 0x7a, 0xd8, 0x68, 0x97,
0x72, 0x9c, 0x6f, 0xc9, 0xff, 0x44, 0x4f, 0xff, 0x09, 0x00, 0x00, 0xff, 0xff, 0x60, 0xe6, 0x57,
0xdf, 0x2a, 0x0d, 0x00, 0x00,
} }

3
weed/server/volume_server_handlers_admin.go

@ -6,6 +6,7 @@ import (
"github.com/chrislusf/seaweedfs/weed/stats" "github.com/chrislusf/seaweedfs/weed/stats"
"github.com/chrislusf/seaweedfs/weed/util" "github.com/chrislusf/seaweedfs/weed/util"
"github.com/chrislusf/seaweedfs/weed/pb/volume_server_pb"
) )
func (vs *VolumeServer) statusHandler(w http.ResponseWriter, r *http.Request) { func (vs *VolumeServer) statusHandler(w http.ResponseWriter, r *http.Request) {
@ -18,7 +19,7 @@ func (vs *VolumeServer) statusHandler(w http.ResponseWriter, r *http.Request) {
func (vs *VolumeServer) statsDiskHandler(w http.ResponseWriter, r *http.Request) { func (vs *VolumeServer) statsDiskHandler(w http.ResponseWriter, r *http.Request) {
m := make(map[string]interface{}) m := make(map[string]interface{})
m["Version"] = util.VERSION m["Version"] = util.VERSION
var ds []*stats.DiskStatus
var ds []*volume_server_pb.DiskStatus
for _, loc := range vs.store.Locations { for _, loc := range vs.store.Locations {
if dir, e := filepath.Abs(loc.Directory); e == nil { if dir, e := filepath.Abs(loc.Directory); e == nil {
ds = append(ds, stats.NewDiskStatus(dir)) ds = append(ds, stats.NewDiskStatus(dir))

3
weed/server/volume_server_handlers_ui.go

@ -8,12 +8,13 @@ import (
ui "github.com/chrislusf/seaweedfs/weed/server/volume_server_ui" ui "github.com/chrislusf/seaweedfs/weed/server/volume_server_ui"
"github.com/chrislusf/seaweedfs/weed/stats" "github.com/chrislusf/seaweedfs/weed/stats"
"github.com/chrislusf/seaweedfs/weed/util" "github.com/chrislusf/seaweedfs/weed/util"
"github.com/chrislusf/seaweedfs/weed/pb/volume_server_pb"
) )
func (vs *VolumeServer) uiStatusHandler(w http.ResponseWriter, r *http.Request) { func (vs *VolumeServer) uiStatusHandler(w http.ResponseWriter, r *http.Request) {
infos := make(map[string]interface{}) infos := make(map[string]interface{})
infos["Up Time"] = time.Now().Sub(startTime).String() infos["Up Time"] = time.Now().Sub(startTime).String()
var ds []*stats.DiskStatus
var ds []*volume_server_pb.DiskStatus
for _, loc := range vs.store.Locations { for _, loc := range vs.store.Locations {
if dir, e := filepath.Abs(loc.Directory); e == nil { if dir, e := filepath.Abs(loc.Directory); e == nil {
ds = append(ds, stats.NewDiskStatus(dir)) ds = append(ds, stats.NewDiskStatus(dir))

13
weed/stats/disk.go

@ -1,14 +1,9 @@
package stats package stats
type DiskStatus struct {
Dir string
All uint64
Used uint64
Free uint64
}
import "github.com/chrislusf/seaweedfs/weed/pb/volume_server_pb"
func NewDiskStatus(path string) (disk *DiskStatus) {
disk = &DiskStatus{Dir: path}
disk.fillInStatus()
func NewDiskStatus(path string) (disk *volume_server_pb.DiskStatus) {
disk = &volume_server_pb.DiskStatus{Dir: path}
fillInDiskStatus(disk)
return return
} }

4
weed/stats/disk_notsupported.go

@ -2,6 +2,8 @@
package stats package stats
func (disk *DiskStatus) fillInStatus() {
import "github.com/chrislusf/seaweedfs/weed/pb/volume_server_pb"
func fillInDiskStatus(status *volume_server_pb.DiskStatus) {
return return
} }

4
weed/stats/disk_supported.go

@ -4,9 +4,11 @@ package stats
import ( import (
"syscall" "syscall"
"github.com/chrislusf/seaweedfs/weed/pb/volume_server_pb"
) )
func (disk *DiskStatus) fillInStatus() {
func fillInDiskStatus(disk *volume_server_pb.DiskStatus) {
fs := syscall.Statfs_t{} fs := syscall.Statfs_t{}
err := syscall.Statfs(disk.Dir, &fs) err := syscall.Statfs(disk.Dir, &fs)
if err != nil { if err != nil {

19
weed/stats/memory.go

@ -2,27 +2,18 @@ package stats
import ( import (
"runtime" "runtime"
"github.com/chrislusf/seaweedfs/weed/pb/volume_server_pb"
) )
type MemStatus struct {
Goroutines int
All uint64
Used uint64
Free uint64
Self uint64
Heap uint64
Stack uint64
}
func MemStat() MemStatus {
mem := MemStatus{}
mem.Goroutines = runtime.NumGoroutine()
func MemStat() *volume_server_pb.MemStatus {
mem := &volume_server_pb.MemStatus{}
mem.Goroutines = int32(runtime.NumGoroutine())
memStat := new(runtime.MemStats) memStat := new(runtime.MemStats)
runtime.ReadMemStats(memStat) runtime.ReadMemStats(memStat)
mem.Self = memStat.Alloc mem.Self = memStat.Alloc
mem.Heap = memStat.HeapAlloc mem.Heap = memStat.HeapAlloc
mem.Stack = memStat.StackInuse mem.Stack = memStat.StackInuse
mem.fillInStatus()
fillInMemStatus(mem)
return mem return mem
} }

4
weed/stats/memory_notsupported.go

@ -2,6 +2,8 @@
package stats package stats
func (mem *MemStatus) fillInStatus() {
import "github.com/chrislusf/seaweedfs/weed/pb/volume_server_pb"
func fillInMemStatus(status *volume_server_pb.MemStatus) {
return return
} }

4
weed/stats/memory_supported.go

@ -4,9 +4,11 @@ package stats
import ( import (
"syscall" "syscall"
"github.com/chrislusf/seaweedfs/weed/pb/volume_server_pb"
) )
func (mem *MemStatus) fillInStatus() {
func fillInMemStatus(mem *volume_server_pb.MemStatus) {
//system memory usage //system memory usage
sysInfo := new(syscall.Sysinfo_t) sysInfo := new(syscall.Sysinfo_t)
err := syscall.Sysinfo(sysInfo) err := syscall.Sysinfo(sysInfo)

Loading…
Cancel
Save