MCPcopy
hub / github.com/grafana/tempo / getAssignedPartitions

Method getAssignedPartitions

modules/blockbuilder/blockbuilder.go:648–665  ·  view source on GitHub ↗

Gets assigned partitions, these can be active or inactive. Pending partitions won't be included

()

Source from the content-addressed store, hash-verified

646
647// Gets assigned partitions, these can be active or inactive. Pending partitions won't be included
648func (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}

Calls 4

AssignedPartitionsMethod · 0.80
SetMethod · 0.65
PartitionRingMethod · 0.45
StringMethod · 0.45