chore(all): replace all fmt.Errorf without paramters with errors.New (#21068)
This commit is contained in:
@@ -3,6 +3,7 @@ package telemetry
|
||||
import (
|
||||
"bytes"
|
||||
"encoding/json"
|
||||
"errors"
|
||||
"fmt"
|
||||
"net/http"
|
||||
"time"
|
||||
@@ -145,7 +146,7 @@ func (m *Metrics) Gather(format string) (GatherResponse, error) {
|
||||
// If Prometheus metrics are not enabled, it returns an error.
|
||||
func (m *Metrics) gatherPrometheus() (GatherResponse, error) {
|
||||
if !m.prometheusEnabled {
|
||||
return GatherResponse{}, fmt.Errorf("prometheus metrics are not enabled")
|
||||
return GatherResponse{}, errors.New("prometheus metrics are not enabled")
|
||||
}
|
||||
|
||||
metricsFamilies, err := prometheus.DefaultGatherer.Gather()
|
||||
@@ -171,7 +172,7 @@ func (m *Metrics) gatherPrometheus() (GatherResponse, error) {
|
||||
func (m *Metrics) gatherGeneric() (GatherResponse, error) {
|
||||
gm, ok := m.sink.(DisplayableSink)
|
||||
if !ok {
|
||||
return GatherResponse{}, fmt.Errorf("non in-memory metrics sink does not support generic format")
|
||||
return GatherResponse{}, errors.New("non in-memory metrics sink does not support generic format")
|
||||
}
|
||||
|
||||
summary, err := gm.DisplayMetrics(nil, nil)
|
||||
|
||||
Reference in New Issue
Block a user