renamed legacy exporter

This commit is contained in:
Daniel Czerwonk 2017-12-01 14:33:22 +01:00
parent eabc3de149
commit b9045077ae
2 changed files with 11 additions and 11 deletions

View File

@ -29,12 +29,12 @@ func exportersForLegacy() map[int][]metrics.MetricExporter {
l := &metrics.LegacyLabelStrategy{}
return map[int][]metrics.MetricExporter{
protocol.BGP: []metrics.MetricExporter{metrics.NewMetricExporter("bgp4_session", "bgp6_session", l)},
protocol.Device: []metrics.MetricExporter{metrics.NewMetricExporter("device4", "device6", l)},
protocol.Direct: []metrics.MetricExporter{metrics.NewMetricExporter("direct4", "direct6", l)},
protocol.Kernel: []metrics.MetricExporter{metrics.NewMetricExporter("kernel4", "kernel6", l)},
protocol.OSPF: []metrics.MetricExporter{metrics.NewMetricExporter("ospf", "ospfv3", l), ospf.NewExporter("")},
protocol.Static: []metrics.MetricExporter{metrics.NewMetricExporter("static4", "static6", l)},
protocol.BGP: []metrics.MetricExporter{metrics.NewLegacyMetricExporter("bgp4_session", "bgp6_session", l)},
protocol.Device: []metrics.MetricExporter{metrics.NewLegacyMetricExporter("device4", "device6", l)},
protocol.Direct: []metrics.MetricExporter{metrics.NewLegacyMetricExporter("direct4", "direct6", l)},
protocol.Kernel: []metrics.MetricExporter{metrics.NewLegacyMetricExporter("kernel4", "kernel6", l)},
protocol.OSPF: []metrics.MetricExporter{metrics.NewLegacyMetricExporter("ospf", "ospfv3", l), ospf.NewExporter("")},
protocol.Static: []metrics.MetricExporter{metrics.NewLegacyMetricExporter("static4", "static6", l)},
}
}

View File

@ -5,24 +5,24 @@ import (
"github.com/czerwonk/bird_exporter/protocol"
)
type ProtocolMetricExporter struct {
type LegacyMetricExporter struct {
ipv4Exporter *GenericProtocolMetricExporter
ipv6Exporter *GenericProtocolMetricExporter
}
func NewMetricExporter(prefixIpv4, prefixIpv6 string, labelStrategy LabelStrategy) *ProtocolMetricExporter {
return &ProtocolMetricExporter{
func NewLegacyMetricExporter(prefixIpv4, prefixIpv6 string, labelStrategy LabelStrategy) MetricExporter {
return &LegacyMetricExporter {
ipv4Exporter: NewGenericProtocolMetricExporter(prefixIpv4, false, labelStrategy),
ipv6Exporter: NewGenericProtocolMetricExporter(prefixIpv6, false, labelStrategy),
}
}
func (e *ProtocolMetricExporter) Describe(ch chan<- *prometheus.Desc) {
func (e *LegacyMetricExporter) Describe(ch chan<- *prometheus.Desc) {
e.ipv4Exporter.Describe(ch)
e.ipv6Exporter.Describe(ch)
}
func (e *ProtocolMetricExporter) Export(p *protocol.Protocol, ch chan<- prometheus.Metric) {
func (e *LegacyMetricExporter) Export(p *protocol.Protocol, ch chan<- prometheus.Metric) {
if p.IpVersion == 4 {
e.ipv4Exporter.Export(p, ch)
} else {