diff --git a/metric_collector.go b/metric_collector.go index 59bdd82..be19c02 100644 --- a/metric_collector.go +++ b/metric_collector.go @@ -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)}, } } diff --git a/metrics/exporter.go b/metrics/exporter.go index 6274406..6d4a5cc 100644 --- a/metrics/exporter.go +++ b/metrics/exporter.go @@ -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 {