Exemple #1
0
func (p *gRPCPublisherProxy) Publish(ctx context.Context, arg *rpc.PublishArg) (*common.Empty, error) {
	defer catchPluginPanic(p.Session.Logger())
	err := p.Plugin.Publish(arg.ContentType, arg.Content, common.ParseConfig(arg.Config))
	if err != nil {
		return &common.Empty{}, err
	}
	return &common.Empty{}, nil
}
Exemple #2
0
// --------- Scheduler's managesMetrics implementation ----------
func (pc *ControlGRPCServer) PublishMetrics(ctx context.Context, r *rpc.PubProcMetricsRequest) (*rpc.ErrorReply, error) {
	metrics := common.ToCoreMetrics(r.Metrics)
	errs := pc.control.PublishMetrics(
		metrics,
		common.ParseConfig(r.Config),
		r.TaskId, r.PluginName,
		int(r.PluginVersion))

	return &rpc.ErrorReply{Errors: errorsToStrings(errs)}, nil
}
Exemple #3
0
func (pc *ControlGRPCServer) ProcessMetrics(ctx context.Context, r *rpc.PubProcMetricsRequest) (*rpc.ProcessMetricsReply, error) {
	metrics := common.ToCoreMetrics(r.Metrics)
	mts, errs := pc.control.ProcessMetrics(
		metrics,
		common.ParseConfig(r.Config),
		r.TaskId, r.PluginName,
		int(r.PluginVersion))

	reply := &rpc.ProcessMetricsReply{
		Metrics: common.NewMetrics(mts),
		Errors:  errorsToStrings(errs),
	}
	return reply, nil
}
Exemple #4
0
func (pc *ControlGRPCServer) ProcessMetrics(ctx context.Context, r *rpc.PubProcMetricsRequest) (*rpc.ProcessMetricsReply, error) {
	contentType, content, errs := pc.control.ProcessMetrics(r.ContentType, r.Content, r.PluginName, int(r.PluginVersion), common.ParseConfig(r.Config), r.TaskId)
	erro := make([]string, len(errs))
	for i, v := range errs {
		erro[i] = v.Error()
	}
	reply := &rpc.ProcessMetricsReply{
		ContentType: contentType,
		Content:     content,
		Errors:      erro,
	}
	return reply, nil
}