agent/eventstream/eventstream.go
func (eventStream *EventStream) Subscribe(name string, handler eventHandler) error {
	eventStream.handlersLock.Lock()
	defer eventStream.handlersLock.Unlock()

	if _, ok := eventStream.handlers[name]; ok {
		return fmt.Errorf("handler %s already exists", name)
	}

	eventStream.handlers[name] = handler
	return nil
}
func (eventStream *EventStream) Subscribe(name string, handler eventHandler) error {
	eventStream.handlersLock.Lock()
	defer eventStream.handlersLock.Unlock()

	if _, ok := eventStream.handlers[name]; ok {
		return fmt.Errorf("handler %s already exists", name)
	}

	eventStream.handlers[name] = handler
	return nil
}
// Subscribe adds the handler to be called into EventStream