bird_exporter/direct/exporter.go
2017-11-29 21:08:04 +01:00

27 lines
694 B
Go

package direct
import (
"github.com/czerwonk/bird_exporter/protocol"
"github.com/prometheus/client_golang/prometheus"
)
var exporter map[int]*protocol.GenericProtocolMetricExporter
type DirectMetricExporter struct {
}
func init() {
exporter = make(map[int]*protocol.GenericProtocolMetricExporter)
exporter[4] = protocol.NewGenericProtocolMetricExporter("direct4")
exporter[6] = protocol.NewGenericProtocolMetricExporter("direct6")
}
func (*DirectMetricExporter) Describe(ch chan<- *prometheus.Desc) {
exporter[4].Describe(ch)
exporter[6].Describe(ch)
}
func (*DirectMetricExporter) Export(p *protocol.Protocol, ch chan<- prometheus.Metric) {
exporter[p.IpVersion].Export(p, ch)
}