// NewStopwatchWithTags creates a new StopWatch and starts measuring time
// its creation. Allows additional tags.
170288
func NewStopwatchWithTags(name, vCenter string, tags map[string]string) *Stopwatch {
	tags["vcenter"] = vCenter
	return &Stopwatch{
		stat:  selfstat.RegisterTiming("vsphere", name+"_ns", tags),
		start: time.Now(),
	}
}
1197200
func (c *Client) WatchAll() (params.AllWatcherId, error) {
	if err := c.checkCanRead(); err != nil {
		return params.AllWatcherId{}, err
	}
	model, err := c.api.stateAccessor.Model()
	if err != nil {
		return params.AllWatcherId{}, errors.Trace(err)
	}

	// Since we know this is a user tag (because AuthClient is true),
	// we just do the type assertion to the UserTag.
	apiUser, _ := c.api.auth.GetAuthTag().(names.UserTag)
	isAdmin, err := common.HasModelAdmin(c.api.auth, apiUser, c.api.stateAccessor.ControllerTag(), model)
	if err != nil {
		return params.AllWatcherId{}, errors.Trace(err)
	}
	watchParams := state.WatchParams{IncludeOffers: isAdmin}

	w := c.api.stateAccessor.Watch(watchParams)
	return params.AllWatcherId{
		AllWatcherId: c.api.resources.Register(w),
	}, nil
}
1124384
func WithTags(ctx context.Context, tags []string) context.Context {
	stats, ok := FromContext(ctx)
	if !ok {
		return ctx
	}
	return WithStats(ctx, &taggedStats{tags, stats})
}
796350
func (c *expvarStatsClient) CountWithCustomTags(name string, value int64, rate float64, tags []string) {
	c.m.Add(name, value)
}
743395
func (v *RsyncVolume) getSnapshotWithTag(tagName string, lock bool) (*volume.SnapshotInfo, error) {
	// Get all snapshots on the volume
	var err error
	var snapshotLabels []string
	if lock {
		snapshotLabels, err = v.Snapshots()
	} else {
		snapshotLabels, err = v.getSnapshotList()
	}

	if err != nil {
		glog.Errorf("Could not get current snapshot list: %s", err)
		return nil, err
	}
	// Get info for each snapshot and return if a matching tag is found
	for _, snapshotLabel := range snapshotLabels {
		if info, err := v.SnapshotInfo(snapshotLabel); err != volume.ErrInvalidSnapshot {
			if err != nil {
				glog.Errorf("Could not get info for snaphot %s: %s", snapshotLabel, err)
				return nil, err
			}
			for _, tag := range info.Tags {
				if tag == tagName {
					return info, nil
				}
			}
		}
	}
	return nil, volume.ErrSnapshotDoesNotExist
}
9235
func NewStatusCheck(Name string, Tags []string) *StatusCheck {
	return &StatusCheck{InterMetric{Name: Name, Tags: Tags}}
}
944815
func StatusHasTag(stream *imagev1.ImageStream, name string) (imagev1.NamedTagEventList, bool) {
	for _, tag := range stream.Status.Tags {
		if tag.Tag == name {
			return tag, true
		}
	}
	return imagev1.NamedTagEventList{}, false
}
383470
func (r *Reader) CheckTags(expectTags []byte) (tag byte) {
	tag = r.readByte()
	if bytes.IndexByte(expectTags, tag) == -1 {
		unexpectedTag(tag, expectTags)
	}
	return
}
295290
func diffTagsCloudWatchEvents(oldTags, newTags []*events.Tag) ([]*events.Tag, []*events.Tag) {
	// First, we're creating everything we have
	create := make(map[string]interface{})
	for _, t := range newTags {
		create[*t.Key] = *t.Value
	}

	// Build the list of what to remove
	var remove []*events.Tag
	for _, t := range oldTags {
		old, ok := create[*t.Key]
		if !ok || old != *t.Value {
			// Delete it!
			remove = append(remove, t)
		}
	}

	return tagsFromMapCloudWatchEvents(create), remove
}
275529
func (api trackApi) GetTopTags(args map[string]interface{}) (result TrackGetTopTags, err error) {
	defer func() { appendCaller(err, "lastfm.Track.GetTopTags") }()
	err = callGet("track.gettoptags", api.params, args, &result, P{
		"plain": []string{"artist", "track", "mbid", "autocorrect"},
	})
	return
}
215772
func (st *State) WatchVolumeAttachmentPlans(scope names.Tag) (watcher.MachineStorageIdsWatcher, error) {
	return st.watchAttachments("WatchVolumeAttachmentPlans", scope, apiwatcher.NewVolumeAttachmentPlansWatcher)
}
548010
func (f *Facade) WatchActionNotifications(args params.Entities) params.StringsWatchResults {
	tagToActionReceiver := f.backend.TagToActionReceiverFn(f.backend.FindEntity)
	watchOne := common.WatchOneActionReceiverNotifications(tagToActionReceiver, f.resources.Register)
	return common.WatchActionNotifications(args, f.accessMachine, watchOne)
}
836367
func Tag(c context.Context, v string) context.Context {
	return context.WithValue(c, &clockTagKey, append(Tags(c), v))
}
152061
func (f *Filter) filterTags(metric telegraf.Metric) {
	filterKeys := []string{}
	if f.tagInclude != nil {
		for _, tag := range metric.TagList() {
			if !f.tagInclude.Match(tag.Key) {
				filterKeys = append(filterKeys, tag.Key)
			}
		}
	}
	for _, key := range filterKeys {
		metric.RemoveTag(key)
	}

	if f.tagExclude != nil {
		for _, tag := range metric.TagList() {
			if f.tagExclude.Match(tag.Key) {
				filterKeys = append(filterKeys, tag.Key)
			}
		}
	}
	for _, key := range filterKeys {
		metric.RemoveTag(key)
	}
}
244101
func (hook *SentryHook) SetTagsContext(t map[string]string) {
	hook.client.SetTagsContext(t)
}
996494
func (self *events) StopWatch(watchId int) {
	self.watcherLock.Lock()
	defer self.watcherLock.Unlock()
	_, ok := self.watchers[watchId]
	if !ok {
		log.Errorf("Could not find watcher instance %v", watchId)
	}
	close(self.watchers[watchId].eventChannel.GetChannel())
	delete(self.watchers, watchId)
}
536119
func tagsToMapCloudWatch(ts []*cloudwatch.Tag) map[string]string {
	result := make(map[string]string)
	for _, t := range ts {
		if !tagIgnoredCloudWatch(t) {
			result[*t.Key] = *t.Value
		}
	}

	return result
}