Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Cleanup errors caught by megacheck #85

Merged
merged 1 commit into from
May 25, 2017
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 7 additions & 7 deletions sources/procfs.go
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,6 @@ const (
type prometheusType func([]string, []string, string, string, uint64) prometheus.Metric

type lustreProcMetric struct {
subsystem string
filename string
promName string
source string //The parent data source (OST, MDS, MGS, etc)
Expand Down Expand Up @@ -531,9 +530,7 @@ func parseStatsFile(helpText string, promName string, path string) (metricList [
return nil, err
}
if statsList != nil {
for _, item := range statsList {
metricList = append(metricList, item)
}
metricList = append(metricList, statsList...)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

See my other comment - we do the opposite here. Might be good to stay consistent.

}

return metricList, nil
Expand Down Expand Up @@ -620,9 +617,9 @@ func parseJobStatsText(jobStats string, promName string, helpText string) (metri
if err != nil {
return nil, err
}
for _, item := range jobList {
metricList = append(metricList, item)
}
if jobList != nil {
metricList = append(metricList, jobList...)
}
}
return metricList, nil
}
Expand Down Expand Up @@ -712,6 +709,9 @@ func (s *lustreSource) parseBRWStats(nodeType string, metricType string, path st

func (s *lustreSource) parseTextFile(nodeType string, metricType string, path string, directoryDepth int, helpText string, promName string, handler func(string, string, string, string, uint64)) (err error) {
filename, nodeName, err := parseFileElements(path, directoryDepth)
if err != nil {
return err
}
fileBytes, err := ioutil.ReadFile(path)
if err != nil {
return err
Expand Down
2 changes: 1 addition & 1 deletion sources/procfs_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -204,7 +204,7 @@ func TestGetJobStats(t *testing.T) {
testPromName = "job_write_bytes_total"
testHelpText = writeTotalHelp

metricList, err = getJobStatsByOperation(testJobBlock, testJobID, testPromName, testHelpText)
_, err = getJobStatsByOperation(testJobBlock, testJobID, testPromName, testHelpText)
if err != nil {
t.Fatal(err)
}
Expand Down
9 changes: 0 additions & 9 deletions sources/source.go
Original file line number Diff line number Diff line change
Expand Up @@ -27,12 +27,3 @@ var Factories = make(map[string]func() (LustreSource, error))
type LustreSource interface {
Update(ch chan<- prometheus.Metric) (err error)
}

type typedDesc struct {
desc *prometheus.Desc
valueType prometheus.ValueType
}

func (d *typedDesc) mustNewConstMetric(value float64, labels ...string) prometheus.Metric {
return prometheus.MustNewConstMetric(d.desc, d.valueType, value, labels...)
}