Skip to content

Commit

Permalink
Updated to include changes suggested in PR9 adjustments to print mess…
Browse files Browse the repository at this point in the history
…ages and new lines
  • Loading branch information
eugeneckim authored and ionthegeek committed Nov 3, 2023
1 parent 7378b64 commit a56276b
Showing 1 changed file with 2 additions and 9 deletions.
11 changes: 2 additions & 9 deletions promdump/promdump.go
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@ func init() {

metricName, err := getMetricName(v)
if err != nil {
log.Fatalf("main: %v", err)
log.Fatalf("init: %v", err)
}

// Backticks set the type string for flags in --help output
Expand All @@ -96,7 +96,6 @@ func init() {
}

func getMetricName(metric *promExport) (string, error) {

if metric.exportName != "" && metric.jobName != "" {
return "", errors.New("getMetricName: exportName and jobName are mutually exclusive! Both detected!")
}
Expand All @@ -106,9 +105,7 @@ func getMetricName(metric *promExport) (string, error) {
} else if metric.jobName != "" {
return metric.jobName, nil
}

return "", errors.New("getMetricName: no metric name determined!")

}


Expand All @@ -119,9 +116,8 @@ func logMetricCollectorConfig() {
for _, v := range collectMetrics {

metricName, err := getMetricName(v)

if err != nil {
log.Fatalf("main: %v", err)
log.Fatalf("logMetricCollectorConfig: %v", err)
}

if *out != "" && *out == metricName {
Expand Down Expand Up @@ -430,11 +426,9 @@ func main() {
if *nodePrefix != "" {
for _, v := range collectMetrics {
metricName, err := getMetricName(v)

if err != nil {
log.Fatalf("main: %v", err)
}

checkPrefixes = append(checkPrefixes, metricName)
}
}
Expand All @@ -458,7 +452,6 @@ func main() {
for _, v := range collectMetrics {
if v.collect {
metricName, err := getMetricName(v)

if err != nil {
log.Fatalf("main: %v", err)
}
Expand Down

0 comments on commit a56276b

Please sign in to comment.