Gets assigned partitions, these can be active or inactive. Pending partitions won't be included
()
| 646 | |
| 647 | // Gets assigned partitions, these can be active or inactive. Pending partitions won't be included |
| 648 | func (b *BlockBuilder) getAssignedPartitions() []int32 { |
| 649 | partitions := b.partitionRing.PartitionRing().Partitions() |
| 650 | ringAssignedPartitions := make(map[int32]string, len(partitions)) |
| 651 | for _, p := range partitions { |
| 652 | if p.IsActive() || p.IsInactive() { |
| 653 | ringAssignedPartitions[p.Id] = p.GetState().String() |
| 654 | } |
| 655 | } |
| 656 | |
| 657 | assignedActivePartitions := make([]int32, 0, len(b.cfg.AssignedPartitions())) |
| 658 | for _, partition := range b.cfg.AssignedPartitions() { |
| 659 | if s, ok := ringAssignedPartitions[partition]; ok { |
| 660 | metricOwnedPartitions.WithLabelValues(strconv.Itoa(int(partition)), s).Set(1) |
| 661 | assignedActivePartitions = append(assignedActivePartitions, partition) |
| 662 | } |
| 663 | } |
| 664 | return assignedActivePartitions |
| 665 | } |