// AddEvent adds the event to the aggregator, automatically creating new classes
// as needed.
13496
func (a *Aggregator) AddEvent(event *log.Event, id, fingerprint string) {
	if a.rateLimit != event.RateLimit {
		a.rateLimit = event.RateLimit
	}

	outlier := false
	if a.outlierTime > 0 && event.TimeMetrics["Query_time"] > a.outlierTime {
		outlier = true
	}

	a.global.AddEvent(event, outlier)

	class, ok := a.classes[id]
	if !ok {
		class = NewClass(id, fingerprint, a.samples)
		a.classes[id] = class
	}
	class.AddEvent(event, outlier)
}
178309
func (h *HTTPSink) AddEvents(ctx context.Context, events []*event.Event) (err error) {
	if len(events) == 0 || h.EventEndpoint == "" {
		return nil
	}
	return h.doBottom(ctx, func() (io.Reader, bool, error) {
		return h.encodePostBodyProtobufV2Events(events)
	}, "application/x-protobuf", h.EventEndpoint, datapointAndEventResponseValidator)
}
721627
func (c *GorymanClient) SendEvent(e *Event) error {
	epb, err := EventToProtocolBuffer(e)
	if err != nil {
		return err
	}

	message := &proto.Msg{}
	message.Events = append(message.Events, epb)

	_, err = c.sendMaybeRecv(message)
	return err
}
426087
func (b *EventBus) AddHandler(m eh.EventMatcher, h eh.EventHandler) {
	ch := b.channel(m, h, false)
	go b.handle(m, h, ch)
}
315537
func (f EventHandlerFunc) HandleEvent(resp http.ResponseWriter, req *http.Request, event *Event) {
	f(resp, req, event)
}
674306
func (f *ItemFlagger) AddEvents(ctx context.Context, events []*event.Event, next Sink) error {
	if f.CtxFlagCheck.HasFlag(ctx) {
		atomic.AddInt64(&f.stats.totalEvCtxSignals, 1)
		for _, dp := range events {
			f.SetEventFlag(dp)
		}
		return next.AddEvents(ctx, events)
	}
	dims := f.GetDimensions()
	if len(dims) == 0 {
		return next.AddEvents(ctx, events)
	}
	for _, ev := range events {
		if evMatches(ev, dims) {
			atomic.AddInt64(&f.stats.totalEvDimSignals, 1)
			f.SetEventFlag(ev)
		}
	}
	return next.AddEvents(ctx, events)
}
1282531
func appendEvent(events []riemanngo.Event, sink *RiemannSink, host, name string, value interface{}, labels map[string]string, timestamp int64) []riemanngo.Event {
	event := riemanngo.Event{
		Time:        timestamp,
		Service:     name,
		Host:        host,
		Description: "",
		Attributes:  labels,
		Metric:      value,
		Ttl:         sink.config.Ttl,
		State:       sink.config.State,
		Tags:        sink.config.Tags,
	}
	// state everywhere
	events = append(events, event)
	if len(events) >= sink.config.BatchSize {
		err := riemannCommon.SendData(sink.client, events)
		if err != nil {
			glog.Warningf("Error sending events to Riemann: %v", err)
			// client will reconnect later
			sink.client = nil
		}
		events = nil
	}
	return events
}
7559
func (s *UnsubscribeFromEventInput) SetEvent(v string) *UnsubscribeFromEventInput {
	s.Event = &v
	return s
}
1286296
func (m *EventHandler) HandleEvent(ctx context.Context, event eh.Event) error {
	if m.Err != nil {
		return m.Err
	}
	m.Events = append(m.Events, event)
	m.Context = ctx
	m.Time = time.Now()
	m.Recv <- event
	return nil
}
1274800
func (h *HistoCounter) AddEvents(ctx context.Context, events []*event.Event, next Sink) error {
	h.EventBucket.Add(float64(len(events)))
	return h.sink.AddEvents(ctx, events, next)
}
400617
func NewEvent(meta EventHandler) *Event {
	return &Event{
		Metadata:     meta,
		eventResults: make(chan interface{}, 1),
		cancelled:    make(chan struct{}),
		stats:        eventStatistics{},
	}
}
658394
func (a *Aggregate) ApplyEvent(ctx context.Context, event eh.Event) error {
	switch event.EventType() {
	case Created:
		a.created = true
	case Deleted:
		a.created = false
	case ItemAdded:
		data, ok := event.Data().(*ItemAddedData)
		if !ok {
			return errors.New("invalid event data")
		}
		a.items = append(a.items, &TodoItem{
			ID:          data.ItemID,
			Description: data.Description,
		})
		a.nextItemID++
	case ItemRemoved:
		data, ok := event.Data().(*ItemRemovedData)
		if !ok {
			return errors.New("invalid event data")
		}
		for i, item := range a.items {
			if item.ID == data.ItemID {
				a.items = append(a.items[:i], a.items[i+1:]...)
				break
			}
		}
	case ItemDescriptionSet:
		data, ok := event.Data().(*ItemDescriptionSetData)
		if !ok {
			return errors.New("invalid event data")
		}
		for _, item := range a.items {
			if item.ID == data.ItemID {
				item.Description = data.Description
			}
		}
	case ItemChecked:
		data, ok := event.Data().(*ItemCheckedData)
		if !ok {
			return errors.New("invalid event data")
		}
		for _, item := range a.items {
			if item.ID == data.ItemID {
				item.Completed = data.Checked
			}
		}
	default:
		return fmt.Errorf("could not apply event: %s", event.EventType())
	}
	return nil
}
702503
func (t *NotificationConfig) AddEvents(events ...NotificationEventType) {
	t.Events = append(t.Events, events...)
}
633882
func (c *Client) AddEvent(e contract.Event) (id string, err error) {
	conn := c.Pool.Get()
	defer conn.Close()

	if e.ID != "" {
		_, err = uuid.Parse(e.ID)
		if err != nil {
			return "", db.ErrInvalidObjectId
		}
	}
	return addEvent(conn, e)
}
311521
func (s *AssessmentRunNotification) SetEvent(v string) *AssessmentRunNotification {
	s.Event = &v
	return s
}
327313
func (s *EventSubscription) SetEvent(v string) *EventSubscription {
	s.Event = &v
	return s
}
775944
func NewEvent() *Event {
	event := new(Event)
	event.TimeMetrics = make(map[string]float64)
	event.NumberMetrics = make(map[string]uint64)
	event.BoolMetrics = make(map[string]bool)
	return event
}