mirror of
https://github.com/akvorado/akvorado.git
synced 2025-12-11 22:14:02 +01:00
chore: use errors.New() instead of fmt.Errorf()
This commit is contained in:
@@ -4,7 +4,7 @@
|
||||
package daemon
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"errors"
|
||||
"testing"
|
||||
"time"
|
||||
|
||||
@@ -87,7 +87,7 @@ func TestTombTracking(t *testing.T) {
|
||||
case <-tomb.Dying():
|
||||
t.Fatalf("Dying() should not happen inside the tomb")
|
||||
case <-ch:
|
||||
return fmt.Errorf("crashing")
|
||||
return errors.New("crashing")
|
||||
}
|
||||
return nil
|
||||
})
|
||||
|
||||
@@ -5,6 +5,7 @@ package clickhouse
|
||||
|
||||
import (
|
||||
"context"
|
||||
"errors"
|
||||
"fmt"
|
||||
"net"
|
||||
"strings"
|
||||
@@ -66,7 +67,7 @@ func (c *Component) migrateDatabase() error {
|
||||
return fmt.Errorf("unable to parse cluster settings: %w", err)
|
||||
}
|
||||
if shardNum == 0 {
|
||||
return fmt.Errorf("cannot get the number of shards for the cluster")
|
||||
return errors.New("cannot get the number of shards for the cluster")
|
||||
}
|
||||
c.shards = int(shardNum)
|
||||
}
|
||||
|
||||
@@ -5,6 +5,7 @@
|
||||
package clickhouse
|
||||
|
||||
import (
|
||||
"errors"
|
||||
"fmt"
|
||||
"os"
|
||||
"sort"
|
||||
@@ -84,7 +85,7 @@ func New(r *reporter.Reporter, configuration Configuration, dependencies Depende
|
||||
return c.config.Resolutions[i].Interval < c.config.Resolutions[j].Interval
|
||||
})
|
||||
if len(c.config.Resolutions) == 0 || c.config.Resolutions[0].Interval != 0 {
|
||||
return nil, fmt.Errorf("resolutions need to be configured, including interval: 0")
|
||||
return nil, errors.New("resolutions need to be configured, including interval: 0")
|
||||
}
|
||||
|
||||
c.d.Daemon.Track(&c.t, "orchestrator/clickhouse")
|
||||
|
||||
@@ -5,6 +5,7 @@ package gnmi
|
||||
|
||||
import (
|
||||
"context"
|
||||
"errors"
|
||||
"fmt"
|
||||
"net"
|
||||
"net/netip"
|
||||
@@ -333,5 +334,5 @@ func (p *Provider) detectModelAndEncoding(ctx context.Context, tg *target.Target
|
||||
return model, encoding, nil
|
||||
}
|
||||
}
|
||||
return Model{}, "", fmt.Errorf("no compatible model found")
|
||||
return Model{}, "", errors.New("no compatible model found")
|
||||
}
|
||||
|
||||
@@ -117,7 +117,7 @@ func (p *Provider) Poll(ctx context.Context, exporter, agent netip.Addr, port ui
|
||||
results = slices.Clone(currentResult.Variables)
|
||||
} else {
|
||||
if len(results) != len(currentResult.Variables) {
|
||||
logError(fmt.Errorf("SNMP mismatch on variable lengths"))
|
||||
logError(errors.New("SNMP mismatch on variable lengths"))
|
||||
}
|
||||
for idx := range results {
|
||||
switch results[idx].Type {
|
||||
@@ -128,7 +128,7 @@ func (p *Provider) Poll(ctx context.Context, exporter, agent netip.Addr, port ui
|
||||
}
|
||||
}
|
||||
if len(results) != len(requests) {
|
||||
logError(fmt.Errorf("SNMP mismatch on variable lengths"))
|
||||
logError(errors.New("SNMP mismatch on variable lengths"))
|
||||
}
|
||||
p.metrics.times.WithLabelValues(exporterStr).Observe(time.Since(start).Seconds())
|
||||
|
||||
|
||||
Reference in New Issue
Block a user