Skip to content

Commit

Permalink
some trivial improvements (#621)
Browse files Browse the repository at this point in the history
* don't log when get metrics

* add node to pull log
  • Loading branch information
yuyang0 committed Oct 19, 2023
1 parent 4b842ce commit 96b31aa
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 4 deletions.
2 changes: 1 addition & 1 deletion cluster/calcium/helper.go
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ func distributionInspect(ctx context.Context, node *types.Node, image string, di

// Pull an image
func pullImage(ctx context.Context, node *types.Node, image string) error {
logger := log.WithFunc("calcium.pullImage").WithField("image", image)
logger := log.WithFunc("calcium.pullImage").WithField("node", node.Name).WithField("image", image)
logger.Info(ctx, "Pulling image")
if image == "" {
return types.ErrNoImage
Expand Down
2 changes: 0 additions & 2 deletions metrics/metrics.go
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,6 @@ type Metrics struct {

// SendDeployCount update deploy counter
func (m *Metrics) SendDeployCount(ctx context.Context, n int) {
log.WithFunc("metrics.SendDeployCount").Info(ctx, "Update deploy counter")
metrics := &plugintypes.Metrics{
Name: deployCountName,
Labels: []string{m.Hostname},
Expand All @@ -58,7 +57,6 @@ func (m *Metrics) SendDeployCount(ctx context.Context, n int) {
}

func (m *Metrics) SendPodNodeStatus(ctx context.Context, node *types.Node) {
log.WithFunc("metrics.SendPodNodeStatus").Info(ctx, "update pod node status")
up := !node.IsDown()
metrics := &plugintypes.Metrics{
Name: podNodeStatusName,
Expand Down
4 changes: 3 additions & 1 deletion resource/plugins/binary/call.go
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,9 @@ func (p Plugin) execCommand(ctx context.Context, cmd *exec.Cmd, req any) ([]byte
if err != nil {
return nil, err
}
logger.WithField("in", string(b)).WithField("cmd", cmd.String()).Info(ctx, "call params")
if len(cmd.Args) < 2 || cmd.Args[1] != GetMetricsCommand {
logger.WithField("in", string(b)).WithField("cmd", cmd.String()).Info(ctx, "call params")
}
cmd.Stdin = bytes.NewBuffer(b)
return cmd.CombinedOutput()
}

0 comments on commit 96b31aa

Please sign in to comment.