// LabelsToV2 converts labels from interface to V2 spec
342154
func LabelsToV2(labels map[string]CommandLabel) map[string]CommandLabelV2 {
	out := make(map[string]CommandLabelV2, len(labels))
	for key, val := range labels {
		out[key] = CommandLabelV2{
			Period:  NewDuration(val.GetPeriod()),
			Result:  val.GetResult(),
			Command: val.GetCommand(),
		}
	}
	return out
}
1048776
func getLabelsByContainerID(containerID string, frameworks []frameworkInfo, log *logrus.Entry) map[string]string {
	labels := map[string]string{}
	for _, framework := range frameworks {
		log.Debugf("Attempting to add labels to %v framework", framework)
		for _, executor := range framework.Executors {
			log.Debugf("Found executor %v for framework %v", framework, executor)
			if executor.Container == containerID {
				log.Debugf("ContainerID %v for executor %v is a match, adding labels", containerID, executor)
				for _, pair := range executor.Labels {
					if _, inSlice := cosmosLabels[pair.Key]; inSlice {
						continue
					}
					if len(pair.Value) > maxLabelLength {
						log.Warnf("Label %s is longer than %d chars; discarding label", pair.Key, maxLabelLength)
						log.Debugf("Discarded label value: %s", pair.Value)
						continue
					}
					log.Debugf("Adding label for containerID %v: %v = %+v", containerID, pair.Key, pair.Value)
					labels[pair.Key] = pair.Value
				}
				return labels
			}
		}
	}
	return labels
}
921695
func label(b *Builder, args []string, attributes map[string]bool, flagArgs []string, original string) error {
	if len(args) == 0 {
		return errAtLeastOneArgument("LABEL")
	}
	if len(args)%2 != 0 {
		// should never get here, but just in case
		return errTooManyArguments("LABEL")
	}

	if b.RunConfig.Labels == nil {
		b.RunConfig.Labels = map[string]string{}
	}

	for j := 0; j < len(args); j++ {
		// name  ==> args[j]
		// value ==> args[j+1]
		b.RunConfig.Labels[args[j]] = args[j+1]
		j++
	}
	return nil
}
1232211
func (v *DeviceMapperVolume) rawSnapshotLabel(label string) string {
	return volume.DefaultSnapshotLabel(v.Tenant(), label)
}
359383
func (s *Service) FindLabels(ctx context.Context, filter influxdb.LabelFilter, opt ...influxdb.FindOptions) ([]*influxdb.Label, error) {
	ls := []*influxdb.Label{}
	err := s.kv.View(ctx, func(tx Tx) error {
		labels, err := s.findLabels(ctx, tx, filter)
		if err != nil {
			return err
		}
		ls = labels
		return nil
	})

	if err != nil {
		return nil, err
	}

	return ls, nil
}
883992
func (p *pathObject) Labels() *pathObject {
	np := p.clonePath().Labels()
	return p.new(np)
}
249732
func (win *Window) LabelWrap(str string) {
	win.LabelWrapColored(str, win.ctx.Style.Text.Color)
}
888906
func (t *compactionTracker) Labels(level compactionLevel) prometheus.Labels {
	labels := make(prometheus.Labels, len(t.labels))
	for k, v := range t.labels {
		labels[k] = v
	}

	// All metrics have a level label.
	labels["level"] = fmt.Sprint(level)
	return labels
}
1192285
func tagsToMapELBv2(ts []*elbv2.Tag) map[string]string {
	result := make(map[string]string)
	for _, t := range ts {
		if !tagIgnoredELBv2(t) {
			result[*t.Key] = *t.Value
		}
	}

	return result
}
243846
func SearchLabels(labels []string, query string) string {
	for _, l := range labels {
		parts := strings.SplitN(l, "=", 2)
		if len(parts) < 2 {
			continue
		}
		if parts[0] == query {
			return parts[1]
		}
	}
	return ""
}
1310084
func (o *OpLabels) AllLabels() Labels {
	all := make(Labels, len(o.Custom)+len(o.OrchestrationInfo)+len(o.OrchestrationIdentity)+len(o.Disabled))

	for k, v := range o.Custom {
		all[k] = v
	}

	for k, v := range o.Disabled {
		all[k] = v
	}

	for k, v := range o.OrchestrationIdentity {
		all[k] = v
	}

	for k, v := range o.OrchestrationInfo {
		all[k] = v
	}
	return all
}
1147698
func (s *CirconusSink) IncrCounterWithLabels(key []string, val float32, labels []metrics.Label) {
	flatKey := s.flattenKeyLabels(key, labels)
	s.metrics.IncrementByValue(flatKey, uint64(val))
}
554668
func labelsToString(labels map[string][]string) string {
	ls := []string{}
	for k, v := range labels {
		ls = append(ls, fmt.Sprintf("%s:%v", k, v))
	}
	sort.Strings(ls)
	return strings.Join(ls, " ")
}
173389
func (s *ServerV2) GetAllLabels() map[string]string {
	lmap := make(map[string]string)
	for key, value := range s.Metadata.Labels {
		lmap[key] = value
	}
	for key, cmd := range s.Spec.CmdLabels {
		lmap[key] = cmd.Result
	}
	return lmap
}
163731
func datapointLabelsByName(s store.Store) map[string][]datapointLabels {
	rval := map[string][]datapointLabels{}

	for _, obj := range s.Objects() {
		m, ok := obj.(producers.MetricsMessage)
		if !ok {
			promLog.Warnf("Unsupported message type %T", obj)
			continue
		}

		// For each datapoint, collect its labels and add an entry to rval.
		dims := dimsToMap(m.Dimensions)
		for _, d := range m.Datapoints {
			labels := map[string]string{}
			for k, v := range dims {
				labels[k] = v
			}
			for k, v := range d.Tags {
				labels[k] = v
			}
			rval[d.Name] = append(rval[d.Name], datapointLabels{&d, labels})
		}
	}

	return rval
}
459526
func (n *NetworkResource) PortLabels() map[string]int {
	num := len(n.ReservedPorts) + len(n.DynamicPorts)
	labelValues := make(map[string]int, num)
	for _, port := range n.ReservedPorts {
		labelValues[port.Label] = port.Value
	}
	for _, port := range n.DynamicPorts {
		labelValues[port.Label] = port.Value
	}
	return labelValues
}
1261191
func (vs *VSphere) GetLabelsForVolume(ctx context.Context, pv *v1.PersistentVolume) (map[string]string, error) {
	// ignore if zones not enabled
	if !vs.isZoneEnabled() {
		klog.V(4).Infof("Zone labels for volume is not enabled in vsphere.conf")
		return nil, nil
	}
	// ignore if not vSphere volume
	if pv.Spec.VsphereVolume == nil {
		return nil, nil
	}
	return vs.GetVolumeLabels(pv.Spec.VsphereVolume.VolumePath)
}