pkg/process: reduce noise in storj-sim (#2988)
* Don't display stack for failure to start debug endpoints * Don't display stack for disabled telemetry
This commit is contained in:
parent
40ca660c06
commit
e03e6844f8
@ -5,6 +5,7 @@ package process
|
||||
|
||||
import (
|
||||
"context"
|
||||
"errors"
|
||||
"flag"
|
||||
"fmt"
|
||||
"log"
|
||||
@ -245,7 +246,8 @@ func cleanup(cmd *cobra.Command) {
|
||||
|
||||
err = initDebug(logger, monkit.Default)
|
||||
if err != nil {
|
||||
logger.Error("failed to start debug endpoints", zap.Error(err))
|
||||
withoutStack := errors.New(err.Error())
|
||||
logger.Debug("failed to start debug endpoints", zap.Error(withoutStack))
|
||||
}
|
||||
|
||||
var workErr error
|
||||
|
@ -43,8 +43,10 @@ func flagDefault(dev, release string) string {
|
||||
// InitMetrics initializes telemetry reporting. Makes a telemetry.Client and calls
|
||||
// its Run() method in a goroutine.
|
||||
func InitMetrics(ctx context.Context, log *zap.Logger, r *monkit.Registry, instanceID string) (err error) {
|
||||
log = log.Named("telemetry")
|
||||
if *metricCollector == "" || *metricInterval == 0 {
|
||||
return Error.New("telemetry disabled")
|
||||
log.Info("disabled")
|
||||
return nil
|
||||
}
|
||||
if r == nil {
|
||||
r = monkit.Default
|
||||
|
@ -105,7 +105,7 @@ func NewClient(log *zap.Logger, remoteAddr string, opts ClientOpts) (rv *Client,
|
||||
|
||||
// Run calls Report roughly every Interval
|
||||
func (c *Client) Run(ctx context.Context) {
|
||||
c.log.Sugar().Debugf("Initialized telemetry batcher with id = %q", c.opts.InstanceId)
|
||||
c.log.Sugar().Debugf("Initialized batcher with id = %q", c.opts.InstanceId)
|
||||
for {
|
||||
time.Sleep(jitter(c.interval))
|
||||
if ctx.Err() != nil {
|
||||
@ -114,7 +114,7 @@ func (c *Client) Run(ctx context.Context) {
|
||||
|
||||
err := c.Report(ctx)
|
||||
if err != nil {
|
||||
c.log.Sugar().Errorf("failed sending telemetry report: %v", err)
|
||||
c.log.Sugar().Errorf("failed sending report: %v", err)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user