executor: suppress spurious log messages (#11273)
Suppress stats streaming error log messages when task finishes. Streaming errors are expected when a task finishes and they aren't actionable to users. Also, note that the task runner Stats hook retries collecting stats after a delay. If the connection terminates prematurely, it will be retried, and closing the stats stream is not very disruptive. Ideally, executor terminates cleanly when task exits, but that's a more substantial change that may require changing the executor/drivers interface. Fixes #10814
This commit is contained in:
parent
709c1a2947
commit
48aa6e26e9
|
@ -0,0 +1,3 @@
|
||||||
|
```release-note:bug
|
||||||
|
client: Removed spurious error log messages when tasks complete
|
||||||
|
```
|
|
@ -16,6 +16,8 @@ import (
|
||||||
"github.com/hashicorp/nomad/helper/pluginutils/grpcutils"
|
"github.com/hashicorp/nomad/helper/pluginutils/grpcutils"
|
||||||
"github.com/hashicorp/nomad/plugins/drivers"
|
"github.com/hashicorp/nomad/plugins/drivers"
|
||||||
dproto "github.com/hashicorp/nomad/plugins/drivers/proto"
|
dproto "github.com/hashicorp/nomad/plugins/drivers/proto"
|
||||||
|
"google.golang.org/grpc/codes"
|
||||||
|
"google.golang.org/grpc/status"
|
||||||
)
|
)
|
||||||
|
|
||||||
var _ Executor = (*grpcExecutorClient)(nil)
|
var _ Executor = (*grpcExecutorClient)(nil)
|
||||||
|
@ -132,12 +134,14 @@ func (c *grpcExecutorClient) handleStats(ctx context.Context, stream proto.Execu
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
if err != nil {
|
if err == io.EOF ||
|
||||||
if err != io.EOF {
|
status.Code(err) == codes.Unavailable ||
|
||||||
c.logger.Error("error receiving stream from Stats executor RPC, closing stream", "error", err)
|
status.Code(err) == codes.Canceled ||
|
||||||
}
|
err == context.Canceled {
|
||||||
|
c.logger.Trace("executor Stats stream closed", "msg", err)
|
||||||
// End stream
|
return
|
||||||
|
} else if err != nil {
|
||||||
|
c.logger.Warn("failed to receive Stats executor RPC stream, closing stream", "error", err)
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue