storagenode/nodestats: combine stats into single RPC call (#2455)

* change satellite nodestats endpoint
This commit is contained in:
Yaroslav Vorobiov 2019-07-08 10:33:43 -04:00 committed by Yehor Butko
parent 65aa8f227f
commit 524eb24c83
6 changed files with 224 additions and 334 deletions

View File

@ -26,204 +26,150 @@ var _ = time.Kitchen
// proto package needs to be updated.
const _ = proto.GoGoProtoPackageIsVersion2 // please upgrade the proto package
type AuditCheckRequest struct {
type ReputationStats struct {
TotalCount int64 `protobuf:"varint,1,opt,name=total_count,json=totalCount,proto3" json:"total_count,omitempty"`
SuccessCount int64 `protobuf:"varint,2,opt,name=success_count,json=successCount,proto3" json:"success_count,omitempty"`
ReputationAlpha float64 `protobuf:"fixed64,3,opt,name=reputation_alpha,json=reputationAlpha,proto3" json:"reputation_alpha,omitempty"`
ReputationBeta float64 `protobuf:"fixed64,4,opt,name=reputation_beta,json=reputationBeta,proto3" json:"reputation_beta,omitempty"`
ReputationScore float64 `protobuf:"fixed64,5,opt,name=reputation_score,json=reputationScore,proto3" json:"reputation_score,omitempty"`
XXX_NoUnkeyedLiteral struct{} `json:"-"`
XXX_unrecognized []byte `json:"-"`
XXX_sizecache int32 `json:"-"`
}
func (m *AuditCheckRequest) Reset() { *m = AuditCheckRequest{} }
func (m *AuditCheckRequest) String() string { return proto.CompactTextString(m) }
func (*AuditCheckRequest) ProtoMessage() {}
func (*AuditCheckRequest) Descriptor() ([]byte, []int) {
func (m *ReputationStats) Reset() { *m = ReputationStats{} }
func (m *ReputationStats) String() string { return proto.CompactTextString(m) }
func (*ReputationStats) ProtoMessage() {}
func (*ReputationStats) Descriptor() ([]byte, []int) {
return fileDescriptor_e0b184ee117142aa, []int{0}
}
func (m *AuditCheckRequest) XXX_Unmarshal(b []byte) error {
return xxx_messageInfo_AuditCheckRequest.Unmarshal(m, b)
func (m *ReputationStats) XXX_Unmarshal(b []byte) error {
return xxx_messageInfo_ReputationStats.Unmarshal(m, b)
}
func (m *AuditCheckRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
return xxx_messageInfo_AuditCheckRequest.Marshal(b, m, deterministic)
func (m *ReputationStats) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
return xxx_messageInfo_ReputationStats.Marshal(b, m, deterministic)
}
func (m *AuditCheckRequest) XXX_Merge(src proto.Message) {
xxx_messageInfo_AuditCheckRequest.Merge(m, src)
func (m *ReputationStats) XXX_Merge(src proto.Message) {
xxx_messageInfo_ReputationStats.Merge(m, src)
}
func (m *AuditCheckRequest) XXX_Size() int {
return xxx_messageInfo_AuditCheckRequest.Size(m)
func (m *ReputationStats) XXX_Size() int {
return xxx_messageInfo_ReputationStats.Size(m)
}
func (m *AuditCheckRequest) XXX_DiscardUnknown() {
xxx_messageInfo_AuditCheckRequest.DiscardUnknown(m)
func (m *ReputationStats) XXX_DiscardUnknown() {
xxx_messageInfo_ReputationStats.DiscardUnknown(m)
}
var xxx_messageInfo_AuditCheckRequest proto.InternalMessageInfo
var xxx_messageInfo_ReputationStats proto.InternalMessageInfo
type AuditCheckResponse struct {
TotalCount int64 `protobuf:"varint,1,opt,name=total_count,json=totalCount,proto3" json:"total_count,omitempty"`
SuccessCount int64 `protobuf:"varint,2,opt,name=success_count,json=successCount,proto3" json:"success_count,omitempty"`
ReputationAlpha float64 `protobuf:"fixed64,3,opt,name=reputation_alpha,json=reputationAlpha,proto3" json:"reputation_alpha,omitempty"`
ReputationBeta float64 `protobuf:"fixed64,4,opt,name=reputation_beta,json=reputationBeta,proto3" json:"reputation_beta,omitempty"`
ReputationScore float64 `protobuf:"fixed64,5,opt,name=reputation_score,json=reputationScore,proto3" json:"reputation_score,omitempty"`
func (m *ReputationStats) GetTotalCount() int64 {
if m != nil {
return m.TotalCount
}
return 0
}
func (m *ReputationStats) GetSuccessCount() int64 {
if m != nil {
return m.SuccessCount
}
return 0
}
func (m *ReputationStats) GetReputationAlpha() float64 {
if m != nil {
return m.ReputationAlpha
}
return 0
}
func (m *ReputationStats) GetReputationBeta() float64 {
if m != nil {
return m.ReputationBeta
}
return 0
}
func (m *ReputationStats) GetReputationScore() float64 {
if m != nil {
return m.ReputationScore
}
return 0
}
type GetStatsRequest struct {
XXX_NoUnkeyedLiteral struct{} `json:"-"`
XXX_unrecognized []byte `json:"-"`
XXX_sizecache int32 `json:"-"`
}
func (m *AuditCheckResponse) Reset() { *m = AuditCheckResponse{} }
func (m *AuditCheckResponse) String() string { return proto.CompactTextString(m) }
func (*AuditCheckResponse) ProtoMessage() {}
func (*AuditCheckResponse) Descriptor() ([]byte, []int) {
func (m *GetStatsRequest) Reset() { *m = GetStatsRequest{} }
func (m *GetStatsRequest) String() string { return proto.CompactTextString(m) }
func (*GetStatsRequest) ProtoMessage() {}
func (*GetStatsRequest) Descriptor() ([]byte, []int) {
return fileDescriptor_e0b184ee117142aa, []int{1}
}
func (m *AuditCheckResponse) XXX_Unmarshal(b []byte) error {
return xxx_messageInfo_AuditCheckResponse.Unmarshal(m, b)
func (m *GetStatsRequest) XXX_Unmarshal(b []byte) error {
return xxx_messageInfo_GetStatsRequest.Unmarshal(m, b)
}
func (m *AuditCheckResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
return xxx_messageInfo_AuditCheckResponse.Marshal(b, m, deterministic)
func (m *GetStatsRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
return xxx_messageInfo_GetStatsRequest.Marshal(b, m, deterministic)
}
func (m *AuditCheckResponse) XXX_Merge(src proto.Message) {
xxx_messageInfo_AuditCheckResponse.Merge(m, src)
func (m *GetStatsRequest) XXX_Merge(src proto.Message) {
xxx_messageInfo_GetStatsRequest.Merge(m, src)
}
func (m *AuditCheckResponse) XXX_Size() int {
return xxx_messageInfo_AuditCheckResponse.Size(m)
func (m *GetStatsRequest) XXX_Size() int {
return xxx_messageInfo_GetStatsRequest.Size(m)
}
func (m *AuditCheckResponse) XXX_DiscardUnknown() {
xxx_messageInfo_AuditCheckResponse.DiscardUnknown(m)
func (m *GetStatsRequest) XXX_DiscardUnknown() {
xxx_messageInfo_GetStatsRequest.DiscardUnknown(m)
}
var xxx_messageInfo_AuditCheckResponse proto.InternalMessageInfo
var xxx_messageInfo_GetStatsRequest proto.InternalMessageInfo
func (m *AuditCheckResponse) GetTotalCount() int64 {
if m != nil {
return m.TotalCount
}
return 0
type GetStatsResponse struct {
UptimeCheck *ReputationStats `protobuf:"bytes,1,opt,name=uptime_check,json=uptimeCheck,proto3" json:"uptime_check,omitempty"`
AuditCheck *ReputationStats `protobuf:"bytes,2,opt,name=audit_check,json=auditCheck,proto3" json:"audit_check,omitempty"`
XXX_NoUnkeyedLiteral struct{} `json:"-"`
XXX_unrecognized []byte `json:"-"`
XXX_sizecache int32 `json:"-"`
}
func (m *AuditCheckResponse) GetSuccessCount() int64 {
if m != nil {
return m.SuccessCount
}
return 0
}
func (m *AuditCheckResponse) GetReputationAlpha() float64 {
if m != nil {
return m.ReputationAlpha
}
return 0
}
func (m *AuditCheckResponse) GetReputationBeta() float64 {
if m != nil {
return m.ReputationBeta
}
return 0
}
func (m *AuditCheckResponse) GetReputationScore() float64 {
if m != nil {
return m.ReputationScore
}
return 0
}
type UptimeCheckRequest struct {
XXX_NoUnkeyedLiteral struct{} `json:"-"`
XXX_unrecognized []byte `json:"-"`
XXX_sizecache int32 `json:"-"`
}
func (m *UptimeCheckRequest) Reset() { *m = UptimeCheckRequest{} }
func (m *UptimeCheckRequest) String() string { return proto.CompactTextString(m) }
func (*UptimeCheckRequest) ProtoMessage() {}
func (*UptimeCheckRequest) Descriptor() ([]byte, []int) {
func (m *GetStatsResponse) Reset() { *m = GetStatsResponse{} }
func (m *GetStatsResponse) String() string { return proto.CompactTextString(m) }
func (*GetStatsResponse) ProtoMessage() {}
func (*GetStatsResponse) Descriptor() ([]byte, []int) {
return fileDescriptor_e0b184ee117142aa, []int{2}
}
func (m *UptimeCheckRequest) XXX_Unmarshal(b []byte) error {
return xxx_messageInfo_UptimeCheckRequest.Unmarshal(m, b)
func (m *GetStatsResponse) XXX_Unmarshal(b []byte) error {
return xxx_messageInfo_GetStatsResponse.Unmarshal(m, b)
}
func (m *UptimeCheckRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
return xxx_messageInfo_UptimeCheckRequest.Marshal(b, m, deterministic)
func (m *GetStatsResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
return xxx_messageInfo_GetStatsResponse.Marshal(b, m, deterministic)
}
func (m *UptimeCheckRequest) XXX_Merge(src proto.Message) {
xxx_messageInfo_UptimeCheckRequest.Merge(m, src)
func (m *GetStatsResponse) XXX_Merge(src proto.Message) {
xxx_messageInfo_GetStatsResponse.Merge(m, src)
}
func (m *UptimeCheckRequest) XXX_Size() int {
return xxx_messageInfo_UptimeCheckRequest.Size(m)
func (m *GetStatsResponse) XXX_Size() int {
return xxx_messageInfo_GetStatsResponse.Size(m)
}
func (m *UptimeCheckRequest) XXX_DiscardUnknown() {
xxx_messageInfo_UptimeCheckRequest.DiscardUnknown(m)
func (m *GetStatsResponse) XXX_DiscardUnknown() {
xxx_messageInfo_GetStatsResponse.DiscardUnknown(m)
}
var xxx_messageInfo_UptimeCheckRequest proto.InternalMessageInfo
var xxx_messageInfo_GetStatsResponse proto.InternalMessageInfo
type UptimeCheckResponse struct {
TotalCount int64 `protobuf:"varint,1,opt,name=total_count,json=totalCount,proto3" json:"total_count,omitempty"`
SuccessCount int64 `protobuf:"varint,2,opt,name=success_count,json=successCount,proto3" json:"success_count,omitempty"`
ReputationAlpha float64 `protobuf:"fixed64,3,opt,name=reputation_alpha,json=reputationAlpha,proto3" json:"reputation_alpha,omitempty"`
ReputationBeta float64 `protobuf:"fixed64,4,opt,name=reputation_beta,json=reputationBeta,proto3" json:"reputation_beta,omitempty"`
ReputationScore float64 `protobuf:"fixed64,5,opt,name=reputation_score,json=reputationScore,proto3" json:"reputation_score,omitempty"`
XXX_NoUnkeyedLiteral struct{} `json:"-"`
XXX_unrecognized []byte `json:"-"`
XXX_sizecache int32 `json:"-"`
}
func (m *UptimeCheckResponse) Reset() { *m = UptimeCheckResponse{} }
func (m *UptimeCheckResponse) String() string { return proto.CompactTextString(m) }
func (*UptimeCheckResponse) ProtoMessage() {}
func (*UptimeCheckResponse) Descriptor() ([]byte, []int) {
return fileDescriptor_e0b184ee117142aa, []int{3}
}
func (m *UptimeCheckResponse) XXX_Unmarshal(b []byte) error {
return xxx_messageInfo_UptimeCheckResponse.Unmarshal(m, b)
}
func (m *UptimeCheckResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
return xxx_messageInfo_UptimeCheckResponse.Marshal(b, m, deterministic)
}
func (m *UptimeCheckResponse) XXX_Merge(src proto.Message) {
xxx_messageInfo_UptimeCheckResponse.Merge(m, src)
}
func (m *UptimeCheckResponse) XXX_Size() int {
return xxx_messageInfo_UptimeCheckResponse.Size(m)
}
func (m *UptimeCheckResponse) XXX_DiscardUnknown() {
xxx_messageInfo_UptimeCheckResponse.DiscardUnknown(m)
}
var xxx_messageInfo_UptimeCheckResponse proto.InternalMessageInfo
func (m *UptimeCheckResponse) GetTotalCount() int64 {
func (m *GetStatsResponse) GetUptimeCheck() *ReputationStats {
if m != nil {
return m.TotalCount
return m.UptimeCheck
}
return 0
return nil
}
func (m *UptimeCheckResponse) GetSuccessCount() int64 {
func (m *GetStatsResponse) GetAuditCheck() *ReputationStats {
if m != nil {
return m.SuccessCount
return m.AuditCheck
}
return 0
}
func (m *UptimeCheckResponse) GetReputationAlpha() float64 {
if m != nil {
return m.ReputationAlpha
}
return 0
}
func (m *UptimeCheckResponse) GetReputationBeta() float64 {
if m != nil {
return m.ReputationBeta
}
return 0
}
func (m *UptimeCheckResponse) GetReputationScore() float64 {
if m != nil {
return m.ReputationScore
}
return 0
return nil
}
type DailyStorageUsageRequest struct {
@ -238,7 +184,7 @@ func (m *DailyStorageUsageRequest) Reset() { *m = DailyStorageUsageReque
func (m *DailyStorageUsageRequest) String() string { return proto.CompactTextString(m) }
func (*DailyStorageUsageRequest) ProtoMessage() {}
func (*DailyStorageUsageRequest) Descriptor() ([]byte, []int) {
return fileDescriptor_e0b184ee117142aa, []int{4}
return fileDescriptor_e0b184ee117142aa, []int{3}
}
func (m *DailyStorageUsageRequest) XXX_Unmarshal(b []byte) error {
return xxx_messageInfo_DailyStorageUsageRequest.Unmarshal(m, b)
@ -284,7 +230,7 @@ func (m *DailyStorageUsageResponse) Reset() { *m = DailyStorageUsageResp
func (m *DailyStorageUsageResponse) String() string { return proto.CompactTextString(m) }
func (*DailyStorageUsageResponse) ProtoMessage() {}
func (*DailyStorageUsageResponse) Descriptor() ([]byte, []int) {
return fileDescriptor_e0b184ee117142aa, []int{5}
return fileDescriptor_e0b184ee117142aa, []int{4}
}
func (m *DailyStorageUsageResponse) XXX_Unmarshal(b []byte) error {
return xxx_messageInfo_DailyStorageUsageResponse.Unmarshal(m, b)
@ -325,7 +271,7 @@ func (m *DailyStorageUsageResponse_StorageUsage) Reset() {
func (m *DailyStorageUsageResponse_StorageUsage) String() string { return proto.CompactTextString(m) }
func (*DailyStorageUsageResponse_StorageUsage) ProtoMessage() {}
func (*DailyStorageUsageResponse_StorageUsage) Descriptor() ([]byte, []int) {
return fileDescriptor_e0b184ee117142aa, []int{5, 0}
return fileDescriptor_e0b184ee117142aa, []int{4, 0}
}
func (m *DailyStorageUsageResponse_StorageUsage) XXX_Unmarshal(b []byte) error {
return xxx_messageInfo_DailyStorageUsageResponse_StorageUsage.Unmarshal(m, b)
@ -360,10 +306,9 @@ func (m *DailyStorageUsageResponse_StorageUsage) GetTimeStamp() time.Time {
}
func init() {
proto.RegisterType((*AuditCheckRequest)(nil), "nodestats.AuditCheckRequest")
proto.RegisterType((*AuditCheckResponse)(nil), "nodestats.AuditCheckResponse")
proto.RegisterType((*UptimeCheckRequest)(nil), "nodestats.UptimeCheckRequest")
proto.RegisterType((*UptimeCheckResponse)(nil), "nodestats.UptimeCheckResponse")
proto.RegisterType((*ReputationStats)(nil), "nodestats.ReputationStats")
proto.RegisterType((*GetStatsRequest)(nil), "nodestats.GetStatsRequest")
proto.RegisterType((*GetStatsResponse)(nil), "nodestats.GetStatsResponse")
proto.RegisterType((*DailyStorageUsageRequest)(nil), "nodestats.DailyStorageUsageRequest")
proto.RegisterType((*DailyStorageUsageResponse)(nil), "nodestats.DailyStorageUsageResponse")
proto.RegisterType((*DailyStorageUsageResponse_StorageUsage)(nil), "nodestats.DailyStorageUsageResponse.StorageUsage")
@ -372,39 +317,39 @@ func init() {
func init() { proto.RegisterFile("nodestats.proto", fileDescriptor_e0b184ee117142aa) }
var fileDescriptor_e0b184ee117142aa = []byte{
// 498 bytes of a gzipped FileDescriptorProto
0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xdc, 0x93, 0x31, 0x6f, 0xd3, 0x40,
0x14, 0xc7, 0x39, 0x37, 0x04, 0xf2, 0x9c, 0xb6, 0xe4, 0xc2, 0x60, 0x2c, 0xc0, 0x91, 0x8b, 0xd4,
0xb0, 0xb8, 0x22, 0x30, 0xb0, 0x36, 0xe9, 0x12, 0x09, 0x31, 0x38, 0xed, 0xc2, 0xc0, 0xe9, 0x62,
0x5f, 0x5d, 0x8b, 0x24, 0x67, 0x7c, 0xcf, 0x42, 0xec, 0x4c, 0x4c, 0x7c, 0x04, 0x3e, 0x0e, 0x5f,
0x81, 0x0e, 0xe5, 0xab, 0xa0, 0x3b, 0xbb, 0xc4, 0x49, 0x08, 0xca, 0xcc, 0xe8, 0xdf, 0xfd, 0xdf,
0xf3, 0xfd, 0xdf, 0xfd, 0x1f, 0x1c, 0x2e, 0x64, 0x2c, 0x14, 0x72, 0x54, 0x41, 0x96, 0x4b, 0x94,
0xb4, 0xf5, 0x07, 0xb8, 0x90, 0xc8, 0x44, 0x96, 0xd8, 0xf5, 0x12, 0x29, 0x93, 0x99, 0x38, 0x31,
0x5f, 0xd3, 0xe2, 0xf2, 0x04, 0xd3, 0xb9, 0x96, 0xcd, 0xb3, 0x52, 0xe0, 0x77, 0xa1, 0x73, 0x5a,
0xc4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00,
// 509 bytes of a gzipped FileDescriptorProto
0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x8c, 0x93, 0xcf, 0x6e, 0xd3, 0x40,
0x10, 0xc6, 0x59, 0x27, 0x84, 0x66, 0x9c, 0x36, 0xcd, 0x72, 0x31, 0xe1, 0xe0, 0xc8, 0x45, 0x6a,
0xb8, 0xb8, 0x22, 0x70, 0x40, 0x42, 0x1c, 0x48, 0x2a, 0xa1, 0x5e, 0x38, 0x6c, 0xca, 0x85, 0x03,
0xab, 0x8d, 0xbd, 0x75, 0x2d, 0x92, 0xac, 0xf1, 0x8e, 0x85, 0x78, 0x05, 0x0e, 0x88, 0x47, 0xe0,
0x11, 0x78, 0x0c, 0x9e, 0x80, 0x03, 0x87, 0xf2, 0x2a, 0x68, 0xd7, 0xce, 0x1f, 0x4c, 0xa1, 0x39,
0xfa, 0xb7, 0xdf, 0x7c, 0x99, 0xf9, 0x66, 0x02, 0xdd, 0xa5, 0x8a, 0xa5, 0x46, 0x81, 0x3a, 0xcc,
0x72, 0x85, 0x8a, 0xb6, 0xd7, 0xa0, 0x0f, 0x89, 0x4a, 0x54, 0x89, 0xfb, 0x7e, 0xa2, 0x54, 0x32,
0x97, 0x27, 0xf6, 0x6b, 0x56, 0x5c, 0x9c, 0x60, 0xba, 0x30, 0xb2, 0x45, 0x56, 0x0a, 0x82, 0x1f,
0x04, 0xba, 0x4c, 0x66, 0x05, 0x0a, 0x4c, 0xd5, 0x72, 0x6a, 0x0c, 0xa8, 0x0f, 0x2e, 0x2a, 0x14,
0x73, 0x1e, 0xa9, 0x62, 0x89, 0x1e, 0x19, 0x90, 0x61, 0x83, 0x81, 0x45, 0x13, 0x43, 0xe8, 0x11,
0xec, 0xeb, 0x22, 0x8a, 0xa4, 0xd6, 0x95, 0xc4, 0xb1, 0x92, 0x4e, 0x05, 0x4b, 0xd1, 0x43, 0x38,
0xcc, 0xd7, 0xc6, 0x5c, 0xcc, 0xb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5e, 0xa9,
0x58, 0x9e, 0x9d, 0xb2, 0x96, 0x79, 0x3e, 0x8b, 0xa9, 0x80, 0xbb, 0xb1, 0x71, 0xe1, 0xba, 0xb4,
0xe1, 0x85, 0xf1, 0xf1, 0x9c, 0x41, 0x63, 0xe8, 0x8e, 0x1e, 0x6d, 0x05, 0xf3, 0xcf, 0xdf, 0x0a,
0xff, 0x80, 0xbd, 0xb8, 0xae, 0xeb, 0x7f, 0x80, 0xce, 0xf6, 0x37, 0x0d, 0x60, 0x5f, 0x20, 0xcf,
0xa5, 0x46, 0x6e, 0x8f, 0xd4, 0x8e, 0x4e, 0x98, 0x2b, 0x90, 0x49, 0x8d, 0xe7, 0x06, 0xd1, 0x09,
0x80, 0x5d, 0xb2, 0x9d, 0xdc, 0xde, 0xe1, 0xae, 0xd9, 0xb4, 0x4d, 0xdd, 0xd4, 0xc0, 0xd1, 0x37,
0x02, 0x6d, 0x33, 0x6e, 0xf9, 0x37, 0x99, 0xc0, 0xde, 0xea, 0x9a, 0xe8, 0xf6, 0xc6, 0x6b, 0x67,
0xd7, 0xbf, 0x7f, 0xed, 0x5b, 0x95, 0xeb, 0x5b, 0xe8, 0xfd, 0x15, 0x04, 0x3d, 0xfa, 0x7f, 0x4c,
0xa5, 0xed, 0x83, 0x5d, 0xb2, 0x1c, 0x37, 0xdf, 0x38, 0xd9, 0x6c, 0xd6, 0xb2, 0x13, 0x3e, 0xfe,
0x1d, 0x00, 0x00, 0xff, 0xff, 0xf4, 0xc8, 0x68, 0x4c, 0x37, 0x04, 0x00, 0x00,
}
// Reference imports to suppress errors if they are not otherwise used.
@ -419,8 +364,7 @@ const _ = grpc.SupportPackageIsVersion4
//
// For semantics around ctx use and closing/ending streaming RPCs, please refer to https://godoc.org/google.golang.org/grpc#ClientConn.NewStream.
type NodeStatsClient interface {
AuditCheck(ctx context.Context, in *AuditCheckRequest, opts ...grpc.CallOption) (*AuditCheckResponse, error)
UptimeCheck(ctx context.Context, in *UptimeCheckRequest, opts ...grpc.CallOption) (*UptimeCheckResponse, error)
GetStats(ctx context.Context, in *GetStatsRequest, opts ...grpc.CallOption) (*GetStatsResponse, error)
DailyStorageUsage(ctx context.Context, in *DailyStorageUsageRequest, opts ...grpc.CallOption) (*DailyStorageUsageResponse, error)
}
@ -432,18 +376,9 @@ func NewNodeStatsClient(cc *grpc.ClientConn) NodeStatsClient {
return &nodeStatsClient{cc}
}
func (c *nodeStatsClient) AuditCheck(ctx context.Context, in *AuditCheckRequest, opts ...grpc.CallOption) (*AuditCheckResponse, error) {
out := new(AuditCheckResponse)
err := c.cc.Invoke(ctx, "/nodestats.NodeStats/AuditCheck", in, out, opts...)
if err != nil {
return nil, err
}
return out, nil
}
func (c *nodeStatsClient) UptimeCheck(ctx context.Context, in *UptimeCheckRequest, opts ...grpc.CallOption) (*UptimeCheckResponse, error) {
out := new(UptimeCheckResponse)
err := c.cc.Invoke(ctx, "/nodestats.NodeStats/UptimeCheck", in, out, opts...)
func (c *nodeStatsClient) GetStats(ctx context.Context, in *GetStatsRequest, opts ...grpc.CallOption) (*GetStatsResponse, error) {
out := new(GetStatsResponse)
err := c.cc.Invoke(ctx, "/nodestats.NodeStats/GetStats", in, out, opts...)
if err != nil {
return nil, err
}
@ -461,8 +396,7 @@ func (c *nodeStatsClient) DailyStorageUsage(ctx context.Context, in *DailyStorag
// NodeStatsServer is the server API for NodeStats service.
type NodeStatsServer interface {
AuditCheck(context.Context, *AuditCheckRequest) (*AuditCheckResponse, error)
UptimeCheck(context.Context, *UptimeCheckRequest) (*UptimeCheckResponse, error)
GetStats(context.Context, *GetStatsRequest) (*GetStatsResponse, error)
DailyStorageUsage(context.Context, *DailyStorageUsageRequest) (*DailyStorageUsageResponse, error)
}
@ -470,38 +404,20 @@ func RegisterNodeStatsServer(s *grpc.Server, srv NodeStatsServer) {
s.RegisterService(&_NodeStats_serviceDesc, srv)
}
func _NodeStats_AuditCheck_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
in := new(AuditCheckRequest)
func _NodeStats_GetStats_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
in := new(GetStatsRequest)
if err := dec(in); err != nil {
return nil, err
}
if interceptor == nil {
return srv.(NodeStatsServer).AuditCheck(ctx, in)
return srv.(NodeStatsServer).GetStats(ctx, in)
}
info := &grpc.UnaryServerInfo{
Server: srv,
FullMethod: "/nodestats.NodeStats/AuditCheck",
FullMethod: "/nodestats.NodeStats/GetStats",
}
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
return srv.(NodeStatsServer).AuditCheck(ctx, req.(*AuditCheckRequest))
}
return interceptor(ctx, in, info, handler)
}
func _NodeStats_UptimeCheck_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
in := new(UptimeCheckRequest)
if err := dec(in); err != nil {
return nil, err
}
if interceptor == nil {
return srv.(NodeStatsServer).UptimeCheck(ctx, in)
}
info := &grpc.UnaryServerInfo{
Server: srv,
FullMethod: "/nodestats.NodeStats/UptimeCheck",
}
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
return srv.(NodeStatsServer).UptimeCheck(ctx, req.(*UptimeCheckRequest))
return srv.(NodeStatsServer).GetStats(ctx, req.(*GetStatsRequest))
}
return interceptor(ctx, in, info, handler)
}
@ -529,12 +445,8 @@ var _NodeStats_serviceDesc = grpc.ServiceDesc{
HandlerType: (*NodeStatsServer)(nil),
Methods: []grpc.MethodDesc{
{
MethodName: "AuditCheck",
Handler: _NodeStats_AuditCheck_Handler,
},
{
MethodName: "UptimeCheck",
Handler: _NodeStats_UptimeCheck_Handler,
MethodName: "GetStats",
Handler: _NodeStats_GetStats_Handler,
},
{
MethodName: "DailyStorageUsage",

View File

@ -10,14 +10,11 @@ import "gogo.proto";
import "google/protobuf/timestamp.proto";
service NodeStats {
rpc AuditCheck(AuditCheckRequest) returns (AuditCheckResponse);
rpc UptimeCheck(UptimeCheckRequest) returns (UptimeCheckResponse);
rpc GetStats(GetStatsRequest) returns (GetStatsResponse);
rpc DailyStorageUsage(DailyStorageUsageRequest) returns (DailyStorageUsageResponse);
}
message AuditCheckRequest {}
message AuditCheckResponse {
message ReputationStats {
int64 total_count = 1;
int64 success_count = 2;
double reputation_alpha = 3;
@ -25,14 +22,11 @@ message AuditCheckResponse {
double reputation_score = 5;
}
message UptimeCheckRequest {}
message GetStatsRequest {}
message UptimeCheckResponse {
int64 total_count = 1;
int64 success_count = 2;
double reputation_alpha = 3;
double reputation_beta = 4;
double reputation_score = 5;
message GetStatsResponse {
ReputationStats uptime_check = 1;
ReputationStats audit_check = 2;
}
message DailyStorageUsageRequest {

View File

@ -2469,10 +2469,7 @@
"def": {
"messages": [
{
"name": "AuditCheckRequest"
},
{
"name": "AuditCheckResponse",
"name": "ReputationStats",
"fields": [
{
"id": 1,
@ -2502,35 +2499,20 @@
]
},
{
"name": "UptimeCheckRequest"
"name": "GetStatsRequest"
},
{
"name": "UptimeCheckResponse",
"name": "GetStatsResponse",
"fields": [
{
"id": 1,
"name": "total_count",
"type": "int64"
"name": "uptime_check",
"type": "ReputationStats"
},
{
"id": 2,
"name": "success_count",
"type": "int64"
},
{
"id": 3,
"name": "reputation_alpha",
"type": "double"
},
{
"id": 4,
"name": "reputation_beta",
"type": "double"
},
{
"id": 5,
"name": "reputation_score",
"type": "double"
"name": "audit_check",
"type": "ReputationStats"
}
]
},
@ -2628,14 +2610,9 @@
"name": "NodeStats",
"rpcs": [
{
"name": "AuditCheck",
"in_type": "AuditCheckRequest",
"out_type": "AuditCheckResponse"
},
{
"name": "UptimeCheck",
"in_type": "UptimeCheckRequest",
"out_type": "UptimeCheckResponse"
"name": "GetStats",
"in_type": "GetStatsRequest",
"out_type": "GetStatsResponse"
},
{
"name": "DailyStorageUsage",

View File

@ -39,8 +39,8 @@ func NewEndpoint(log *zap.Logger, overlay overlay.DB, accounting accounting.Stor
}
}
// AuditCheck returns audit check information for client node
func (e *Endpoint) AuditCheck(ctx context.Context, req *pb.AuditCheckRequest) (_ *pb.AuditCheckResponse, err error) {
// GetStats sends node stats for client node
func (e *Endpoint) GetStats(ctx context.Context, req *pb.GetStatsRequest) (_ *pb.GetStatsResponse, err error) {
defer mon.Task()(&ctx)(&err)
peer, err := identity.PeerIdentityFromContext(ctx)
@ -53,43 +53,29 @@ func (e *Endpoint) AuditCheck(ctx context.Context, req *pb.AuditCheckRequest) (_
return nil, NodeStatsEndpointErr.Wrap(err)
}
reputationScore := calculateReputationScore(
node.Reputation.AuditReputationAlpha,
node.Reputation.AuditReputationBeta)
return &pb.AuditCheckResponse{
TotalCount: node.Reputation.AuditCount,
SuccessCount: node.Reputation.AuditSuccessCount,
ReputationAlpha: node.Reputation.AuditReputationAlpha,
ReputationBeta: node.Reputation.AuditReputationBeta,
ReputationScore: reputationScore,
}, nil
}
// UptimeCheck returns uptime checks information for client node
func (e *Endpoint) UptimeCheck(ctx context.Context, req *pb.UptimeCheckRequest) (_ *pb.UptimeCheckResponse, err error) {
defer mon.Task()(&ctx)(&err)
peer, err := identity.PeerIdentityFromContext(ctx)
if err != nil {
return nil, NodeStatsEndpointErr.Wrap(err)
}
node, err := e.overlay.Get(ctx, peer.ID)
if err != nil {
return nil, NodeStatsEndpointErr.Wrap(err)
}
reputationScore := calculateReputationScore(
uptimeScore := calculateReputationScore(
node.Reputation.UptimeReputationAlpha,
node.Reputation.UptimeReputationBeta)
return &pb.UptimeCheckResponse{
TotalCount: node.Reputation.UptimeCount,
SuccessCount: node.Reputation.UptimeSuccessCount,
ReputationAlpha: node.Reputation.UptimeReputationAlpha,
ReputationBeta: node.Reputation.UptimeReputationBeta,
ReputationScore: reputationScore,
auditScore := calculateReputationScore(
node.Reputation.AuditReputationAlpha,
node.Reputation.AuditReputationBeta)
return &pb.GetStatsResponse{
UptimeCheck: &pb.ReputationStats{
TotalCount: node.Reputation.UptimeCount,
SuccessCount: node.Reputation.UptimeSuccessCount,
ReputationAlpha: node.Reputation.UptimeReputationAlpha,
ReputationBeta: node.Reputation.UptimeReputationBeta,
ReputationScore: uptimeScore,
},
AuditCheck: &pb.ReputationStats{
TotalCount: node.Reputation.AuditCount,
SuccessCount: node.Reputation.AuditSuccessCount,
ReputationAlpha: node.Reputation.AuditReputationAlpha,
ReputationBeta: node.Reputation.AuditReputationBeta,
ReputationScore: auditScore,
},
}, nil
}

View File

@ -188,16 +188,16 @@ func (s *Service) GetUptime(ctx context.Context) time.Duration {
return time.Now().Sub(s.startedAt)
}
// GetUptimeCheckForSatellite returns uptime check for the satellite
func (s *Service) GetUptimeCheckForSatellite(ctx context.Context, satelliteID storj.NodeID) (_ *nodestats.UptimeCheck, err error) {
// GetStatsFromSatellite returns storagenode stats from the satellite
func (s *Service) GetStatsFromSatellite(ctx context.Context, satelliteID storj.NodeID) (_ *nodestats.Stats, err error) {
defer mon.Task()(&ctx)(&err)
uptime, err := s.nodestats.GetUptimeCheckForSatellite(ctx, satelliteID)
stats, err := s.nodestats.GetStatsFromSatellite(ctx, satelliteID)
if err != nil {
return nil, SNOServiceErr.Wrap(err)
}
return uptime, nil
return stats, nil
}
// GetDailyStorageUsedForSatellite returns daily SpaceUsageStamps for a particular satellite

View File

@ -25,8 +25,16 @@ var (
mon = monkit.Package()
)
// UptimeCheck encapsulates storagenode uptime metrics
type UptimeCheck struct {
// Stats encapsulates storagenode stats retrieved from the satellite
type Stats struct {
SatelliteID storj.NodeID
UptimeCheck ReputationStats
AuditCheck ReputationStats
}
// ReputationStats encapsulates storagenode reputation metrics
type ReputationStats struct {
TotalCount int64
SuccessCount int64
@ -71,8 +79,8 @@ func NewService(log *zap.Logger, transport transport.Client, kademlia *kademlia.
}
}
// GetUptimeCheckForSatellite retrieves UptimeChecks from particular satellite
func (s *Service) GetUptimeCheckForSatellite(ctx context.Context, satelliteID storj.NodeID) (_ *UptimeCheck, err error) {
// GetStatsFromSatellite retrieves node stats from particular satellite
func (s *Service) GetStatsFromSatellite(ctx context.Context, satelliteID storj.NodeID) (_ *Stats, err error) {
defer mon.Task()(&ctx)(&err)
client, err := s.DialNodeStats(ctx, satelliteID)
@ -86,17 +94,30 @@ func (s *Service) GetUptimeCheckForSatellite(ctx context.Context, satelliteID st
}
}()
resp, err := client.UptimeCheck(ctx, &pb.UptimeCheckRequest{})
resp, err := client.GetStats(ctx, &pb.GetStatsRequest{})
if err != nil {
return nil, NodeStatsServiceErr.Wrap(err)
}
return &UptimeCheck{
TotalCount: resp.GetTotalCount(),
SuccessCount: resp.GetSuccessCount(),
ReputationAlpha: resp.GetReputationAlpha(),
ReputationBeta: resp.GetReputationBeta(),
ReputationScore: resp.GetReputationScore(),
uptime := resp.GetUptimeCheck()
audit := resp.GetAuditCheck()
return &Stats{
SatelliteID: satelliteID,
UptimeCheck: ReputationStats{
TotalCount: uptime.GetTotalCount(),
SuccessCount: uptime.GetSuccessCount(),
ReputationAlpha: uptime.GetReputationAlpha(),
ReputationBeta: uptime.GetReputationBeta(),
ReputationScore: uptime.GetReputationScore(),
},
AuditCheck: ReputationStats{
TotalCount: audit.GetTotalCount(),
SuccessCount: audit.GetSuccessCount(),
ReputationAlpha: audit.GetReputationAlpha(),
ReputationBeta: audit.GetReputationBeta(),
ReputationScore: audit.GetReputationScore(),
},
}, nil
}