mirror of
https://github.com/seaweedfs/seaweedfs.git
synced 2024-01-19 02:48:24 +00:00
wip
This commit is contained in:
parent
cf28108ea4
commit
6c6655de9d
|
@ -40,9 +40,7 @@ func (broker *MessageQueueBroker) ConnectToBalancer(stream mq_pb.SeaweedMessagin
|
||||||
return status.Errorf(codes.Unavailable, "not current broker balancer")
|
return status.Errorf(codes.Unavailable, "not current broker balancer")
|
||||||
}
|
}
|
||||||
if receivedStats := req.GetStats(); receivedStats != nil {
|
if receivedStats := req.GetStats(); receivedStats != nil {
|
||||||
brokerStats.TopicPartitionCount = receivedStats.TopicPartitionCount
|
brokerStats.UpdateStats(receivedStats)
|
||||||
brokerStats.ConsumerCount = receivedStats.ConsumerCount
|
|
||||||
brokerStats.CpuUsagePercent = receivedStats.CpuUsagePercent
|
|
||||||
|
|
||||||
glog.V(3).Infof("broker %s stats: %+v", initMessage.Broker, brokerStats)
|
glog.V(3).Infof("broker %s stats: %+v", initMessage.Broker, brokerStats)
|
||||||
}
|
}
|
||||||
|
|
|
@ -58,11 +58,23 @@ func (manager *LocalTopicManager) RemoveTopicPartition(topic Topic, partition Pa
|
||||||
}
|
}
|
||||||
|
|
||||||
func (manager *LocalTopicManager) CollectStats(duration time.Duration) *mq_pb.BrokerStats {
|
func (manager *LocalTopicManager) CollectStats(duration time.Duration) *mq_pb.BrokerStats {
|
||||||
stats := &mq_pb.BrokerStats{}
|
stats := &mq_pb.BrokerStats{
|
||||||
|
Stats: make(map[string]*mq_pb.TopicPartitionStats),
|
||||||
|
}
|
||||||
manager.topics.IterCb(func(topic string, localTopic *LocalTopic) {
|
manager.topics.IterCb(func(topic string, localTopic *LocalTopic) {
|
||||||
for _, localPartition := range localTopic.Partitions {
|
for _, localPartition := range localTopic.Partitions {
|
||||||
stats.TopicPartitionCount++
|
stats.Stats[topic] = &mq_pb.TopicPartitionStats{
|
||||||
stats.ConsumerCount += localPartition.ConsumerCount
|
Topic: &mq_pb.Topic{
|
||||||
|
Namespace: string(localTopic.Namespace),
|
||||||
|
Name: localTopic.Name,
|
||||||
|
},
|
||||||
|
Partition: &mq_pb.Partition{
|
||||||
|
RingSize: localPartition.RingSize,
|
||||||
|
RangeStart: localPartition.RangeStart,
|
||||||
|
RangeStop: localPartition.RangeStop,
|
||||||
|
},
|
||||||
|
ConsumerCount: localPartition.ConsumerCount,
|
||||||
|
}
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|
||||||
|
|
|
@ -105,10 +105,17 @@ message CheckBrokerLoadResponse {
|
||||||
|
|
||||||
//////////////////////////////////////////////////
|
//////////////////////////////////////////////////
|
||||||
message BrokerStats {
|
message BrokerStats {
|
||||||
int32 topic_partition_count = 1;
|
int32 cpu_usage_percent = 1;
|
||||||
int32 consumer_count = 2;
|
map<string, TopicPartitionStats> stats = 2;
|
||||||
int32 cpu_usage_percent = 3;
|
|
||||||
}
|
}
|
||||||
|
message TopicPartitionStats {
|
||||||
|
Topic topic = 1;
|
||||||
|
Partition partition = 2;
|
||||||
|
int32 consumer_count = 3;
|
||||||
|
bool is_leader = 4;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
message ConnectToBalancerRequest {
|
message ConnectToBalancerRequest {
|
||||||
message InitMessage {
|
message InitMessage {
|
||||||
string broker = 1;
|
string broker = 1;
|
||||||
|
|
File diff suppressed because it is too large
Load diff
Loading…
Reference in a new issue