MCPcopy Create free account
hub / github.com/eth-easl/dirigent / OnMetricsReceive

Method OnMetricsReceive

api/control_plane_api_server.go:127–140  ·  view source on GitHub ↗
(ctx context.Context, metric *proto.AutoscalingMetric)

Source from the content-addressed store, hash-verified

125}
126
127func (c *CpApiServer) OnMetricsReceive(ctx context.Context, metric *proto.AutoscalingMetric) (*proto.ActionStatus, error) {
128 if !c.LeaderElectionServer.IsLeader() {
129 leader := c.LeaderElectionServer.GetLeader()
130
131 if leader != nil {
132 logrus.Warn("Received OnMetricsReceive call although not the leader. Forwarding the call...")
133 return leader.OnMetricsReceive(ctx, metric)
134 } else {
135 return &proto.ActionStatus{Success: false}, nil
136 }
137 }
138
139 return c.ControlPlane.OnMetricsReceive(ctx, metric)
140}
141
142func (c *CpApiServer) ListServices(ctx context.Context, empty *emptypb.Empty) (*proto.ServiceList, error) {
143 if !c.LeaderElectionServer.IsLeader() {

Callers

nothing calls this directly

Calls 3

GetLeaderMethod · 0.80
OnMetricsReceiveMethod · 0.65
IsLeaderMethod · 0.45

Tested by

no test coverage detected