Esempio n. 1
0
func (c ControlProxy) UnsubscribeDeps(taskID string, mts []core.Metric, plugins []core.Plugin) []serror.SnapError {
	req := depsRequest(taskID, mts, plugins)
	reply, err := c.Client.UnsubscribeDeps(getContext(), req)
	if err != nil {
		return []serror.SnapError{serror.New(err)}
	}
	serrs := common.ConvertSnapErrors(reply.Errors)
	return serrs
}
Esempio n. 2
0
func (c ControlProxy) SubscribeDeps(taskID string, requested []core.RequestedMetric, plugins []core.SubscribedPlugin, configTree *cdata.ConfigDataTree) []serror.SnapError {
	req := depsRequest(taskID, requested, plugins, configTree)
	reply, err := c.Client.SubscribeDeps(getContext(), req)
	if err != nil {
		return []serror.SnapError{serror.New(err)}
	}
	serrs := common.ConvertSnapErrors(reply.Errors)
	return serrs
}
Esempio n. 3
0
func (c ControlProxy) UnsubscribeDeps(taskID string) []serror.SnapError {
	req := &rpc.UnsubscribeDepsRequest{TaskId: taskID}
	reply, err := c.Client.UnsubscribeDeps(getContext(), req)
	if err != nil {
		return []serror.SnapError{serror.New(err)}
	}
	serrs := common.ConvertSnapErrors(reply.Errors)
	return serrs
}
Esempio n. 4
0
func (c ControlProxy) ValidateDeps(mts []core.Metric, plugins []core.SubscribedPlugin) []serror.SnapError {
	req := &rpc.ValidateDepsRequest{
		Metrics: common.NewMetrics(mts),
		Plugins: common.ToSubPluginsMsg(plugins),
	}
	reply, err := c.Client.ValidateDeps(getContext(), req)
	if err != nil {
		return []serror.SnapError{serror.New(err)}
	}
	serrs := common.ConvertSnapErrors(reply.Errors)
	return serrs
}
Esempio n. 5
0
func (c ControlProxy) ValidateDeps(mts []core.RequestedMetric, plugins []core.SubscribedPlugin, _ *cdata.ConfigDataTree) []serror.SnapError {
	// The configDataTree is kept so that we can match the interface provided by control
	// we do not need it here though since the configDataTree is only used for metrics
	// and we do not allow remote collection.
	req := &rpc.ValidateDepsRequest{
		Metrics: common.RequestedToMetric(mts),
		Plugins: common.ToSubPluginsMsg(plugins),
	}
	reply, err := c.Client.ValidateDeps(getContext(), req)
	if err != nil {
		return []serror.SnapError{serror.New(err)}
	}
	serrs := common.ConvertSnapErrors(reply.Errors)
	return serrs
}