-
Notifications
You must be signed in to change notification settings - Fork 23
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
0e4a84f
commit ff62430
Showing
4 changed files
with
9 additions
and
20 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,28 +1,16 @@ | ||
package exporter | ||
|
||
import ( | ||
"solace_exporter/semp" | ||
"strings" | ||
|
||
"github.com/go-kit/kit/log/level" | ||
"github.com/prometheus/client_golang/prometheus" | ||
"solace_exporter/semp" | ||
) | ||
|
||
// Describe describes all the metrics ever exported by the Solace exporter. It | ||
// implements prometheus.Collector. | ||
func (e *Exporter) Describe(ch chan<- *prometheus.Desc) { | ||
for _, dataSource := range *e.dataSource { | ||
if metricDescItems, ok := semp.MetricDesc[dataSource.Name]; ok { | ||
for _, m := range metricDescItems { | ||
ch <- m.AsPrometheusDesc() | ||
} | ||
} else { | ||
permittedNames := make([]string, 0, len(semp.MetricDesc)) | ||
for index := range semp.MetricDesc { | ||
permittedNames = append(permittedNames, index) | ||
} | ||
_ = level.Error(e.logger).Log("msg", "Unexpected data source name: "+dataSource.Name, "permitted", strings.Join(permittedNames, ",")) | ||
for _, metricDescItems := range semp.MetricDesc { | ||
for _, m := range metricDescItems { | ||
ch <- m.AsPrometheusDesc() | ||
} | ||
|
||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters