lint
This commit is contained in:
parent
904ccb719c
commit
6bd4fc02c2
2 changed files with 15 additions and 4 deletions
|
@ -44,9 +44,8 @@ type (
|
|||
)
|
||||
|
||||
var (
|
||||
ErrMissingConfig = errors.New("prometheus section missing, can't show metrics")
|
||||
ErrMissingConfig = errors.New("prometheus section missing, can't show metrics")
|
||||
ErrMetricsDisabled = errors.New("prometheus is not enabled, can't show metrics")
|
||||
|
||||
)
|
||||
|
||||
type metricSection interface {
|
||||
|
@ -361,7 +360,7 @@ cscli metrics --url http://lapi.local:6060/metrics show acquisition parsers
|
|||
cscli metrics list`,
|
||||
Args: cobra.ExactArgs(0),
|
||||
DisableAutoGenTag: true,
|
||||
RunE: func(cmd *cobra.Command, args []string) error {
|
||||
RunE: func(_ *cobra.Command, _ []string) error {
|
||||
return cli.show(nil, url, noUnit)
|
||||
},
|
||||
}
|
||||
|
@ -470,12 +469,14 @@ func (cli *cliMetrics) list() error {
|
|||
if err != nil {
|
||||
return fmt.Errorf("failed to marshal metric types: %w", err)
|
||||
}
|
||||
|
||||
fmt.Println(string(x))
|
||||
case "raw":
|
||||
x, err := yaml.Marshal(allMetrics)
|
||||
if err != nil {
|
||||
return fmt.Errorf("failed to marshal metric types: %w", err)
|
||||
}
|
||||
|
||||
fmt.Println(string(x))
|
||||
}
|
||||
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
package main
|
||||
|
||||
import (
|
||||
"errors"
|
||||
"fmt"
|
||||
"io"
|
||||
"sort"
|
||||
|
@ -13,7 +14,7 @@ import (
|
|||
)
|
||||
|
||||
// ErrNilTable means a nil pointer was passed instead of a table instance. This is a programming error.
|
||||
var ErrNilTable = fmt.Errorf("nil table")
|
||||
var ErrNilTable = errors.New("nil table")
|
||||
|
||||
func lapiMetricsToTable(t *table.Table, stats map[string]map[string]map[string]int) int {
|
||||
// stats: machine -> route -> method -> count
|
||||
|
@ -44,6 +45,7 @@ func lapiMetricsToTable(t *table.Table, stats map[string]map[string]map[string]i
|
|||
}
|
||||
|
||||
t.AddRow(row...)
|
||||
|
||||
numRows++
|
||||
}
|
||||
}
|
||||
|
@ -82,6 +84,7 @@ func wlMetricsToTable(t *table.Table, stats map[string]map[string]map[string]int
|
|||
}
|
||||
|
||||
t.AddRow(row...)
|
||||
|
||||
numRows++
|
||||
}
|
||||
}
|
||||
|
@ -120,6 +123,7 @@ func metricsToTable(t *table.Table, stats map[string]map[string]int, keys []stri
|
|||
}
|
||||
|
||||
t.AddRow(row...)
|
||||
|
||||
numRows++
|
||||
}
|
||||
|
||||
|
@ -352,6 +356,7 @@ func (s statStash) Table(out io.Writer, noUnit bool, showEmpty bool) {
|
|||
strconv.Itoa(astats.Count),
|
||||
}
|
||||
t.AddRow(row...)
|
||||
|
||||
numRows++
|
||||
}
|
||||
|
||||
|
@ -400,7 +405,9 @@ func (s statLapi) Table(out io.Writer, noUnit bool, showEmpty bool) {
|
|||
sl,
|
||||
strconv.Itoa(astats[sl]),
|
||||
}
|
||||
|
||||
t.AddRow(row...)
|
||||
|
||||
numRows++
|
||||
}
|
||||
}
|
||||
|
@ -515,6 +522,7 @@ func (s statLapiDecision) Table(out io.Writer, noUnit bool, showEmpty bool) {
|
|||
strconv.Itoa(hits.Empty),
|
||||
strconv.Itoa(hits.NonEmpty),
|
||||
)
|
||||
|
||||
numRows++
|
||||
}
|
||||
|
||||
|
@ -560,6 +568,7 @@ func (s statDecision) Table(out io.Writer, noUnit bool, showEmpty bool) {
|
|||
action,
|
||||
strconv.Itoa(hits),
|
||||
)
|
||||
|
||||
numRows++
|
||||
}
|
||||
}
|
||||
|
@ -594,6 +603,7 @@ func (s statAlert) Table(out io.Writer, noUnit bool, showEmpty bool) {
|
|||
scenario,
|
||||
strconv.Itoa(hits),
|
||||
)
|
||||
|
||||
numRows++
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue